From 636543d86915837013c3eb1e0a9ea96114ef73fc Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 4 Jun 2024 17:49:46 +0000 Subject: [PATCH] Update autogenerated bindings to latest LDK 0.0.123-bindings --- lightning-c-bindings/include/ldk_rust_types.h | 16 +- lightning-c-bindings/include/lightning.h | 8026 ++++++++------- lightning-c-bindings/include/lightningpp.hpp | 478 +- lightning-c-bindings/src/c_types/derived.rs | 9066 +++++++++-------- .../src/lightning/chain/transaction.rs | 5 + .../src/lightning/events/mod.rs | 5 + .../src/lightning/ln/channel_state.rs | 1990 ++++ .../src/lightning/ln/channelmanager.rs | 1175 +-- lightning-c-bindings/src/lightning/ln/mod.rs | 1 + lightning-c-bindings/src/lightning/ln/msgs.rs | 10 + .../src/lightning/ln/peer_handler.rs | 5 + .../src/lightning/ln/script.rs | 5 + .../src/lightning/ln/types.rs | 5 + .../src/lightning/offers/invoice_error.rs | 5 + .../src/lightning/offers/offer.rs | 5 + .../src/lightning/offers/refund.rs | 5 + .../src/lightning/routing/gossip.rs | 30 + .../src/lightning/routing/router.rs | 17 +- .../src/lightning/util/logger.rs | 5 + .../src/lightning/util/ser.rs | 5 + .../src/lightning/util/string.rs | 10 + 21 files changed, 11771 insertions(+), 9098 deletions(-) create mode 100644 lightning-c-bindings/src/lightning/ln/channel_state.rs diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index 6e7818b..e37879c 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -167,12 +167,6 @@ struct nativeChannelManagerOpaque; typedef struct nativeChannelManagerOpaque LDKnativeChannelManager; struct nativeChainParametersOpaque; typedef struct nativeChainParametersOpaque LDKnativeChainParameters; -struct nativeCounterpartyForwardingInfoOpaque; -typedef struct nativeCounterpartyForwardingInfoOpaque LDKnativeCounterpartyForwardingInfo; -struct nativeChannelCounterpartyOpaque; -typedef struct nativeChannelCounterpartyOpaque LDKnativeChannelCounterparty; -struct nativeChannelDetailsOpaque; -typedef struct nativeChannelDetailsOpaque LDKnativeChannelDetails; struct nativePhantomRouteHintsOpaque; typedef struct nativePhantomRouteHintsOpaque LDKnativePhantomRouteHints; struct nativeChannelManagerReadArgsOpaque; @@ -339,6 +333,16 @@ struct nativeTrampolineOnionPacketOpaque; typedef struct nativeTrampolineOnionPacketOpaque LDKnativeTrampolineOnionPacket; struct nativeRecordOpaque; typedef struct nativeRecordOpaque LDKnativeRecord; +struct nativeInboundHTLCDetailsOpaque; +typedef struct nativeInboundHTLCDetailsOpaque LDKnativeInboundHTLCDetails; +struct nativeOutboundHTLCDetailsOpaque; +typedef struct nativeOutboundHTLCDetailsOpaque LDKnativeOutboundHTLCDetails; +struct nativeCounterpartyForwardingInfoOpaque; +typedef struct nativeCounterpartyForwardingInfoOpaque LDKnativeCounterpartyForwardingInfo; +struct nativeChannelCounterpartyOpaque; +typedef struct nativeChannelCounterpartyOpaque LDKnativeChannelCounterparty; +struct nativeChannelDetailsOpaque; +typedef struct nativeChannelDetailsOpaque LDKnativeChannelDetails; struct nativeFutureOpaque; typedef struct nativeFutureOpaque LDKnativeFuture; struct nativeSleeperOpaque; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 30fd577..fad8366 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -599,6 +599,58 @@ typedef enum LDKIOError { LDKIOError_Sentinel, } LDKIOError; +/** + * Exposes the state of pending inbound HTLCs. + * + * At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes + * through the following states in the state machine: + * - Announced for addition by the originating node through the update_add_htlc message. + * - Added to the commitment transaction of the receiving node and originating node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * - Announced for resolution (fulfillment or failure) by the receiving node through either one of + * the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. + * - Removed from the commitment transaction of the originating node and receiving node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * + * This can be used to inspect what next message an HTLC is waiting for to advance its state. + */ +typedef enum LDKInboundHTLCStateDetails { + /** + * We have added this HTLC in our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * before this HTLC is included on the remote commitment transaction. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd, + /** + * This HTLC has been included in the commitment_signed and revoke_and_ack messages on both sides + * and is included in both commitment transactions. + * + * This HTLC is now safe to either forward or be claimed as a payment by us. The HTLC will + * remain in this state until the forwarded upstream HTLC has been resolved and we resolve this + * HTLC correspondingly, or until we claim it as a payment. If it is part of a multipart + * payment, it will only be claimed together with other required parts. + */ + LDKInboundHTLCStateDetails_Committed, + /** + * We have received the preimage for this HTLC and it is being removed by fulfilling it with + * update_fulfill_htlc. This HTLC is still on both commitment transactions, but we are awaiting + * the appropriate revoke_and_ack's from the remote before this HTLC is removed from the remote + * commitment transaction after update_fulfill_htlc. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill, + /** + * The HTLC is being removed by failing it with update_fail_htlc or update_fail_malformed_htlc. + * This HTLC is still on both commitment transactions, but we are awaiting the appropriate + * revoke_and_ack's from the remote before this HTLC is removed from the remote commitment + * transaction. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail, + /** + * Must be last for serialization purposes + */ + LDKInboundHTLCStateDetails_Sentinel, +} LDKInboundHTLCStateDetails; + /** * An enum representing the available verbosity levels of the logger. */ @@ -659,6 +711,55 @@ typedef enum LDKNetwork { LDKNetwork_Sentinel, } LDKNetwork; +/** + * Exposes the state of pending outbound HTLCs. + * + * At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes + * through the following states in the state machine: + * - Announced for addition by the originating node through the update_add_htlc message. + * - Added to the commitment transaction of the receiving node and originating node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * - Announced for resolution (fulfillment or failure) by the receiving node through either one of + * the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. + * - Removed from the commitment transaction of the originating node and receiving node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * + * This can be used to inspect what next message an HTLC is waiting for to advance its state. + */ +typedef enum LDKOutboundHTLCStateDetails { + /** + * We are awaiting the appropriate revoke_and_ack's from the remote before the HTLC is added + * on the remote's commitment transaction after update_add_htlc. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd, + /** + * The HTLC has been added to the remote's commitment transaction by sending commitment_signed + * and receiving revoke_and_ack in return. + * + * The HTLC will remain in this state until the remote node resolves the HTLC, or until we + * unilaterally close the channel due to a timeout with an uncooperative remote node. + */ + LDKOutboundHTLCStateDetails_Committed, + /** + * The HTLC has been fulfilled successfully by the remote with a preimage in update_fulfill_htlc, + * and we removed the HTLC from our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * for the removal from its commitment transaction. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess, + /** + * The HTLC has been failed by the remote with update_fail_htlc or update_fail_malformed_htlc, + * and we removed the HTLC from our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * for the removal from its commitment transaction. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure, + /** + * Must be last for serialization purposes + */ + LDKOutboundHTLCStateDetails_Sentinel, +} LDKOutboundHTLCStateDetails; + /** * The reason the payment failed. Used in [`Event::PaymentFailed`]. */ @@ -4282,6 +4383,9 @@ typedef struct LDKCResult_NoneIOErrorZ { /** * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] + * + * [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels */ typedef struct MUST_USE_STRUCT LDKChannelDetails { /** @@ -4299,7 +4403,7 @@ typedef struct MUST_USE_STRUCT LDKChannelDetails { } LDKChannelDetails; /** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_ChannelDetailsZ { @@ -9602,33 +9706,6 @@ typedef struct LDKCOption_C2Tuple_u64u16ZZ { }; } LDKCOption_C2Tuple_u64u16ZZ; -/** - * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not - */ -typedef enum LDKCOption_ChannelShutdownStateZ_Tag { - /** - * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState - */ - LDKCOption_ChannelShutdownStateZ_Some, - /** - * When we're in this state, this COption_ChannelShutdownStateZ contains nothing - */ - LDKCOption_ChannelShutdownStateZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_ChannelShutdownStateZ_Sentinel, -} LDKCOption_ChannelShutdownStateZ_Tag; - -typedef struct LDKCOption_ChannelShutdownStateZ { - LDKCOption_ChannelShutdownStateZ_Tag tag; - union { - struct { - enum LDKChannelShutdownState some; - }; - }; -} LDKCOption_ChannelShutdownStateZ; - /** * The contents of CResult_ChannelIdAPIErrorZ */ @@ -10517,146 +10594,6 @@ typedef struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ { -/** - * Information needed for constructing an invoice route hint for this channel. - */ -typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeCounterpartyForwardingInfo *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKCounterpartyForwardingInfo; - -/** - * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ - */ -typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCounterpartyForwardingInfo *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr; - -/** - * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ { - /** - * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; - /** - * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; - - - -/** - * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] - * to better separate parameters. - */ -typedef struct MUST_USE_STRUCT LDKChannelCounterparty { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelCounterparty *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKChannelCounterparty; - -/** - * The contents of CResult_ChannelCounterpartyDecodeErrorZ - */ -typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelCounterparty *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_ChannelCounterpartyDecodeErrorZPtr; - -/** - * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ { - /** - * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents; - /** - * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ChannelCounterpartyDecodeErrorZ; - -/** - * The contents of CResult_ChannelDetailsDecodeErrorZ - */ -typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelDetails *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_ChannelDetailsDecodeErrorZPtr; - -/** - * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelDetailsDecodeErrorZ { - /** - * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; - /** - * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ChannelDetailsDecodeErrorZ; - - - /** * Route hints used in constructing invoices for [phantom node payents]. * @@ -11053,39 +10990,6 @@ typedef struct LDKCResult_BlindedFailureDecodeErrorZ { bool result_ok; } LDKCResult_BlindedFailureDecodeErrorZ; -/** - * The contents of CResult_ChannelShutdownStateDecodeErrorZ - */ -typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - enum LDKChannelShutdownState *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_ChannelShutdownStateDecodeErrorZPtr; - -/** - * A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::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`. - */ -typedef struct LDKCResult_ChannelShutdownStateDecodeErrorZ { - /** - * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents; - /** - * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ChannelShutdownStateDecodeErrorZ; - /** @@ -16497,2503 +16401,2961 @@ typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ { bool result_ok; } LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; - - -/** - * A simple future which can complete once, and calls some callback(s) when it does so. - */ -typedef struct MUST_USE_STRUCT LDKFuture { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeFuture *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKFuture; - -/** - * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_FutureZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKFuture *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_FutureZ; - -/** - * The contents of CResult_OffersMessageDecodeErrorZ - */ -typedef union LDKCResult_OffersMessageDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKOffersMessage *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_OffersMessageDecodeErrorZPtr; - -/** - * 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`. - */ -typedef struct LDKCResult_OffersMessageDecodeErrorZ { - /** - * The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_OffersMessageDecodeErrorZPtr contents; - /** - * Whether this CResult_OffersMessageDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_OffersMessageDecodeErrorZ; - /** - * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not + * An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not */ -typedef enum LDKCOption_HTLCClaimZ_Tag { +typedef enum LDKCOption_InboundHTLCStateDetailsZ_Tag { /** - * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim + * When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails */ - LDKCOption_HTLCClaimZ_Some, + LDKCOption_InboundHTLCStateDetailsZ_Some, /** - * When we're in this state, this COption_HTLCClaimZ contains nothing + * When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing */ - LDKCOption_HTLCClaimZ_None, + LDKCOption_InboundHTLCStateDetailsZ_None, /** * Must be last for serialization purposes */ - LDKCOption_HTLCClaimZ_Sentinel, -} LDKCOption_HTLCClaimZ_Tag; + LDKCOption_InboundHTLCStateDetailsZ_Sentinel, +} LDKCOption_InboundHTLCStateDetailsZ_Tag; -typedef struct LDKCOption_HTLCClaimZ { - LDKCOption_HTLCClaimZ_Tag tag; +typedef struct LDKCOption_InboundHTLCStateDetailsZ { + LDKCOption_InboundHTLCStateDetailsZ_Tag tag; union { struct { - enum LDKHTLCClaim some; + enum LDKInboundHTLCStateDetails some; }; }; -} LDKCOption_HTLCClaimZ; - - - -/** - * Implements the per-commitment secret storage scheme from - * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). - * - * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes - * or so. - */ -typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeCounterpartyCommitmentSecrets *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKCounterpartyCommitmentSecrets; +} LDKCOption_InboundHTLCStateDetailsZ; /** - * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ + * The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ */ -typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +typedef union LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCounterpartyCommitmentSecrets *result; + struct LDKCOption_InboundHTLCStateDetailsZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr; +} LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ { +typedef struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { /** - * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either + * The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; + union LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr contents; /** - * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + * Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; +} LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; /** - * The set of public keys which are used in the creation of one commitment transaction. - * These are derived from the channel base keys and per-commitment data. - * - * A broadcaster key is provided from potential broadcaster of the computed transaction. - * A countersignatory key is coming from a protocol participant unable to broadcast the - * transaction. - * - * These keys are assumed to be good, either because the code derived them from - * channel basepoints via the new function, or they were obtained via - * CommitmentTransaction.trust().keys() because we trusted the source of the - * pre-calculated keys. + * Exposes details around pending inbound HTLCs. */ -typedef struct MUST_USE_STRUCT LDKTxCreationKeys { +typedef struct MUST_USE_STRUCT LDKInboundHTLCDetails { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeTxCreationKeys *inner; + LDKnativeInboundHTLCDetails *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKTxCreationKeys; +} LDKInboundHTLCDetails; /** - * The contents of CResult_TxCreationKeysDecodeErrorZ + * The contents of CResult_InboundHTLCDetailsDecodeErrorZ */ -typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { +typedef union LDKCResult_InboundHTLCDetailsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTxCreationKeys *result; + struct LDKInboundHTLCDetails *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_TxCreationKeysDecodeErrorZPtr; +} LDKCResult_InboundHTLCDetailsDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_TxCreationKeysDecodeErrorZ { +typedef struct LDKCResult_InboundHTLCDetailsDecodeErrorZ { /** - * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either + * The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; + union LDKCResult_InboundHTLCDetailsDecodeErrorZPtr contents; /** - * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. + * Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TxCreationKeysDecodeErrorZ; +} LDKCResult_InboundHTLCDetailsDecodeErrorZ; /** - * The contents of CResult_ChannelPublicKeysDecodeErrorZ + * An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not */ -typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelPublicKeys *result; +typedef enum LDKCOption_OutboundHTLCStateDetailsZ_Tag { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails */ - struct LDKDecodeError *err; -} LDKCResult_ChannelPublicKeysDecodeErrorZPtr; - -/** - * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { + LDKCOption_OutboundHTLCStateDetailsZ_Some, /** - * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing */ - union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; + LDKCOption_OutboundHTLCStateDetailsZ_None, /** - * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_ChannelPublicKeysDecodeErrorZ; + LDKCOption_OutboundHTLCStateDetailsZ_Sentinel, +} LDKCOption_OutboundHTLCStateDetailsZ_Tag; + +typedef struct LDKCOption_OutboundHTLCStateDetailsZ { + LDKCOption_OutboundHTLCStateDetailsZ_Tag tag; + union { + struct { + enum LDKOutboundHTLCStateDetails some; + }; + }; +} LDKCOption_OutboundHTLCStateDetailsZ; /** - * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ + * The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ */ -typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr { +typedef union LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKHTLCOutputInCommitment *result; + struct LDKCOption_OutboundHTLCStateDetailsZ *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_HTLCOutputInCommitmentDecodeErrorZPtr; +} LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ { +typedef struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { /** - * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either + * The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents; + union LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr contents; /** - * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. + * Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_HTLCOutputInCommitmentDecodeErrorZ; +} LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ; /** - * Late-bound per-channel counterparty data used to build transactions. + * Exposes details around pending outbound HTLCs. */ -typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKOutboundHTLCDetails { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeCounterpartyChannelTransactionParameters *inner; + LDKnativeOutboundHTLCDetails *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; -} LDKCounterpartyChannelTransactionParameters; +} LDKOutboundHTLCDetails; /** - * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ + * The contents of CResult_OutboundHTLCDetailsDecodeErrorZ */ -typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +typedef union LDKCResult_OutboundHTLCDetailsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCounterpartyChannelTransactionParameters *result; + struct LDKOutboundHTLCDetails *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_CounterpartyChannelTransactionParametersDecodeErrorZPtr; +} LDKCResult_OutboundHTLCDetailsDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +typedef struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ { /** - * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either + * The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents; + union LDKCResult_OutboundHTLCDetailsDecodeErrorZPtr contents; /** - * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. + * Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ; +} LDKCResult_OutboundHTLCDetailsDecodeErrorZ; + -/** - * The contents of CResult_ChannelTransactionParametersDecodeErrorZ - */ -typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelTransactionParameters *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_ChannelTransactionParametersDecodeErrorZPtr; /** - * 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`. + * Information needed for constructing an invoice route hint for this channel. */ -typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { /** - * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents; + LDKnativeCounterpartyForwardingInfo *inner; /** - * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - bool result_ok; -} LDKCResult_ChannelTransactionParametersDecodeErrorZ; + bool is_owned; +} LDKCounterpartyForwardingInfo; /** - * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ + * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ */ -typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr { +typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKHolderCommitmentTransaction *result; + struct LDKCounterpartyForwardingInfo *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr; +} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ { +typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ { /** - * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either + * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents; + union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; /** - * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. + * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_HolderCommitmentTransactionDecodeErrorZ; +} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; /** - * A pre-built Bitcoin commitment transaction and its txid. + * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] + * to better separate parameters. */ -typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKChannelCounterparty { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBuiltCommitmentTransaction *inner; + LDKnativeChannelCounterparty *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKBuiltCommitmentTransaction; +} LDKChannelCounterparty; /** - * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ + * The contents of CResult_ChannelCounterpartyDecodeErrorZ */ -typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr { +typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBuiltCommitmentTransaction *result; + struct LDKChannelCounterparty *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr; +} LDKCResult_ChannelCounterpartyDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ { +typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ { /** - * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents; + union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents; /** - * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. + * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BuiltCommitmentTransactionDecodeErrorZ; +} LDKCResult_ChannelCounterpartyDecodeErrorZ; +/** + * An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not + */ +typedef enum LDKCOption_ChannelShutdownStateZ_Tag { + /** + * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState + */ + LDKCOption_ChannelShutdownStateZ_Some, + /** + * When we're in this state, this COption_ChannelShutdownStateZ contains nothing + */ + LDKCOption_ChannelShutdownStateZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_ChannelShutdownStateZ_Sentinel, +} LDKCOption_ChannelShutdownStateZ_Tag; +typedef struct LDKCOption_ChannelShutdownStateZ { + LDKCOption_ChannelShutdownStateZ_Tag tag; + union { + struct { + enum LDKChannelShutdownState some; + }; + }; +} LDKCOption_ChannelShutdownStateZ; /** - * A wrapper on ClosingTransaction indicating that the built bitcoin - * transaction is trusted. - * - * See trust() and verify() functions on CommitmentTransaction. - * - * This structure implements Deref. + * A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction { +typedef struct LDKCVec_InboundHTLCDetailsZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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(). */ - LDKnativeTrustedClosingTransaction *inner; + struct LDKInboundHTLCDetails *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; -} LDKTrustedClosingTransaction; + uintptr_t datalen; +} LDKCVec_InboundHTLCDetailsZ; /** - * The contents of CResult_TrustedClosingTransactionNoneZ + * A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_TrustedClosingTransactionNoneZPtr { +typedef struct LDKCVec_OutboundHTLCDetailsZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKOutboundHTLCDetails *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_OutboundHTLCDetailsZ; + +/** + * The contents of CResult_ChannelDetailsDecodeErrorZ + */ +typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTrustedClosingTransaction *result; + struct LDKChannelDetails *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_TrustedClosingTransactionNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelDetailsDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_TrustedClosingTransactionNoneZ { +typedef struct LDKCResult_ChannelDetailsDecodeErrorZ { /** - * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either + * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TrustedClosingTransactionNoneZPtr contents; + union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; /** - * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. + * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TrustedClosingTransactionNoneZ; +} LDKCResult_ChannelDetailsDecodeErrorZ; /** - * The contents of CResult_CommitmentTransactionDecodeErrorZ + * The contents of CResult_ChannelShutdownStateDecodeErrorZ */ -typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr { +typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCommitmentTransaction *result; + enum LDKChannelShutdownState *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_CommitmentTransactionDecodeErrorZPtr; +} LDKCResult_ChannelShutdownStateDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ { +typedef struct LDKCResult_ChannelShutdownStateDecodeErrorZ { /** - * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents; + union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents; /** - * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. + * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CommitmentTransactionDecodeErrorZ; +} LDKCResult_ChannelShutdownStateDecodeErrorZ; /** - * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin - * transaction and the transaction creation keys) are trusted. - * - * See trust() and verify() functions on CommitmentTransaction. - * - * This structure implements Deref. + * A simple future which can complete once, and calls some callback(s) when it does so. */ -typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKFuture { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeTrustedCommitmentTransaction *inner; + LDKnativeFuture *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKTrustedCommitmentTransaction; - -/** - * The contents of CResult_TrustedCommitmentTransactionNoneZ - */ -typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTrustedCommitmentTransaction *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_TrustedCommitmentTransactionNoneZPtr; +} LDKFuture; /** - * 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`. + * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ { +typedef struct LDKCVec_FutureZ { /** - * The contents of this CResult_TrustedCommitmentTransactionNoneZ, 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_TrustedCommitmentTransactionNoneZPtr contents; + struct LDKFuture *data; /** - * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_TrustedCommitmentTransactionNoneZ; + uintptr_t datalen; +} LDKCVec_FutureZ; /** - * The contents of CResult_CVec_ECDSASignatureZNoneZ + * The contents of CResult_OffersMessageDecodeErrorZ */ -typedef union LDKCResult_CVec_ECDSASignatureZNoneZPtr { +typedef union LDKCResult_OffersMessageDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_ECDSASignatureZ *result; + struct LDKOffersMessage *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_CVec_ECDSASignatureZNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_OffersMessageDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_CVec_ECDSASignatureZNoneZ { +typedef struct LDKCResult_OffersMessageDecodeErrorZ { /** - * The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either + * The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_ECDSASignatureZNoneZPtr contents; + union LDKCResult_OffersMessageDecodeErrorZPtr contents; /** - * Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. + * Whether this CResult_OffersMessageDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_ECDSASignatureZNoneZ; +} LDKCResult_OffersMessageDecodeErrorZ; /** - * An enum which can either contain a usize or not + * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not */ -typedef enum LDKCOption_usizeZ_Tag { +typedef enum LDKCOption_HTLCClaimZ_Tag { /** - * When we're in this state, this COption_usizeZ contains a usize + * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim */ - LDKCOption_usizeZ_Some, + LDKCOption_HTLCClaimZ_Some, /** - * When we're in this state, this COption_usizeZ contains nothing + * When we're in this state, this COption_HTLCClaimZ contains nothing */ - LDKCOption_usizeZ_None, + LDKCOption_HTLCClaimZ_None, /** * Must be last for serialization purposes */ - LDKCOption_usizeZ_Sentinel, -} LDKCOption_usizeZ_Tag; + LDKCOption_HTLCClaimZ_Sentinel, +} LDKCOption_HTLCClaimZ_Tag; -typedef struct LDKCOption_usizeZ { - LDKCOption_usizeZ_Tag tag; +typedef struct LDKCOption_HTLCClaimZ { + LDKCOption_HTLCClaimZ_Tag tag; union { struct { - uintptr_t some; + enum LDKHTLCClaim some; }; }; -} LDKCOption_usizeZ; +} LDKCOption_HTLCClaimZ; + + /** - * The contents of CResult_ShutdownScriptDecodeErrorZ + * Implements the per-commitment secret storage scheme from + * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * + * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes + * or so. */ -typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCounterpartyCommitmentSecrets *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKCounterpartyCommitmentSecrets; + +/** + * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ + */ +typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKShutdownScript *result; + struct LDKCounterpartyCommitmentSecrets *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_ShutdownScriptDecodeErrorZPtr; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr; /** - * 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_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ShutdownScriptDecodeErrorZ { +typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ { /** - * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either + * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ShutdownScriptDecodeErrorZPtr contents; + union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; /** - * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. + * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ShutdownScriptDecodeErrorZ; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; /** - * An error occurring when converting from [`ScriptBuf`] to [`ShutdownScript`]. + * The set of public keys which are used in the creation of one commitment transaction. + * These are derived from the channel base keys and per-commitment data. + * + * A broadcaster key is provided from potential broadcaster of the computed transaction. + * A countersignatory key is coming from a protocol participant unable to broadcast the + * transaction. + * + * These keys are assumed to be good, either because the code derived them from + * channel basepoints via the new function, or they were obtained via + * CommitmentTransaction.trust().keys() because we trusted the source of the + * pre-calculated keys. */ -typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript { +typedef struct MUST_USE_STRUCT LDKTxCreationKeys { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvalidShutdownScript *inner; + LDKnativeTxCreationKeys *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvalidShutdownScript; +} LDKTxCreationKeys; /** - * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ + * The contents of CResult_TxCreationKeysDecodeErrorZ */ -typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr { +typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKShutdownScript *result; + struct LDKTxCreationKeys *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKInvalidShutdownScript *err; -} LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr; + struct LDKDecodeError *err; +} LDKCResult_TxCreationKeysDecodeErrorZPtr; /** - * 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_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { +typedef struct LDKCResult_TxCreationKeysDecodeErrorZ { /** - * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either + * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents; + union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; /** - * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. + * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ShutdownScriptInvalidShutdownScriptZ; +} LDKCResult_TxCreationKeysDecodeErrorZ; /** - * Some information provided on receipt of payment depends on whether the payment received is a - * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. + * The contents of CResult_ChannelPublicKeysDecodeErrorZ */ -typedef enum LDKPaymentPurpose_Tag { - /** - * A payment for a BOLT 11 invoice. - */ - LDKPaymentPurpose_Bolt11InvoicePayment, - /** - * A payment for a BOLT 12 [`Offer`]. - * - * [`Offer`]: crate::offers::offer::Offer - */ - LDKPaymentPurpose_Bolt12OfferPayment, - /** - * A payment for a BOLT 12 [`Refund`]. - * - * [`Refund`]: crate::offers::refund::Refund - */ - LDKPaymentPurpose_Bolt12RefundPayment, - /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. - */ - LDKPaymentPurpose_SpontaneousPayment, - /** - * Must be last for serialization purposes - */ - LDKPaymentPurpose_Sentinel, -} LDKPaymentPurpose_Tag; - -typedef struct LDKPaymentPurpose_LDKBolt11InvoicePayment_Body { - /** - * The preimage to the payment_hash, if the payment hash (and secret) were fetched via - * [`ChannelManager::create_inbound_payment`]. When handling [`Event::PaymentClaimable`], - * this can be passed directly to [`ChannelManager::claim_funds`] to claim the payment. No - * action is needed when seen in [`Event::PaymentClaimed`]. - * - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - */ - struct LDKCOption_ThirtyTwoBytesZ payment_preimage; - /** - * The \"payment secret\". This authenticates the sender to the recipient, preventing a - * number of deanonymization attacks during the routing process. - * It is provided here for your reference, however its accuracy is enforced directly by - * [`ChannelManager`] using the values you previously provided to - * [`ChannelManager::create_inbound_payment`] or - * [`ChannelManager::create_inbound_payment_for_hash`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash - */ - struct LDKThirtyTwoBytes payment_secret; -} LDKPaymentPurpose_LDKBolt11InvoicePayment_Body; - -typedef struct LDKPaymentPurpose_LDKBolt12OfferPayment_Body { - /** - * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be - * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed - * when seen in [`Event::PaymentClaimed`]. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - */ - struct LDKCOption_ThirtyTwoBytesZ payment_preimage; +typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { /** - * The secret used to authenticate the sender to the recipient, preventing a number of - * de-anonymization attacks while routing a payment. - * - * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes payment_secret; + struct LDKChannelPublicKeys *result; /** - * The context of the payment such as information about the corresponding [`Offer`] and - * [`InvoiceRequest`]. - * - * [`Offer`]: crate::offers::offer::Offer - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKBolt12OfferContext payment_context; -} LDKPaymentPurpose_LDKBolt12OfferPayment_Body; + struct LDKDecodeError *err; +} LDKCResult_ChannelPublicKeysDecodeErrorZPtr; -typedef struct LDKPaymentPurpose_LDKBolt12RefundPayment_Body { - /** - * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be - * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed - * when seen in [`Event::PaymentClaimed`]. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - */ - struct LDKCOption_ThirtyTwoBytesZ payment_preimage; +/** + * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { /** - * The secret used to authenticate the sender to the recipient, preventing a number of - * de-anonymization attacks while routing a payment. - * - * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. + * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes payment_secret; + union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; /** - * The context of the payment such as information about the corresponding [`Refund`]. - * - * [`Refund`]: crate::offers::refund::Refund + * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. */ - struct LDKBolt12RefundContext payment_context; -} LDKPaymentPurpose_LDKBolt12RefundPayment_Body; - -typedef struct MUST_USE_STRUCT LDKPaymentPurpose { - LDKPaymentPurpose_Tag tag; - union { - LDKPaymentPurpose_LDKBolt11InvoicePayment_Body bolt11_invoice_payment; - LDKPaymentPurpose_LDKBolt12OfferPayment_Body bolt12_offer_payment; - LDKPaymentPurpose_LDKBolt12RefundPayment_Body bolt12_refund_payment; - struct { - struct LDKThirtyTwoBytes spontaneous_payment; - }; - }; -} LDKPaymentPurpose; + bool result_ok; +} LDKCResult_ChannelPublicKeysDecodeErrorZ; /** - * The contents of CResult_PaymentPurposeDecodeErrorZ + * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ */ -typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr { +typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPaymentPurpose *result; + struct LDKHTLCOutputInCommitment *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_PaymentPurposeDecodeErrorZPtr; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { +typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ { /** - * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either + * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentPurposeDecodeErrorZPtr contents; + union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. + * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentPurposeDecodeErrorZ; +} LDKCResult_HTLCOutputInCommitmentDecodeErrorZ; /** - * Information about an HTLC that is part of a payment that can be claimed. + * Late-bound per-channel counterparty data used to build transactions. */ -typedef struct MUST_USE_STRUCT LDKClaimedHTLC { +typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeClaimedHTLC *inner; + LDKnativeCounterpartyChannelTransactionParameters *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; -} LDKClaimedHTLC; +} LDKCounterpartyChannelTransactionParameters; /** - * The contents of CResult_ClaimedHTLCDecodeErrorZ + * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ */ -typedef union LDKCResult_ClaimedHTLCDecodeErrorZPtr { +typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClaimedHTLC *result; + struct LDKCounterpartyChannelTransactionParameters *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_ClaimedHTLCDecodeErrorZPtr; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_ClaimedHTLCDecodeErrorZ { +typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ { /** - * The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either + * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ClaimedHTLCDecodeErrorZPtr contents; + union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents; /** - * Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. + * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ClaimedHTLCDecodeErrorZ; +} LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ; /** - * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may - * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. - * - * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * The contents of CResult_ChannelTransactionParametersDecodeErrorZ */ -typedef enum LDKPathFailure_Tag { +typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr { /** - * We failed to initially send the payment and no HTLC was committed to. Contains the relevant - * error. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKPathFailure_InitialSend, + struct LDKChannelTransactionParameters *result; /** - * A hop on the path failed to forward our payment. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKPathFailure_OnPath, + struct LDKDecodeError *err; +} LDKCResult_ChannelTransactionParametersDecodeErrorZPtr; + +/** + * 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`. + */ +typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ { /** - * Must be last for serialization purposes + * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKPathFailure_Sentinel, -} LDKPathFailure_Tag; - -typedef struct LDKPathFailure_LDKInitialSend_Body { + union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents; /** - * The error surfaced from initial send. + * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. */ - struct LDKAPIError err; -} LDKPathFailure_LDKInitialSend_Body; - -typedef struct LDKPathFailure_LDKOnPath_Body { - /** - * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing - * decisions can take into account the update. - * - * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph - */ - struct LDKCOption_NetworkUpdateZ network_update; -} LDKPathFailure_LDKOnPath_Body; - -typedef struct MUST_USE_STRUCT LDKPathFailure { - LDKPathFailure_Tag tag; - union { - LDKPathFailure_LDKInitialSend_Body initial_send; - LDKPathFailure_LDKOnPath_Body on_path; - }; -} LDKPathFailure; - -/** - * An enum which can either contain a crate::lightning::events::PathFailure or not - */ -typedef enum LDKCOption_PathFailureZ_Tag { - /** - * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure - */ - LDKCOption_PathFailureZ_Some, - /** - * When we're in this state, this COption_PathFailureZ contains nothing - */ - LDKCOption_PathFailureZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_PathFailureZ_Sentinel, -} LDKCOption_PathFailureZ_Tag; - -typedef struct LDKCOption_PathFailureZ { - LDKCOption_PathFailureZ_Tag tag; - union { - struct { - struct LDKPathFailure some; - }; - }; -} LDKCOption_PathFailureZ; + bool result_ok; +} LDKCResult_ChannelTransactionParametersDecodeErrorZ; /** - * The contents of CResult_COption_PathFailureZDecodeErrorZ + * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ */ -typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr { +typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_PathFailureZ *result; + struct LDKHolderCommitmentTransaction *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_COption_PathFailureZDecodeErrorZPtr; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ { +typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ { /** - * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either + * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents; + union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents; /** - * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. + * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_PathFailureZDecodeErrorZ; +} LDKCResult_HolderCommitmentTransactionDecodeErrorZ; + + /** - * An enum which can either contain a crate::lightning::events::ClosureReason or not + * A pre-built Bitcoin commitment transaction and its txid. */ -typedef enum LDKCOption_ClosureReasonZ_Tag { - /** - * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason - */ - LDKCOption_ClosureReasonZ_Some, +typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction { /** - * When we're in this state, this COption_ClosureReasonZ 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_ClosureReasonZ_None, + LDKnativeBuiltCommitmentTransaction *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_ClosureReasonZ_Sentinel, -} LDKCOption_ClosureReasonZ_Tag; - -typedef struct LDKCOption_ClosureReasonZ { - LDKCOption_ClosureReasonZ_Tag tag; - union { - struct { - struct LDKClosureReason some; - }; - }; -} LDKCOption_ClosureReasonZ; + bool is_owned; +} LDKBuiltCommitmentTransaction; /** - * The contents of CResult_COption_ClosureReasonZDecodeErrorZ + * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ */ -typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr { +typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_ClosureReasonZ *result; + struct LDKBuiltCommitmentTransaction *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { +typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ { /** - * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; + union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents; /** - * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_ClosureReasonZDecodeErrorZ; +} LDKCResult_BuiltCommitmentTransactionDecodeErrorZ; + + /** - * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + * A wrapper on ClosingTransaction indicating that the built bitcoin + * transaction is trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. */ -typedef enum LDKHTLCDestination_Tag { +typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction { /** - * We tried forwarding to a channel but failed to do so. An example of such an instance is when - * there is insufficient capacity in our outbound channel. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKHTLCDestination_NextHopChannel, + LDKnativeTrustedClosingTransaction *inner; /** - * Scenario where we are unsure of the next node to forward the HTLC to. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKHTLCDestination_UnknownNextHop, + bool is_owned; +} LDKTrustedClosingTransaction; + +/** + * The contents of CResult_TrustedClosingTransactionNoneZ + */ +typedef union LDKCResult_TrustedClosingTransactionNoneZPtr { /** - * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate - * intercept HTLC. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKHTLCDestination_InvalidForward, + struct LDKTrustedClosingTransaction *result; /** - * We couldn't decode the incoming onion to obtain the forwarding details. + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKHTLCDestination_InvalidOnion, + void *err; +} LDKCResult_TrustedClosingTransactionNoneZPtr; + +/** + * 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`. + */ +typedef struct LDKCResult_TrustedClosingTransactionNoneZ { /** - * Failure scenario where an HTLC may have been forwarded to be intended for us, - * but is invalid for some reason, so we reject it. - * - * Some of the reasons may include: - * * HTLC Timeouts - * * Excess HTLCs for a payment that we have already fully received, over-paying for the - * payment, - * * The counterparty node modified the HTLC in transit, - * * A probing attack where an intermediary node is trying to detect if we are the ultimate - * recipient for a payment. + * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKHTLCDestination_FailedPayment, + union LDKCResult_TrustedClosingTransactionNoneZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. */ - LDKHTLCDestination_Sentinel, -} LDKHTLCDestination_Tag; + bool result_ok; +} LDKCResult_TrustedClosingTransactionNoneZ; -typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { +/** + * The contents of CResult_CommitmentTransactionDecodeErrorZ + */ +typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr { /** - * The `node_id` of the next node. For backwards compatibility, this field is - * marked as optional, versions prior to 0.0.110 may not always be able to provide - * counterparty node information. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPublicKey node_id; + struct LDKCommitmentTransaction *result; /** - * The outgoing `channel_id` between us and the next node. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKChannelId channel_id; -} LDKHTLCDestination_LDKNextHopChannel_Body; + struct LDKDecodeError *err; +} LDKCResult_CommitmentTransactionDecodeErrorZPtr; -typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { +/** + * 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`. + */ +typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ { /** - * Short channel id we are requesting to forward an HTLC to. + * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKUnknownNextHop_Body; - -typedef struct LDKHTLCDestination_LDKInvalidForward_Body { + union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents; /** - * Short channel id we are requesting to forward an HTLC to. + * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. */ - uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKInvalidForward_Body; + bool result_ok; +} LDKCResult_CommitmentTransactionDecodeErrorZ; -typedef struct LDKHTLCDestination_LDKFailedPayment_Body { - /** - * The payment hash of the payment we attempted to process. - */ - struct LDKThirtyTwoBytes payment_hash; -} LDKHTLCDestination_LDKFailedPayment_Body; -typedef struct MUST_USE_STRUCT LDKHTLCDestination { - LDKHTLCDestination_Tag tag; - union { - LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; - LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; - LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; - LDKHTLCDestination_LDKFailedPayment_Body failed_payment; - }; -} LDKHTLCDestination; /** - * An enum which can either contain a crate::lightning::events::HTLCDestination or not + * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin + * transaction and the transaction creation keys) are trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. */ -typedef enum LDKCOption_HTLCDestinationZ_Tag { - /** - * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination - */ - LDKCOption_HTLCDestinationZ_Some, +typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction { /** - * When we're in this state, this COption_HTLCDestinationZ 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_HTLCDestinationZ_None, + LDKnativeTrustedCommitmentTransaction *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_HTLCDestinationZ_Sentinel, -} LDKCOption_HTLCDestinationZ_Tag; - -typedef struct LDKCOption_HTLCDestinationZ { - LDKCOption_HTLCDestinationZ_Tag tag; - union { - struct { - struct LDKHTLCDestination some; - }; - }; -} LDKCOption_HTLCDestinationZ; + bool is_owned; +} LDKTrustedCommitmentTransaction; /** - * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + * The contents of CResult_TrustedCommitmentTransactionNoneZ */ -typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { +typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_HTLCDestinationZ *result; + struct LDKTrustedCommitmentTransaction *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr; + void *err; +} LDKCResult_TrustedCommitmentTransactionNoneZPtr; /** - * 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_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`. */ -typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { +typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ { /** - * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either + * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; + union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents; /** - * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. */ bool result_ok; -} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; +} LDKCResult_TrustedCommitmentTransactionNoneZ; /** - * The contents of CResult_PaymentFailureReasonDecodeErrorZ + * The contents of CResult_CVec_ECDSASignatureZNoneZ */ -typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr { +typedef union LDKCResult_CVec_ECDSASignatureZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKPaymentFailureReason *result; + struct LDKCVec_ECDSASignatureZ *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_PaymentFailureReasonDecodeErrorZPtr; + void *err; +} LDKCResult_CVec_ECDSASignatureZNoneZPtr; /** - * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure. + * 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`. */ -typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ { +typedef struct LDKCResult_CVec_ECDSASignatureZNoneZ { /** - * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either + * The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents; + union LDKCResult_CVec_ECDSASignatureZNoneZPtr contents; /** - * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state. + * Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentFailureReasonDecodeErrorZ; +} LDKCResult_CVec_ECDSASignatureZNoneZ; /** - * An enum which can either contain a crate::c_types::U128 or not + * An enum which can either contain a usize or not */ -typedef enum LDKCOption_U128Z_Tag { +typedef enum LDKCOption_usizeZ_Tag { /** - * When we're in this state, this COption_U128Z contains a crate::c_types::U128 + * When we're in this state, this COption_usizeZ contains a usize */ - LDKCOption_U128Z_Some, + LDKCOption_usizeZ_Some, /** - * When we're in this state, this COption_U128Z contains nothing + * When we're in this state, this COption_usizeZ contains nothing */ - LDKCOption_U128Z_None, + LDKCOption_usizeZ_None, /** * Must be last for serialization purposes */ - LDKCOption_U128Z_Sentinel, -} LDKCOption_U128Z_Tag; + LDKCOption_usizeZ_Sentinel, +} LDKCOption_usizeZ_Tag; -typedef struct LDKCOption_U128Z { - LDKCOption_U128Z_Tag tag; +typedef struct LDKCOption_usizeZ { + LDKCOption_usizeZ_Tag tag; union { struct { - struct LDKU128 some; + uintptr_t some; }; }; -} LDKCOption_U128Z; +} LDKCOption_usizeZ; /** - * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_ShutdownScriptDecodeErrorZ */ -typedef struct LDKCVec_ClaimedHTLCZ { +typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClaimedHTLC *data; + struct LDKShutdownScript *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_ClaimedHTLCZ; + struct LDKDecodeError *err; +} LDKCResult_ShutdownScriptDecodeErrorZPtr; /** - * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not + * 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`. */ -typedef enum LDKCOption_PaymentFailureReasonZ_Tag { - /** - * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason - */ - LDKCOption_PaymentFailureReasonZ_Some, +typedef struct LDKCResult_ShutdownScriptDecodeErrorZ { /** - * When we're in this state, this COption_PaymentFailureReasonZ contains nothing + * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_PaymentFailureReasonZ_None, + union LDKCResult_ShutdownScriptDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. */ - LDKCOption_PaymentFailureReasonZ_Sentinel, -} LDKCOption_PaymentFailureReasonZ_Tag; - -typedef struct LDKCOption_PaymentFailureReasonZ { - LDKCOption_PaymentFailureReasonZ_Tag tag; - union { - struct { - enum LDKPaymentFailureReason some; - }; - }; -} LDKCOption_PaymentFailureReasonZ; + bool result_ok; +} LDKCResult_ShutdownScriptDecodeErrorZ; /** - * A descriptor used to sign for a commitment transaction's anchor output. + * An error occurring when converting from [`ScriptBuf`] to [`ShutdownScript`]. */ -typedef struct MUST_USE_STRUCT LDKAnchorDescriptor { +typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeAnchorDescriptor *inner; + LDKnativeInvalidShutdownScript *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; -} LDKAnchorDescriptor; +} LDKInvalidShutdownScript; /** - * Represents the different types of transactions, originating from LDK, to be bumped. + * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ */ -typedef enum LDKBumpTransactionEvent_Tag { +typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr { /** - * Indicates that a channel featuring anchor outputs is to be closed by broadcasting the local - * commitment transaction. Since commitment transactions have a static feerate pre-agreed upon, - * they may need additional fees to be attached through a child transaction using the popular - * [Child-Pays-For-Parent](https://bitcoinops.org/en/topics/cpfp) fee bumping technique. This - * child transaction must include the anchor input described within `anchor_descriptor` along - * with additional inputs to meet the target feerate. Failure to meet the target feerate - * decreases the confirmation odds of the transaction package (which includes the commitment - * and child anchor transactions), possibly resulting in a loss of funds. Once the transaction - * is constructed, it must be fully signed for and broadcast by the consumer of the event - * along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be - * broadcast first, as the child anchor transaction depends on it. - * - * The consumer should be able to sign for any of the additional inputs included within the - * child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be - * re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature - * can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be - * provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the - * full witness required to spend. - * - * It is possible to receive more than one instance of this event if a valid child anchor - * transaction is never broadcast or is but not with a sufficient fee to be mined. Care should - * be taken by the consumer of the event to ensure any future iterations of the child anchor - * transaction adhere to the [Replace-By-Fee - * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md) - * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of - * these events is not user-controlled, users may ignore/drop the event if they are no longer - * able to commit external confirmed funds to the child anchor transaction. - * - * The set of `pending_htlcs` on the commitment transaction to be broadcast can be inspected to - * determine whether a significant portion of the channel's funds are allocated to HTLCs, - * enabling users to make their own decisions regarding the importance of the commitment - * transaction's confirmation. Note that this is not required, but simply exists as an option - * for users to override LDK's behavior. On commitments with no HTLCs (indicated by those with - * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to - * be not urgent. - * - * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input - * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKBumpTransactionEvent_ChannelClose, + struct LDKShutdownScript *result; /** - * Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a - * holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the - * zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC - * transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached - * for a timely confirmation within the chain. These additional inputs and/or outputs must be - * appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the - * target feerate decreases the confirmation odds of the transaction, possibly resulting in a - * loss of funds. Once the transaction meets the target feerate, it must be signed for and - * broadcast by the consumer of the event. - * - * The consumer should be able to sign for any of the non-HTLC inputs added to the resulting - * HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived - * through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be - * computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be - * provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required - * to spend. - * - * It is possible to receive more than one instance of this event if a valid HTLC transaction - * is never broadcast or is but not with a sufficient fee to be mined. Care should be taken by - * the consumer of the event to ensure any future iterations of the HTLC transaction adhere to - * the [Replace-By-Fee - * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md) - * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of - * these events is not user-controlled, users may ignore/drop the event if either they are no - * longer able to commit external confirmed funds to the HTLC transaction or the fee committed - * to the HTLC transaction is greater in value than the HTLCs being claimed. - * - * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKBumpTransactionEvent_HTLCResolution, + struct LDKInvalidShutdownScript *err; +} LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr; + +/** + * 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`. + */ +typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { /** - * Must be last for serialization purposes + * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKBumpTransactionEvent_Sentinel, -} LDKBumpTransactionEvent_Tag; - -typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body { + union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents; /** - * The `channel_id` of the channel which has been closed. + * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. */ - struct LDKChannelId channel_id; + bool result_ok; +} LDKCResult_ShutdownScriptInvalidShutdownScriptZ; + +/** + * Some information provided on receipt of payment depends on whether the payment received is a + * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. + */ +typedef enum LDKPaymentPurpose_Tag { /** - * Counterparty in the closed channel. + * A payment for a BOLT 11 invoice. */ - struct LDKPublicKey counterparty_node_id; + LDKPaymentPurpose_Bolt11InvoicePayment, /** - * The unique identifier for the claim of the anchor output in the commitment transaction. + * A payment for a BOLT 12 [`Offer`]. * - * The identifier must map to the set of external UTXOs assigned to the claim, such that - * they can be reused when a new claim with the same identifier needs to be made, resulting - * in a fee-bumping attempt. + * [`Offer`]: crate::offers::offer::Offer */ - struct LDKThirtyTwoBytes claim_id; + LDKPaymentPurpose_Bolt12OfferPayment, /** - * The target feerate that the transaction package, which consists of the commitment - * transaction and the to-be-crafted child anchor transaction, must meet. + * A payment for a BOLT 12 [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund */ - uint32_t package_target_feerate_sat_per_1000_weight; + LDKPaymentPurpose_Bolt12RefundPayment, /** - * The channel's commitment transaction to bump the fee of. This transaction should be - * broadcast along with the anchor transaction constructed as a result of consuming this - * event. + * Because this is a spontaneous payment, the payer generated their own preimage rather than us + * (the payee) providing a preimage. */ - struct LDKTransaction commitment_tx; + LDKPaymentPurpose_SpontaneousPayment, /** - * The absolute fee in satoshis of the commitment transaction. This can be used along the - * with weight of the commitment transaction to determine its feerate. + * Must be last for serialization purposes */ - uint64_t commitment_tx_fee_satoshis; + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; + +typedef struct LDKPaymentPurpose_LDKBolt11InvoicePayment_Body { /** - * The descriptor to sign the anchor input of the anchor transaction constructed as a - * result of consuming this event. + * The preimage to the payment_hash, if the payment hash (and secret) were fetched via + * [`ChannelManager::create_inbound_payment`]. When handling [`Event::PaymentClaimable`], + * this can be passed directly to [`ChannelManager::claim_funds`] to claim the payment. No + * action is needed when seen in [`Event::PaymentClaimed`]. + * + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - struct LDKAnchorDescriptor anchor_descriptor; + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; /** - * The set of pending HTLCs on the commitment transaction that need to be resolved once the - * commitment transaction confirms. + * The \"payment secret\". This authenticates the sender to the recipient, preventing a + * number of deanonymization attacks during the routing process. + * It is provided here for your reference, however its accuracy is enforced directly by + * [`ChannelManager`] using the values you previously provided to + * [`ChannelManager::create_inbound_payment`] or + * [`ChannelManager::create_inbound_payment_for_hash`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash */ - struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs; -} LDKBumpTransactionEvent_LDKChannelClose_Body; + struct LDKThirtyTwoBytes payment_secret; +} LDKPaymentPurpose_LDKBolt11InvoicePayment_Body; -typedef struct LDKBumpTransactionEvent_LDKHTLCResolution_Body { +typedef struct LDKPaymentPurpose_LDKBolt12OfferPayment_Body { /** - * The `channel_id` of the channel which has been closed. + * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be + * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed + * when seen in [`Event::PaymentClaimed`]. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - struct LDKChannelId channel_id; + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; /** - * Counterparty in the closed channel. + * The secret used to authenticate the sender to the recipient, preventing a number of + * de-anonymization attacks while routing a payment. + * + * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. */ - struct LDKPublicKey counterparty_node_id; + struct LDKThirtyTwoBytes payment_secret; /** - * The unique identifier for the claim of the HTLCs in the confirmed commitment - * transaction. + * The context of the payment such as information about the corresponding [`Offer`] and + * [`InvoiceRequest`]. * - * The identifier must map to the set of external UTXOs assigned to the claim, such that - * they can be reused when a new claim with the same identifier needs to be made, resulting - * in a fee-bumping attempt. + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ - struct LDKThirtyTwoBytes claim_id; + struct LDKBolt12OfferContext payment_context; +} LDKPaymentPurpose_LDKBolt12OfferPayment_Body; + +typedef struct LDKPaymentPurpose_LDKBolt12RefundPayment_Body { /** - * The target feerate that the resulting HTLC transaction must meet. + * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be + * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed + * when seen in [`Event::PaymentClaimed`]. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - uint32_t target_feerate_sat_per_1000_weight; + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; /** - * The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably - * by the same transaction. + * The secret used to authenticate the sender to the recipient, preventing a number of + * de-anonymization attacks while routing a payment. + * + * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. */ - struct LDKCVec_HTLCDescriptorZ htlc_descriptors; + struct LDKThirtyTwoBytes payment_secret; /** - * The locktime required for the resulting HTLC transaction. + * The context of the payment such as information about the corresponding [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund */ - uint32_t tx_lock_time; -} LDKBumpTransactionEvent_LDKHTLCResolution_Body; + struct LDKBolt12RefundContext payment_context; +} LDKPaymentPurpose_LDKBolt12RefundPayment_Body; -typedef struct MUST_USE_STRUCT LDKBumpTransactionEvent { - LDKBumpTransactionEvent_Tag tag; +typedef struct MUST_USE_STRUCT LDKPaymentPurpose { + LDKPaymentPurpose_Tag tag; union { - LDKBumpTransactionEvent_LDKChannelClose_Body channel_close; - LDKBumpTransactionEvent_LDKHTLCResolution_Body htlc_resolution; + LDKPaymentPurpose_LDKBolt11InvoicePayment_Body bolt11_invoice_payment; + LDKPaymentPurpose_LDKBolt12OfferPayment_Body bolt12_offer_payment; + LDKPaymentPurpose_LDKBolt12RefundPayment_Body bolt12_refund_payment; + struct { + struct LDKThirtyTwoBytes spontaneous_payment; + }; }; -} LDKBumpTransactionEvent; +} LDKPaymentPurpose; /** - * An Event which you should probably take some action in response to. - * - * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use - * them directly as they don't round-trip exactly (for example FundingGenerationReady is never - * written as it makes no sense to respond to it after reconnecting to peers). + * The contents of CResult_PaymentPurposeDecodeErrorZ */ -typedef enum LDKEvent_Tag { +typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr { /** - * Used to indicate that the client should generate a funding transaction with the given - * parameters and then call [`ChannelManager::funding_transaction_generated`]. - * Generated in [`ChannelManager`] message handling. - * Note that *all inputs* in the funding transaction must spend SegWit outputs or your - * counterparty can steal your funds! - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_FundingGenerationReady, + struct LDKPaymentPurpose *result; /** - * Indicates that we've been offered a payment and it needs to be claimed via calling - * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. - * - * Note that if the preimage is not known, you should call - * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] - * to free up resources for this HTLC and avoid network congestion. - * - * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type - * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with - * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or - * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling. - * If you don't intend to check for custom TLVs, you can simply use - * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs. - * - * If you fail to call [`ChannelManager::claim_funds`], - * [`ChannelManager::claim_funds_with_known_custom_tlvs`], - * [`ChannelManager::fail_htlc_backwards`], or - * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will - * be automatically failed. - * - * # Note - * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `PaymentClaimable` events may be generated for the same payment. In such a case it is - * polite (and required in the lightning specification) to fail the payment the second time - * and give the sender their money back rather than accepting double payment. - * - * # Note - * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs - * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload - * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards - * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_PaymentClaimable, + struct LDKDecodeError *err; +} LDKCResult_PaymentPurposeDecodeErrorZPtr; + +/** + * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { /** - * Indicates a payment has been claimed and we've received money! - * - * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response - * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a - * [`ChannelManager::claim_funds`] call you may see this event without a corresponding - * [`Event::PaymentClaimable`] event. - * - * # Note - * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `PaymentClaimable` events may be generated for the same payment. If you then call - * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get - * multiple `PaymentClaimed` events. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_PaymentClaimed, + union LDKCResult_PaymentPurposeDecodeErrorZPtr contents; /** - * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`]. - * - * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a - * [`Destination`]. Once a connection is established, any messages buffered by an - * [`OnionMessageHandler`] may be sent. - * - * This event will not be generated for onion message forwards; only for sends including - * replies. Handlers should connect to the node otherwise any buffered messages may be lost. - * - * [`OnionMessage`]: msgs::OnionMessage - * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter - * [`Destination`]: crate::onion_message::messenger::Destination - * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler + * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. */ - LDKEvent_ConnectionNeeded, + bool result_ok; +} LDKCResult_PaymentPurposeDecodeErrorZ; + + + +/** + * Information about an HTLC that is part of a payment that can be claimed. + */ +typedef struct MUST_USE_STRUCT LDKClaimedHTLC { /** - * Indicates a request for an invoice failed to yield a response in a reasonable amount of time - * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an - * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed. - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Offer`]: crate::offers::offer::Offer - * [`Refund`]: crate::offers::refund::Refund + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKEvent_InvoiceRequestFailed, + LDKnativeClaimedHTLC *inner; /** - * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target - * and we got back the payment preimage for it). - * - * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed` - * event. In this situation, you SHOULD treat this payment as having succeeded. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKEvent_PaymentSent, + bool is_owned; +} LDKClaimedHTLC; + +/** + * The contents of CResult_ClaimedHTLCDecodeErrorZ + */ +typedef union LDKCResult_ClaimedHTLCDecodeErrorZPtr { /** - * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events - * provide failure information for each path attempt in the payment, including retries. - * - * This event is provided once there are no further pending HTLCs for the payment and the - * payment is no longer retryable, due either to the [`Retry`] provided or - * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. - * - * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for - * a payment after an [`Event::PaymentSent`] event for this same payment has already been - * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, - * and the payment MUST be treated as having succeeded. - * - * [`Retry`]: crate::ln::channelmanager::Retry - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_PaymentFailed, + struct LDKClaimedHTLC *result; /** - * Indicates that a path for an outbound payment was successful. - * - * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See - * [`Event::PaymentSent`] for obtaining the payment preimage. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_PaymentPathSuccessful, + struct LDKDecodeError *err; +} LDKCResult_ClaimedHTLCDecodeErrorZPtr; + +/** + * 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`. + */ +typedef struct LDKCResult_ClaimedHTLCDecodeErrorZ { /** - * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to - * handle the HTLC. - * - * Note that this does *not* indicate that all paths for an MPP payment have failed, see - * [`Event::PaymentFailed`]. - * - * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have - * been exhausted. - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_PaymentPathFailed, + union LDKCResult_ClaimedHTLCDecodeErrorZPtr contents; /** - * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. + * Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. */ - LDKEvent_ProbeSuccessful, + bool result_ok; +} LDKCResult_ClaimedHTLCDecodeErrorZ; + +/** + * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may + * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + */ +typedef enum LDKPathFailure_Tag { /** - * Indicates that a probe payment we sent failed at an intermediary node on the path. + * We failed to initially send the payment and no HTLC was committed to. Contains the relevant + * error. */ - LDKEvent_ProbeFailed, + LDKPathFailure_InitialSend, /** - * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at - * a time in the future. - * - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards + * A hop on the path failed to forward our payment. */ - LDKEvent_PendingHTLCsForwardable, + LDKPathFailure_OnPath, /** - * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if - * you've encoded an intercept scid in the receiver's invoice route hints using - * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. - * - * [`ChannelManager::forward_intercepted_htlc`] or - * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See - * their docs for more information. - * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs - * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc - * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc + * Must be last for serialization purposes */ - LDKEvent_HTLCIntercepted, + LDKPathFailure_Sentinel, +} LDKPathFailure_Tag; + +typedef struct LDKPathFailure_LDKInitialSend_Body { /** - * Used to indicate that an output which you should know how to spend was confirmed on chain - * and is now spendable. - * - * Such an output will *never* be spent directly by LDK, and are not at risk of your - * counterparty spending them due to some kind of timeout. Thus, you need to store them - * somewhere and spend them when you create on-chain transactions. - * - * You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending - * transactions for you. - * - * [`OutputSweeper`]: crate::util::sweep::OutputSweeper + * The error surfaced from initial send. */ - LDKEvent_SpendableOutputs, + struct LDKAPIError err; +} LDKPathFailure_LDKInitialSend_Body; + +typedef struct LDKPathFailure_LDKOnPath_Body { /** - * This event is generated when a payment has been successfully forwarded through us and a - * forwarding fee earned. + * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing + * decisions can take into account the update. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ - LDKEvent_PaymentForwarded, + struct LDKCOption_NetworkUpdateZ network_update; +} LDKPathFailure_LDKOnPath_Body; + +typedef struct MUST_USE_STRUCT LDKPathFailure { + LDKPathFailure_Tag tag; + union { + LDKPathFailure_LDKInitialSend_Body initial_send; + LDKPathFailure_LDKOnPath_Body on_path; + }; +} LDKPathFailure; + +/** + * An enum which can either contain a crate::lightning::events::PathFailure or not + */ +typedef enum LDKCOption_PathFailureZ_Tag { /** - * Used to indicate that a channel with the given `channel_id` is being opened and pending - * confirmation on-chain. - * - * This event is emitted when the funding transaction has been signed and is broadcast to the - * network. For 0conf channels it will be immediately followed by the corresponding - * [`Event::ChannelReady`] event. + * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure */ - LDKEvent_ChannelPending, + LDKCOption_PathFailureZ_Some, /** - * Used to indicate that a channel with the given `channel_id` is ready to - * be used. This event is emitted either when the funding transaction has been confirmed - * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel - * establishment. + * When we're in this state, this COption_PathFailureZ contains nothing */ - LDKEvent_ChannelReady, + LDKCOption_PathFailureZ_None, /** - * Used to indicate that a channel that got past the initial handshake with the given `channel_id` is in the - * process of closure. This includes previously opened channels, and channels that time out from not being funded. - * - * Note that this event is only triggered for accepted channels: if the - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is - * rejected, no `ChannelClosed` event will be sent. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Must be last for serialization purposes */ - LDKEvent_ChannelClosed, + LDKCOption_PathFailureZ_Sentinel, +} LDKCOption_PathFailureZ_Tag; + +typedef struct LDKCOption_PathFailureZ { + LDKCOption_PathFailureZ_Tag tag; + union { + struct { + struct LDKPathFailure some; + }; + }; +} LDKCOption_PathFailureZ; + +/** + * The contents of CResult_COption_PathFailureZDecodeErrorZ + */ +typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr { /** - * Used to indicate to the user that they can abandon the funding transaction and recycle the - * inputs for another purpose. - * - * This event is not guaranteed to be generated for channels that are closed due to a restart. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_DiscardFunding, + struct LDKCOption_PathFailureZ *result; /** - * 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. - * - * The event is only triggered when a new open channel request is received and the - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_OpenChannelRequest, + struct LDKDecodeError *err; +} LDKCResult_COption_PathFailureZDecodeErrorZPtr; + +/** + * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ { /** - * Indicates that the HTLC was accepted, but could not be processed when or after attempting to - * forward it. - * - * Some scenarios where this event may be sent include: - * * Insufficient capacity in the outbound channel - * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes - * * When an unknown SCID is requested for forwarding a payment. - * * Expected MPP amount has already been reached - * * The HTLC has timed out - * - * This event, however, does not get generated if an HTLC fails to meet the forwarding - * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). + * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_HTLCHandlingFailed, + union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents; /** - * Indicates that a transaction originating from LDK needs to have its fee bumped. This event - * requires confirmed external funds to be readily available to spend. - * - * LDK does not currently generate this event unless the - * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true. - * It is limited to the scope of channels with anchor outputs. - * - * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx - */ - LDKEvent_BumpTransaction, - /** - * Must be last for serialization purposes + * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. */ - LDKEvent_Sentinel, -} LDKEvent_Tag; + bool result_ok; +} LDKCResult_COption_PathFailureZDecodeErrorZ; -typedef struct LDKEvent_LDKFundingGenerationReady_Body { +/** + * An enum which can either contain a crate::lightning::events::ClosureReason or not + */ +typedef enum LDKCOption_ClosureReasonZ_Tag { /** - * The random channel_id we picked which you'll need to pass into - * [`ChannelManager::funding_transaction_generated`]. - * - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason */ - struct LDKChannelId temporary_channel_id; + LDKCOption_ClosureReasonZ_Some, /** - * The counterparty's node_id, which you'll need to pass back into - * [`ChannelManager::funding_transaction_generated`]. - * - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * When we're in this state, this COption_ClosureReasonZ contains nothing */ - struct LDKPublicKey counterparty_node_id; + LDKCOption_ClosureReasonZ_None, /** - * The value, in satoshis, that the output should have. + * Must be last for serialization purposes */ - uint64_t channel_value_satoshis; + LDKCOption_ClosureReasonZ_Sentinel, +} LDKCOption_ClosureReasonZ_Tag; + +typedef struct LDKCOption_ClosureReasonZ { + LDKCOption_ClosureReasonZ_Tag tag; + union { + struct { + struct LDKClosureReason some; + }; + }; +} LDKCOption_ClosureReasonZ; + +/** + * The contents of CResult_COption_ClosureReasonZDecodeErrorZ + */ +typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr { /** - * The script which should be used in the transaction output. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_u8Z output_script; + struct LDKCOption_ClosureReasonZ *result; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects - * serialized with LDK versions prior to 0.0.113. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKU128 user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; + struct LDKDecodeError *err; +} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; -typedef struct LDKEvent_LDKPaymentClaimable_Body { +/** + * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { /** - * The node that will receive the payment after it has been claimed. - * This is useful to identify payments received via [phantom nodes]. - * This field will always be filled in when the event was generated by LDK versions - * 0.0.113 and above. - * - * [phantom nodes]: crate::sign::PhantomKeysManager - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKPublicKey receiver_node_id; + union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; /** - * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will - * not stop you from registering duplicate payment hashes for inbound payments. + * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. */ - struct LDKThirtyTwoBytes payment_hash; + bool result_ok; +} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + +/** + * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + */ +typedef enum LDKHTLCDestination_Tag { /** - * The fields in the onion which were received with each HTLC. Only fields which were - * identical in each HTLC involved in the payment will be included here. - * - * Payments received on LDK versions prior to 0.0.115 will have this field unset. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * We tried forwarding to a channel but failed to do so. An example of such an instance is when + * there is insufficient capacity in our outbound channel. */ - struct LDKRecipientOnionFields onion_fields; + LDKHTLCDestination_NextHopChannel, /** - * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater - * than the invoice amount. - * - * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set - * and the previous hop took an extra fee. - * - * # Note - * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this - * field, you may lose money! - * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * Scenario where we are unsure of the next node to forward the HTLC to. */ - uint64_t amount_msat; + LDKHTLCDestination_UnknownNextHop, /** - * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee - * taken by our channel counterparty. - * - * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set. - * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate + * intercept HTLC. */ - uint64_t counterparty_skimmed_fee_msat; + LDKHTLCDestination_InvalidForward, /** - * Information for claiming this received payment, based on whether the purpose of the - * payment is to pay an invoice or to send a spontaneous payment. + * We couldn't decode the incoming onion to obtain the forwarding details. */ - struct LDKPaymentPurpose purpose; + LDKHTLCDestination_InvalidOnion, /** - * The `channel_id` indicating over which channel we received the payment. + * Failure scenario where an HTLC may have been forwarded to be intended for us, + * but is invalid for some reason, so we reject it. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKChannelId via_channel_id; - /** - * The `user_channel_id` indicating over which channel we received the payment. + * Some of the reasons may include: + * * HTLC Timeouts + * * Excess HTLCs for a payment that we have already fully received, over-paying for the + * payment, + * * The counterparty node modified the HTLC in transit, + * * A probing attack where an intermediary node is trying to detect if we are the ultimate + * recipient for a payment. */ - struct LDKCOption_U128Z via_user_channel_id; + LDKHTLCDestination_FailedPayment, /** - * The block height at which this payment will be failed back and will no longer be - * eligible for claiming. - * - * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to - * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * Must be last for serialization purposes */ - struct LDKCOption_u32Z claim_deadline; -} LDKEvent_LDKPaymentClaimable_Body; + LDKHTLCDestination_Sentinel, +} LDKHTLCDestination_Tag; -typedef struct LDKEvent_LDKPaymentClaimed_Body { +typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { /** - * The node that received the payment. - * This is useful to identify payments which were received via [phantom nodes]. - * This field will always be filled in when the event was generated by LDK versions - * 0.0.113 and above. - * - * [phantom nodes]: crate::sign::PhantomKeysManager + * The `node_id` of the next node. For backwards compatibility, this field is + * marked as optional, versions prior to 0.0.110 may not always be able to provide + * counterparty node information. * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKPublicKey receiver_node_id; - /** - * The payment hash of the claimed payment. Note that LDK will not stop you from - * registering duplicate payment hashes for inbound payments. - */ - struct LDKThirtyTwoBytes payment_hash; - /** - * The value, in thousandths of a satoshi, that this payment is for. May be greater than the - * invoice amount. - */ - uint64_t amount_msat; - /** - * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a - * spontaneous payment. - */ - struct LDKPaymentPurpose purpose; - /** - * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior - * to LDK version 0.0.117. - */ - struct LDKCVec_ClaimedHTLCZ htlcs; - /** - * The sender-intended sum total of all the MPP parts. This will be `None` for events - * serialized prior to LDK version 0.0.117. - */ - struct LDKCOption_u64Z sender_intended_total_msat; -} LDKEvent_LDKPaymentClaimed_Body; - -typedef struct LDKEvent_LDKConnectionNeeded_Body { - /** - * The node id for the node needing a connection. - */ struct LDKPublicKey node_id; /** - * Sockets for connecting to the node. + * The outgoing `channel_id` between us and the next node. */ - struct LDKCVec_SocketAddressZ addresses; -} LDKEvent_LDKConnectionNeeded_Body; + struct LDKChannelId channel_id; +} LDKHTLCDestination_LDKNextHopChannel_Body; -typedef struct LDKEvent_LDKInvoiceRequestFailed_Body { +typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { /** - * The `payment_id` to have been associated with payment for the requested invoice. + * Short channel id we are requesting to forward an HTLC to. */ - struct LDKThirtyTwoBytes payment_id; -} LDKEvent_LDKInvoiceRequestFailed_Body; + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKUnknownNextHop_Body; -typedef struct LDKEvent_LDKPaymentSent_Body { - /** - * The `payment_id` passed to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - */ - struct LDKCOption_ThirtyTwoBytesZ payment_id; +typedef struct LDKHTLCDestination_LDKInvalidForward_Body { /** - * The preimage to the hash given to ChannelManager::send_payment. - * Note that this serves as a payment receipt, if you wish to have such a thing, you must - * store it somehow! + * Short channel id we are requesting to forward an HTLC to. */ - struct LDKThirtyTwoBytes payment_preimage; + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKInvalidForward_Body; + +typedef struct LDKHTLCDestination_LDKFailedPayment_Body { /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * The payment hash of the payment we attempted to process. */ struct LDKThirtyTwoBytes payment_hash; - /** - * The total fee which was spent at intermediate hops in this payment, across all paths. - * - * Note that, like [`Route::get_total_fees`] this does *not* include any potential - * overpayment to the recipient node. - * - * If the recipient or an intermediate node misbehaves and gives us free money, this may - * overstate the amount paid, though this is unlikely. - * - * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees - */ - struct LDKCOption_u64Z fee_paid_msat; -} LDKEvent_LDKPaymentSent_Body; +} LDKHTLCDestination_LDKFailedPayment_Body; -typedef struct LDKEvent_LDKPaymentFailed_Body { +typedef struct MUST_USE_STRUCT LDKHTLCDestination { + LDKHTLCDestination_Tag tag; + union { + LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; + LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; + LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; + LDKHTLCDestination_LDKFailedPayment_Body failed_payment; + }; +} LDKHTLCDestination; + +/** + * An enum which can either contain a crate::lightning::events::HTLCDestination or not + */ +typedef enum LDKCOption_HTLCDestinationZ_Tag { /** - * The `payment_id` passed to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination */ - struct LDKThirtyTwoBytes payment_id; + LDKCOption_HTLCDestinationZ_Some, /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * When we're in this state, this COption_HTLCDestinationZ contains nothing */ - struct LDKThirtyTwoBytes payment_hash; + LDKCOption_HTLCDestinationZ_None, /** - * The reason the payment failed. This is only `None` for events generated or serialized - * by versions prior to 0.0.115. + * Must be last for serialization purposes */ - struct LDKCOption_PaymentFailureReasonZ reason; -} LDKEvent_LDKPaymentFailed_Body; + LDKCOption_HTLCDestinationZ_Sentinel, +} LDKCOption_HTLCDestinationZ_Tag; -typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { - /** - * The `payment_id` passed to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - */ - struct LDKThirtyTwoBytes payment_id; +typedef struct LDKCOption_HTLCDestinationZ { + LDKCOption_HTLCDestinationZ_Tag tag; + union { + struct { + struct LDKHTLCDestination some; + }; + }; +} LDKCOption_HTLCDestinationZ; + +/** + * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + */ +typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * This will be `Some` for all payments which completed on LDK 0.0.104 or later. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_ThirtyTwoBytesZ payment_hash; + struct LDKCOption_HTLCDestinationZ *result; /** - * The payment path that was successful. - * - * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPath path; -} LDKEvent_LDKPaymentPathSuccessful_Body; + struct LDKDecodeError *err; +} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr; -typedef struct LDKEvent_LDKPaymentPathFailed_Body { +/** + * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { /** - * The `payment_id` passed to [`ChannelManager::send_payment`]. - * - * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCOption_ThirtyTwoBytesZ payment_id; + union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. */ - struct LDKThirtyTwoBytes payment_hash; + bool result_ok; +} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; + +/** + * The contents of CResult_PaymentFailureReasonDecodeErrorZ + */ +typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr { /** - * Indicates the payment was rejected for some reason by the recipient. This implies that - * the payment has failed, not just the route in question. If this is not set, the payment may - * be retried via a different route. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - bool payment_failed_permanently; + enum LDKPaymentFailureReason *result; /** - * Extra error details based on the failure type. May contain an update that needs to be - * applied to the [`NetworkGraph`]. - * - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPathFailure failure; + struct LDKDecodeError *err; +} LDKCResult_PaymentFailureReasonDecodeErrorZPtr; + +/** + * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::PaymentFailureReason on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ { /** - * The payment path that failed. + * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKPath path; + union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents; /** - * The channel responsible for the failed payment path. - * - * Note that for route hints or for the first hop in a path this may be an SCID alias and - * may not refer to a channel in the public network graph. These aliases may also collide - * with channels in the public network graph. - * - * If this is `Some`, then the corresponding channel should be avoided when the payment is - * retried. May be `None` for older [`Event`] serializations. + * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state. */ - struct LDKCOption_u64Z short_channel_id; -} LDKEvent_LDKPaymentPathFailed_Body; + bool result_ok; +} LDKCResult_PaymentFailureReasonDecodeErrorZ; -typedef struct LDKEvent_LDKProbeSuccessful_Body { +/** + * An enum which can either contain a crate::c_types::U128 or not + */ +typedef enum LDKCOption_U128Z_Tag { /** - * The id returned by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * When we're in this state, this COption_U128Z contains a crate::c_types::U128 */ - struct LDKThirtyTwoBytes payment_id; + LDKCOption_U128Z_Some, /** - * The hash generated by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * When we're in this state, this COption_U128Z contains nothing */ - struct LDKThirtyTwoBytes payment_hash; + LDKCOption_U128Z_None, /** - * The payment path that was successful. + * Must be last for serialization purposes */ - struct LDKPath path; -} LDKEvent_LDKProbeSuccessful_Body; + LDKCOption_U128Z_Sentinel, +} LDKCOption_U128Z_Tag; -typedef struct LDKEvent_LDKProbeFailed_Body { +typedef struct LDKCOption_U128Z { + LDKCOption_U128Z_Tag tag; + union { + struct { + struct LDKU128 some; + }; + }; +} LDKCOption_U128Z; + +/** + * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ClaimedHTLCZ { /** - * The id returned by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes payment_id; + struct LDKClaimedHTLC *data; /** - * The hash generated by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * The number of elements pointed to by `data`. */ - struct LDKThirtyTwoBytes payment_hash; + uintptr_t datalen; +} LDKCVec_ClaimedHTLCZ; + +/** + * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not + */ +typedef enum LDKCOption_PaymentFailureReasonZ_Tag { /** - * The payment path that failed. + * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason */ - struct LDKPath path; + LDKCOption_PaymentFailureReasonZ_Some, /** - * The channel responsible for the failed probe. - * - * Note that for route hints or for the first hop in a path this may be an SCID alias and - * may not refer to a channel in the public network graph. These aliases may also collide - * with channels in the public network graph. + * When we're in this state, this COption_PaymentFailureReasonZ contains nothing */ - struct LDKCOption_u64Z short_channel_id; -} LDKEvent_LDKProbeFailed_Body; - -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { + LDKCOption_PaymentFailureReasonZ_None, /** - * The minimum amount of time that should be waited prior to calling - * process_pending_htlc_forwards. To increase the effort required to correlate payments, - * you should wait a random amount of time in roughly the range (now + time_forwardable, - * now + 5*time_forwardable). + * Must be last for serialization purposes */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; + LDKCOption_PaymentFailureReasonZ_Sentinel, +} LDKCOption_PaymentFailureReasonZ_Tag; -typedef struct LDKEvent_LDKHTLCIntercepted_Body { +typedef struct LDKCOption_PaymentFailureReasonZ { + LDKCOption_PaymentFailureReasonZ_Tag tag; + union { + struct { + enum LDKPaymentFailureReason some; + }; + }; +} LDKCOption_PaymentFailureReasonZ; + + + +/** + * A descriptor used to sign for a commitment transaction's anchor output. + */ +typedef struct MUST_USE_STRUCT LDKAnchorDescriptor { /** - * An id to help LDK identify which HTLC is being forwarded or failed. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes intercept_id; + LDKnativeAnchorDescriptor *inner; /** - * The fake scid that was programmed as the next hop's scid, generated using - * [`ChannelManager::get_intercept_scid`]. - * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uint64_t requested_next_hop_scid; - /** - * The payment hash used for this HTLC. - */ - struct LDKThirtyTwoBytes payment_hash; - /** - * How many msats were received on the inbound edge of this HTLC. - */ - uint64_t inbound_amount_msat; - /** - * How many msats the payer intended to route to the next node. Depending on the reason you are - * intercepting this payment, you might take a fee by forwarding less than this amount. - * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116. - * - * Note that LDK will NOT check that expected fees were factored into this value. You MUST - * check that whatever fee you want has been included here or subtract it as required. Further, - * LDK will not stop you from forwarding more than you received. - */ - uint64_t expected_outbound_amount_msat; -} LDKEvent_LDKHTLCIntercepted_Body; + bool is_owned; +} LDKAnchorDescriptor; -typedef struct LDKEvent_LDKSpendableOutputs_Body { +/** + * Represents the different types of transactions, originating from LDK, to be bumped. + */ +typedef enum LDKBumpTransactionEvent_Tag { /** - * The outputs which you should store as spendable by you. + * Indicates that a channel featuring anchor outputs is to be closed by broadcasting the local + * commitment transaction. Since commitment transactions have a static feerate pre-agreed upon, + * they may need additional fees to be attached through a child transaction using the popular + * [Child-Pays-For-Parent](https://bitcoinops.org/en/topics/cpfp) fee bumping technique. This + * child transaction must include the anchor input described within `anchor_descriptor` along + * with additional inputs to meet the target feerate. Failure to meet the target feerate + * decreases the confirmation odds of the transaction package (which includes the commitment + * and child anchor transactions), possibly resulting in a loss of funds. Once the transaction + * is constructed, it must be fully signed for and broadcast by the consumer of the event + * along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be + * broadcast first, as the child anchor transaction depends on it. + * + * The consumer should be able to sign for any of the additional inputs included within the + * child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be + * re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature + * can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be + * provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the + * full witness required to spend. + * + * It is possible to receive more than one instance of this event if a valid child anchor + * transaction is never broadcast or is but not with a sufficient fee to be mined. Care should + * be taken by the consumer of the event to ensure any future iterations of the child anchor + * transaction adhere to the [Replace-By-Fee + * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md) + * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of + * these events is not user-controlled, users may ignore/drop the event if they are no longer + * able to commit external confirmed funds to the child anchor transaction. + * + * The set of `pending_htlcs` on the commitment transaction to be broadcast can be inspected to + * determine whether a significant portion of the channel's funds are allocated to HTLCs, + * enabling users to make their own decisions regarding the importance of the commitment + * transaction's confirmation. Note that this is not required, but simply exists as an option + * for users to override LDK's behavior. On commitments with no HTLCs (indicated by those with + * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to + * be not urgent. + * + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input + * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness */ - struct LDKCVec_SpendableOutputDescriptorZ outputs; + LDKBumpTransactionEvent_ChannelClose, /** - * The `channel_id` indicating which channel the spendable outputs belong to. + * Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a + * holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the + * zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC + * transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached + * for a timely confirmation within the chain. These additional inputs and/or outputs must be + * appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the + * target feerate decreases the confirmation odds of the transaction, possibly resulting in a + * loss of funds. Once the transaction meets the target feerate, it must be signed for and + * broadcast by the consumer of the event. * - * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + * The consumer should be able to sign for any of the non-HTLC inputs added to the resulting + * HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived + * through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be + * computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be + * provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required + * to spend. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * It is possible to receive more than one instance of this event if a valid HTLC transaction + * is never broadcast or is but not with a sufficient fee to be mined. Care should be taken by + * the consumer of the event to ensure any future iterations of the HTLC transaction adhere to + * the [Replace-By-Fee + * rules](https://github.com/bitcoin/bitcoin/blob/master/doc/policy/mempool-replacements.md) + * for fee bumps to be accepted into the mempool, and eventually the chain. As the frequency of + * these events is not user-controlled, users may ignore/drop the event if either they are no + * longer able to commit external confirmed funds to the HTLC transaction or the fee committed + * to the HTLC transaction is greater in value than the HTLCs being claimed. + * + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction */ - struct LDKChannelId channel_id; -} LDKEvent_LDKSpendableOutputs_Body; + LDKBumpTransactionEvent_HTLCResolution, + /** + * Must be last for serialization purposes + */ + LDKBumpTransactionEvent_Sentinel, +} LDKBumpTransactionEvent_Tag; -typedef struct LDKEvent_LDKPaymentForwarded_Body { +typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body { /** - * The channel id of the incoming channel between the previous node and us. - * - * This is only `None` for events generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The `channel_id` of the channel which has been closed. */ - struct LDKChannelId prev_channel_id; + struct LDKChannelId channel_id; /** - * The channel id of the outgoing channel between the next node and us. - * - * This is only `None` for events generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * Counterparty in the closed channel. */ - struct LDKChannelId next_channel_id; + struct LDKPublicKey counterparty_node_id; /** - * The `user_channel_id` of the incoming channel between the previous node and us. + * The unique identifier for the claim of the anchor output in the commitment transaction. * - * This is only `None` for events generated or serialized by versions prior to 0.0.122. + * The identifier must map to the set of external UTXOs assigned to the claim, such that + * they can be reused when a new claim with the same identifier needs to be made, resulting + * in a fee-bumping attempt. */ - struct LDKCOption_U128Z prev_user_channel_id; + struct LDKThirtyTwoBytes claim_id; /** - * The `user_channel_id` of the outgoing channel between the next node and us. - * - * This will be `None` if the payment was settled via an on-chain transaction. See the - * 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. + * The target feerate that the transaction package, which consists of the commitment + * transaction and the to-be-crafted child anchor transaction, must meet. */ - struct LDKCOption_U128Z next_user_channel_id; + uint32_t package_target_feerate_sat_per_1000_weight; /** - * 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 - * was pending, the amount the next hop claimed will have been rounded down to the nearest - * whole satoshi. Thus, the fee calculated here may be higher than expected as we still - * claimed the full value in millisatoshis from the source. In this case, - * `claim_from_onchain_tx` will be set. - * - * If the channel which sent us the payment has been force-closed, we will claim the funds - * via an on-chain transaction. In that case we do not yet know the on-chain transaction - * fees which we will spend and will instead set this to `None`. It is possible duplicate - * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is - * `None`. + * The channel's commitment transaction to bump the fee of. This transaction should be + * broadcast along with the anchor transaction constructed as a result of consuming this + * event. */ - struct LDKCOption_u64Z total_fee_earned_msat; + struct LDKTransaction commitment_tx; /** - * The share of the total fee, in milli-satoshis, which was withheld in addition to the - * forwarding fee. - * - * This will only be `Some` if we forwarded an intercepted HTLC with less than the - * expected amount. This means our counterparty accepted to receive less than the invoice - * amount, e.g., by claiming the payment featuring a corresponding - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]. - * - * Will also always be `None` for events serialized with LDK prior to version 0.0.122. - * - * The caveat described above the `total_fee_earned_msat` field applies here as well. - * - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat + * The absolute fee in satoshis of the commitment transaction. This can be used along the + * with weight of the commitment transaction to determine its feerate. */ - struct LDKCOption_u64Z skimmed_fee_msat; + uint64_t commitment_tx_fee_satoshis; /** - * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain - * transaction. + * The descriptor to sign the anchor input of the anchor transaction constructed as a + * result of consuming this event. */ - bool claim_from_onchain_tx; + struct LDKAnchorDescriptor anchor_descriptor; /** - * The final amount forwarded, in milli-satoshis, after the fee is deducted. - * - * The caveat described above the `total_fee_earned_msat` field applies here as well. + * The set of pending HTLCs on the commitment transaction that need to be resolved once the + * commitment transaction confirms. */ - struct LDKCOption_u64Z outbound_amount_forwarded_msat; -} LDKEvent_LDKPaymentForwarded_Body; + struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs; +} LDKBumpTransactionEvent_LDKChannelClose_Body; -typedef struct LDKEvent_LDKChannelPending_Body { +typedef struct LDKBumpTransactionEvent_LDKHTLCResolution_Body { /** - * The `channel_id` of the channel that is pending confirmation. + * The `channel_id` of the channel which has been closed. */ struct LDKChannelId channel_id; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Counterparty in the closed channel. */ - struct LDKU128 user_channel_id; + struct LDKPublicKey counterparty_node_id; /** - * The `temporary_channel_id` this channel used to be known by during channel establishment. - * - * Will be `None` for channels created prior to LDK version 0.0.115. + * The unique identifier for the claim of the HTLCs in the confirmed commitment + * transaction. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The identifier must map to the set of external UTXOs assigned to the claim, such that + * they can be reused when a new claim with the same identifier needs to be made, resulting + * in a fee-bumping attempt. */ - struct LDKChannelId former_temporary_channel_id; + struct LDKThirtyTwoBytes claim_id; /** - * The `node_id` of the channel counterparty. + * The target feerate that the resulting HTLC transaction must meet. */ - struct LDKPublicKey counterparty_node_id; + uint32_t target_feerate_sat_per_1000_weight; /** - * The outpoint of the channel's funding transaction. + * The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably + * by the same transaction. */ - struct LDKOutPoint funding_txo; + struct LDKCVec_HTLCDescriptorZ htlc_descriptors; /** - * The features that this channel will operate with. - * - * Will be `None` for channels created prior to LDK version 0.0.122. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The locktime required for the resulting HTLC transaction. */ - struct LDKChannelTypeFeatures channel_type; -} LDKEvent_LDKChannelPending_Body; + uint32_t tx_lock_time; +} LDKBumpTransactionEvent_LDKHTLCResolution_Body; -typedef struct LDKEvent_LDKChannelReady_Body { - /** - * The `channel_id` of the channel that is ready. - */ - struct LDKChannelId channel_id; +typedef struct MUST_USE_STRUCT LDKBumpTransactionEvent { + LDKBumpTransactionEvent_Tag tag; + union { + LDKBumpTransactionEvent_LDKChannelClose_Body channel_close; + LDKBumpTransactionEvent_LDKHTLCResolution_Body htlc_resolution; + }; +} LDKBumpTransactionEvent; + +/** + * An Event which you should probably take some action in response to. + * + * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use + * them directly as they don't round-trip exactly (for example FundingGenerationReady is never + * written as it makes no sense to respond to it after reconnecting to peers). + */ +typedef enum LDKEvent_Tag { /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. + * Used to indicate that the client should generate a funding transaction with the given + * parameters and then call [`ChannelManager::funding_transaction_generated`]. + * Generated in [`ChannelManager`] message handling. + * Note that *all inputs* in the funding transaction must spend SegWit outputs or your + * counterparty can steal your funds! * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - struct LDKU128 user_channel_id; + LDKEvent_FundingGenerationReady, /** - * The `node_id` of the channel counterparty. + * Indicates that we've been offered a payment and it needs to be claimed via calling + * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. + * + * Note that if the preimage is not known, you should call + * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] + * to free up resources for this HTLC and avoid network congestion. + * + * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type + * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with + * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or + * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling. + * If you don't intend to check for custom TLVs, you can simply use + * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs. + * + * If you fail to call [`ChannelManager::claim_funds`], + * [`ChannelManager::claim_funds_with_known_custom_tlvs`], + * [`ChannelManager::fail_htlc_backwards`], or + * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will + * be automatically failed. + * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `PaymentClaimable` events may be generated for the same payment. In such a case it is + * polite (and required in the lightning specification) to fail the payment the second time + * and give the sender their money back rather than accepting double payment. + * + * # Note + * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs + * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload + * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards + * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason */ - struct LDKPublicKey counterparty_node_id; + LDKEvent_PaymentClaimable, /** - * The features that this channel will operate with. + * Indicates a payment has been claimed and we've received money! + * + * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response + * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a + * [`ChannelManager::claim_funds`] call you may see this event without a corresponding + * [`Event::PaymentClaimable`] event. + * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `PaymentClaimable` events may be generated for the same payment. If you then call + * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get + * multiple `PaymentClaimed` events. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - struct LDKChannelTypeFeatures channel_type; -} LDKEvent_LDKChannelReady_Body; - -typedef struct LDKEvent_LDKChannelClosed_Body { + LDKEvent_PaymentClaimed, /** - * The `channel_id` of the channel which has been closed. Note that on-chain transactions - * resolving the channel are likely still awaiting confirmation. + * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`]. + * + * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a + * [`Destination`]. Once a connection is established, any messages buffered by an + * [`OnionMessageHandler`] may be sent. + * + * This event will not be generated for onion message forwards; only for sends including + * replies. Handlers should connect to the node otherwise any buffered messages may be lost. + * + * [`OnionMessage`]: msgs::OnionMessage + * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter + * [`Destination`]: crate::onion_message::messenger::Destination + * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler */ - struct LDKChannelId channel_id; + LDKEvent_ConnectionNeeded, /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for inbound channels. - * This may be zero for inbound channels serialized prior to 0.0.113 and will always be - * zero for objects serialized with LDK versions prior to 0.0.102. + * Indicates a request for an invoice failed to yield a response in a reasonable amount of time + * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an + * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed. * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund */ - struct LDKU128 user_channel_id; + LDKEvent_InvoiceRequestFailed, /** - * The reason the channel was closed. + * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target + * and we got back the payment preimage for it). + * + * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed` + * event. In this situation, you SHOULD treat this payment as having succeeded. */ - struct LDKClosureReason reason; + LDKEvent_PaymentSent, /** - * Counterparty in the closed channel. + * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events + * provide failure information for each path attempt in the payment, including retries. * - * This field will be `None` for objects serialized prior to LDK 0.0.117. + * This event is provided once there are no further pending HTLCs for the payment and the + * payment is no longer retryable, due either to the [`Retry`] provided or + * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for + * a payment after an [`Event::PaymentSent`] event for this same payment has already been + * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, + * and the payment MUST be treated as having succeeded. + * + * [`Retry`]: crate::ln::channelmanager::Retry + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - struct LDKPublicKey counterparty_node_id; + LDKEvent_PaymentFailed, /** - * Channel capacity of the closing channel (sats). + * Indicates that a path for an outbound payment was successful. * - * This field will be `None` for objects serialized prior to LDK 0.0.117. + * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See + * [`Event::PaymentSent`] for obtaining the payment preimage. */ - struct LDKCOption_u64Z channel_capacity_sats; + LDKEvent_PaymentPathSuccessful, /** - * The original channel funding TXO; this helps checking for the existence and confirmation - * status of the closing tx. - * Note that for instances serialized in v0.0.119 or prior this will be missing (None). + * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to + * handle the HTLC. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that this does *not* indicate that all paths for an MPP payment have failed, see + * [`Event::PaymentFailed`]. + * + * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have + * been exhausted. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - struct LDKOutPoint channel_funding_txo; -} LDKEvent_LDKChannelClosed_Body; - -typedef struct LDKEvent_LDKDiscardFunding_Body { + LDKEvent_PaymentPathFailed, /** - * The channel_id of the channel which has been closed. + * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. */ - struct LDKChannelId channel_id; + LDKEvent_ProbeSuccessful, /** - * The full transaction received from the user + * Indicates that a probe payment we sent failed at an intermediary node on the path. */ - struct LDKTransaction transaction; -} LDKEvent_LDKDiscardFunding_Body; - -typedef struct LDKEvent_LDKOpenChannelRequest_Body { + LDKEvent_ProbeFailed, /** - * The temporary channel ID of the channel requested to be opened. - * - * When responding to the request, the `temporary_channel_id` should be passed - * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, - * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. + * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at + * a time in the future. * - * [`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 + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ - struct LDKChannelId temporary_channel_id; + LDKEvent_PendingHTLCsForwardable, /** - * The node_id of the counterparty requesting to open the channel. + * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if + * you've encoded an intercept scid in the receiver's invoice route hints using + * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. * - * When responding to the request, the `counterparty_node_id` should be passed - * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to - * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the - * request. + * [`ChannelManager::forward_intercepted_htlc`] or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See + * their docs for more information. * - * [`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 + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc */ - struct LDKPublicKey counterparty_node_id; + LDKEvent_HTLCIntercepted, /** - * The channel value of the requested channel. + * Used to indicate that an output which you should know how to spend was confirmed on chain + * and is now spendable. + * + * Such an output will *never* be spent directly by LDK, and are not at risk of your + * counterparty spending them due to some kind of timeout. Thus, you need to store them + * somewhere and spend them when you create on-chain transactions. + * + * You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending + * transactions for you. + * + * [`OutputSweeper`]: crate::util::sweep::OutputSweeper */ - uint64_t funding_satoshis; + LDKEvent_SpendableOutputs, /** - * Our starting balance in the channel if the request is accepted, in milli-satoshi. + * This event is generated when a payment has been successfully forwarded through us and a + * forwarding fee earned. */ - uint64_t push_msat; + LDKEvent_PaymentForwarded, /** - * The features that this channel will operate with. If you reject the channel, a - * well-behaved counterparty may automatically re-attempt the channel with a new set of - * feature flags. - * - * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type, - * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to - * 0.0.106. - * - * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type, - * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to - * 0.0.107. Channels setting this type also need to get manually accepted via - * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`], - * or will be rejected otherwise. + * Used to indicate that a channel with the given `channel_id` is being opened and pending + * confirmation on-chain. * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * This event is emitted when the funding transaction has been signed and is broadcast to the + * network. For 0conf channels it will be immediately followed by the corresponding + * [`Event::ChannelReady`] event. */ - struct LDKChannelTypeFeatures channel_type; -} LDKEvent_LDKOpenChannelRequest_Body; - -typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { + LDKEvent_ChannelPending, /** - * The channel over which the HTLC was received. + * Used to indicate that a channel with the given `channel_id` is ready to + * be used. This event is emitted either when the funding transaction has been confirmed + * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel + * establishment. */ - struct LDKChannelId prev_channel_id; + LDKEvent_ChannelReady, /** - * Destination of the HTLC that failed to be processed. - */ - struct LDKHTLCDestination failed_next_destination; -} LDKEvent_LDKHTLCHandlingFailed_Body; - + * Used to indicate that a channel that got past the initial handshake with the given `channel_id` is in the + * process of closure. This includes previously opened channels, and channels that time out from not being funded. + * + * Note that this event is only triggered for accepted channels: if the + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is + * rejected, no `ChannelClosed` event will be sent. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + LDKEvent_ChannelClosed, + /** + * Used to indicate to the user that they can abandon the funding transaction and recycle the + * inputs for another purpose. + * + * This event is not guaranteed to be generated for channels that are closed due to a restart. + */ + LDKEvent_DiscardFunding, + /** + * Indicates a request to open a new channel by a peer. + * + * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, + * call [`ChannelManager::force_close_without_broadcasting_txn`]. 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. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + LDKEvent_OpenChannelRequest, + /** + * Indicates that the HTLC was accepted, but could not be processed when or after attempting to + * forward it. + * + * Some scenarios where this event may be sent include: + * * Insufficient capacity in the outbound channel + * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes + * * When an unknown SCID is requested for forwarding a payment. + * * Expected MPP amount has already been reached + * * The HTLC has timed out + * + * This event, however, does not get generated if an HTLC fails to meet the forwarding + * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). + */ + LDKEvent_HTLCHandlingFailed, + /** + * Indicates that a transaction originating from LDK needs to have its fee bumped. This event + * requires confirmed external funds to be readily available to spend. + * + * LDK does not currently generate this event unless the + * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true. + * It is limited to the scope of channels with anchor outputs. + * + * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx + */ + LDKEvent_BumpTransaction, + /** + * Must be last for serialization purposes + */ + LDKEvent_Sentinel, +} LDKEvent_Tag; + +typedef struct LDKEvent_LDKFundingGenerationReady_Body { + /** + * The random channel_id we picked which you'll need to pass into + * [`ChannelManager::funding_transaction_generated`]. + * + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + */ + struct LDKChannelId temporary_channel_id; + /** + * The counterparty's node_id, which you'll need to pass back into + * [`ChannelManager::funding_transaction_generated`]. + * + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + */ + struct LDKPublicKey counterparty_node_id; + /** + * The value, in satoshis, that the output should have. + */ + uint64_t channel_value_satoshis; + /** + * The script which should be used in the transaction output. + */ + struct LDKCVec_u8Z output_script; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; +} LDKEvent_LDKFundingGenerationReady_Body; + +typedef struct LDKEvent_LDKPaymentClaimable_Body { + /** + * The node that will receive the payment after it has been claimed. + * This is useful to identify payments received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::sign::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; + /** + * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will + * not stop you from registering duplicate payment hashes for inbound payments. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The fields in the onion which were received with each HTLC. Only fields which were + * identical in each HTLC involved in the payment will be included here. + * + * Payments received on LDK versions prior to 0.0.115 will have this field unset. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKRecipientOnionFields onion_fields; + /** + * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater + * than the invoice amount. + * + * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set + * and the previous hop took an extra fee. + * + * # Note + * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this + * field, you may lose money! + * + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + */ + uint64_t amount_msat; + /** + * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee + * taken by our channel counterparty. + * + * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set. + * + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + */ + uint64_t counterparty_skimmed_fee_msat; + /** + * Information for claiming this received payment, based on whether the purpose of the + * payment is to pay an invoice or to send a spontaneous payment. + */ + struct LDKPaymentPurpose purpose; + /** + * The `channel_id` indicating over which channel we received the payment. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelId via_channel_id; + /** + * The `user_channel_id` indicating over which channel we received the payment. + */ + struct LDKCOption_U128Z via_user_channel_id; + /** + * The block height at which this payment will be failed back and will no longer be + * eligible for claiming. + * + * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to + * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + */ + struct LDKCOption_u32Z claim_deadline; +} LDKEvent_LDKPaymentClaimable_Body; + +typedef struct LDKEvent_LDKPaymentClaimed_Body { + /** + * The node that received the payment. + * This is useful to identify payments which were received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::sign::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; + /** + * The payment hash of the claimed payment. Note that LDK will not stop you from + * registering duplicate payment hashes for inbound payments. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The value, in thousandths of a satoshi, that this payment is for. May be greater than the + * invoice amount. + */ + uint64_t amount_msat; + /** + * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a + * spontaneous payment. + */ + struct LDKPaymentPurpose purpose; + /** + * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior + * to LDK version 0.0.117. + */ + struct LDKCVec_ClaimedHTLCZ htlcs; + /** + * The sender-intended sum total of all the MPP parts. This will be `None` for events + * serialized prior to LDK version 0.0.117. + */ + struct LDKCOption_u64Z sender_intended_total_msat; +} LDKEvent_LDKPaymentClaimed_Body; + +typedef struct LDKEvent_LDKConnectionNeeded_Body { + /** + * The node id for the node needing a connection. + */ + struct LDKPublicKey node_id; + /** + * Sockets for connecting to the node. + */ + struct LDKCVec_SocketAddressZ addresses; +} LDKEvent_LDKConnectionNeeded_Body; + +typedef struct LDKEvent_LDKInvoiceRequestFailed_Body { + /** + * The `payment_id` to have been associated with payment for the requested invoice. + */ + struct LDKThirtyTwoBytes payment_id; +} LDKEvent_LDKInvoiceRequestFailed_Body; + +typedef struct LDKEvent_LDKPaymentSent_Body { + /** + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKCOption_ThirtyTwoBytesZ payment_id; + /** + * The preimage to the hash given to ChannelManager::send_payment. + * Note that this serves as a payment receipt, if you wish to have such a thing, you must + * store it somehow! + */ + struct LDKThirtyTwoBytes payment_preimage; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The total fee which was spent at intermediate hops in this payment, across all paths. + * + * Note that, like [`Route::get_total_fees`] this does *not* include any potential + * overpayment to the recipient node. + * + * If the recipient or an intermediate node misbehaves and gives us free money, this may + * overstate the amount paid, though this is unlikely. + * + * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees + */ + struct LDKCOption_u64Z fee_paid_msat; +} LDKEvent_LDKPaymentSent_Body; + +typedef struct LDKEvent_LDKPaymentFailed_Body { + /** + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The reason the payment failed. This is only `None` for events generated or serialized + * by versions prior to 0.0.115. + */ + struct LDKCOption_PaymentFailureReasonZ reason; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { + /** + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * This will be `Some` for all payments which completed on LDK 0.0.104 or later. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKCOption_ThirtyTwoBytesZ payment_hash; + /** + * The payment path that was successful. + * + * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + */ + struct LDKPath path; +} LDKEvent_LDKPaymentPathSuccessful_Body; + +typedef struct LDKEvent_LDKPaymentPathFailed_Body { + /** + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + struct LDKCOption_ThirtyTwoBytesZ payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * Indicates the payment was rejected for some reason by the recipient. This implies that + * the payment has failed, not just the route in question. If this is not set, the payment may + * be retried via a different route. + */ + bool payment_failed_permanently; + /** + * Extra error details based on the failure type. May contain an update that needs to be + * applied to the [`NetworkGraph`]. + * + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + */ + struct LDKPathFailure failure; + /** + * The payment path that failed. + */ + struct LDKPath path; + /** + * The channel responsible for the failed payment path. + * + * Note that for route hints or for the first hop in a path this may be an SCID alias and + * may not refer to a channel in the public network graph. These aliases may also collide + * with channels in the public network graph. + * + * If this is `Some`, then the corresponding channel should be avoided when the payment is + * retried. May be `None` for older [`Event`] serializations. + */ + struct LDKCOption_u64Z short_channel_id; +} LDKEvent_LDKPaymentPathFailed_Body; + +typedef struct LDKEvent_LDKProbeSuccessful_Body { + /** + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The payment path that was successful. + */ + struct LDKPath path; +} LDKEvent_LDKProbeSuccessful_Body; + +typedef struct LDKEvent_LDKProbeFailed_Body { + /** + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The payment path that failed. + */ + struct LDKPath path; + /** + * The channel responsible for the failed probe. + * + * Note that for route hints or for the first hop in a path this may be an SCID alias and + * may not refer to a channel in the public network graph. These aliases may also collide + * with channels in the public network graph. + */ + struct LDKCOption_u64Z short_channel_id; +} LDKEvent_LDKProbeFailed_Body; + +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { + /** + * The minimum amount of time that should be waited prior to calling + * process_pending_htlc_forwards. To increase the effort required to correlate payments, + * you should wait a random amount of time in roughly the range (now + time_forwardable, + * now + 5*time_forwardable). + */ + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; + +typedef struct LDKEvent_LDKHTLCIntercepted_Body { + /** + * An id to help LDK identify which HTLC is being forwarded or failed. + */ + struct LDKThirtyTwoBytes intercept_id; + /** + * The fake scid that was programmed as the next hop's scid, generated using + * [`ChannelManager::get_intercept_scid`]. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + */ + uint64_t requested_next_hop_scid; + /** + * The payment hash used for this HTLC. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * How many msats were received on the inbound edge of this HTLC. + */ + uint64_t inbound_amount_msat; + /** + * How many msats the payer intended to route to the next node. Depending on the reason you are + * intercepting this payment, you might take a fee by forwarding less than this amount. + * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116. + * + * Note that LDK will NOT check that expected fees were factored into this value. You MUST + * check that whatever fee you want has been included here or subtract it as required. Further, + * LDK will not stop you from forwarding more than you received. + */ + uint64_t expected_outbound_amount_msat; +} LDKEvent_LDKHTLCIntercepted_Body; + +typedef struct LDKEvent_LDKSpendableOutputs_Body { + /** + * The outputs which you should store as spendable by you. + */ + struct LDKCVec_SpendableOutputDescriptorZ outputs; + /** + * The `channel_id` indicating which channel the spendable outputs belong to. + * + * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelId channel_id; +} LDKEvent_LDKSpendableOutputs_Body; + +typedef struct LDKEvent_LDKPaymentForwarded_Body { + /** + * The channel id of the incoming channel between the previous node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelId prev_channel_id; + /** + * The channel id of the outgoing channel between the next node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelId next_channel_id; + /** + * The `user_channel_id` of the incoming channel between the previous node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.122. + */ + struct LDKCOption_U128Z prev_user_channel_id; + /** + * The `user_channel_id` of the outgoing channel between the next node and us. + * + * This will be `None` if the payment was settled via an on-chain transaction. See the + * 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. + */ + struct LDKCOption_U128Z next_user_channel_id; + /** + * 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 + * was pending, the amount the next hop claimed will have been rounded down to the nearest + * whole satoshi. Thus, the fee calculated here may be higher than expected as we still + * claimed the full value in millisatoshis from the source. In this case, + * `claim_from_onchain_tx` will be set. + * + * If the channel which sent us the payment has been force-closed, we will claim the funds + * via an on-chain transaction. In that case we do not yet know the on-chain transaction + * fees which we will spend and will instead set this to `None`. It is possible duplicate + * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is + * `None`. + */ + struct LDKCOption_u64Z total_fee_earned_msat; + /** + * The share of the total fee, in milli-satoshis, which was withheld in addition to the + * forwarding fee. + * + * This will only be `Some` if we forwarded an intercepted HTLC with less than the + * expected amount. This means our counterparty accepted to receive less than the invoice + * amount, e.g., by claiming the payment featuring a corresponding + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]. + * + * Will also always be `None` for events serialized with LDK prior to version 0.0.122. + * + * The caveat described above the `total_fee_earned_msat` field applies here as well. + * + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat + */ + struct LDKCOption_u64Z skimmed_fee_msat; + /** + * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain + * transaction. + */ + bool claim_from_onchain_tx; + /** + * The final amount forwarded, in milli-satoshis, after the fee is deducted. + * + * The caveat described above the `total_fee_earned_msat` field applies here as well. + */ + struct LDKCOption_u64Z outbound_amount_forwarded_msat; +} LDKEvent_LDKPaymentForwarded_Body; + +typedef struct LDKEvent_LDKChannelPending_Body { + /** + * The `channel_id` of the channel that is pending confirmation. + */ + struct LDKChannelId channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; + /** + * The `temporary_channel_id` this channel used to be known by during channel establishment. + * + * Will be `None` for channels created prior to LDK version 0.0.115. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelId former_temporary_channel_id; + /** + * The `node_id` of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The outpoint of the channel's funding transaction. + */ + struct LDKOutPoint funding_txo; + /** + * The features that this channel will operate with. + * + * Will be `None` for channels created prior to LDK version 0.0.122. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKChannelPending_Body; + +typedef struct LDKEvent_LDKChannelReady_Body { + /** + * The `channel_id` of the channel that is ready. + */ + struct LDKChannelId channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; + /** + * The `node_id` of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The features that this channel will operate with. + */ + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKChannelReady_Body; + +typedef struct LDKEvent_LDKChannelClosed_Body { + /** + * The `channel_id` of the channel which has been closed. Note that on-chain transactions + * resolving the channel are likely still awaiting confirmation. + */ + struct LDKChannelId channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for inbound channels. + * This may be zero for inbound channels serialized prior to 0.0.113 and will always be + * zero for objects serialized with LDK versions prior to 0.0.102. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; + /** + * The reason the channel was closed. + */ + struct LDKClosureReason reason; + /** + * Counterparty in the closed channel. + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey counterparty_node_id; + /** + * Channel capacity of the closing channel (sats). + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + */ + struct LDKCOption_u64Z channel_capacity_sats; + /** + * The original channel funding TXO; this helps checking for the existence and confirmation + * status of the closing tx. + * Note that for instances serialized in v0.0.119 or prior this will be missing (None). + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOutPoint channel_funding_txo; +} LDKEvent_LDKChannelClosed_Body; + +typedef struct LDKEvent_LDKDiscardFunding_Body { + /** + * The channel_id of the channel which has been closed. + */ + struct LDKChannelId channel_id; + /** + * The full transaction received from the user + */ + struct LDKTransaction transaction; +} LDKEvent_LDKDiscardFunding_Body; + +typedef struct LDKEvent_LDKOpenChannelRequest_Body { + /** + * The temporary channel ID of the channel requested to be opened. + * + * When responding to the request, the `temporary_channel_id` should be passed + * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, + * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + */ + struct LDKChannelId temporary_channel_id; + /** + * The node_id of the counterparty requesting to open the channel. + * + * When responding to the request, the `counterparty_node_id` should be passed + * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to + * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the + * request. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + */ + struct LDKPublicKey counterparty_node_id; + /** + * The channel value of the requested channel. + */ + uint64_t funding_satoshis; + /** + * Our starting balance in the channel if the request is accepted, in milli-satoshi. + */ + uint64_t push_msat; + /** + * The features that this channel will operate with. If you reject the channel, a + * well-behaved counterparty may automatically re-attempt the channel with a new set of + * feature flags. + * + * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type, + * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to + * 0.0.106. + * + * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type, + * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to + * 0.0.107. Channels setting this type also need to get manually accepted via + * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`], + * or will be rejected otherwise. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKOpenChannelRequest_Body; + +typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { + /** + * The channel over which the HTLC was received. + */ + struct LDKChannelId prev_channel_id; + /** + * Destination of the HTLC that failed to be processed. + */ + struct LDKHTLCDestination failed_next_destination; +} LDKEvent_LDKHTLCHandlingFailed_Body; + typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { @@ -27745,27 +28107,6 @@ void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); */ struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); -/** - * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState - */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); - -/** - * Constructs a new COption_ChannelShutdownStateZ containing nothing - */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); - -/** - * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state - */ -void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); - -/** - * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); - /** * Creates a new CResult_ChannelIdAPIErrorZ in the success state. */ @@ -28141,84 +28482,6 @@ void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersM */ void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res); -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); - -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. - */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); - -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. - */ -void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. - */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. */ @@ -28349,32 +28612,6 @@ void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDec */ struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); - -/** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. - */ -void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -30832,6 +31069,287 @@ void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11Invo */ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_some(enum LDKInboundHTLCStateDetails o); + +/** + * Constructs a new COption_InboundHTLCStateDetailsZ containing nothing + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state + */ +void COption_InboundHTLCStateDetailsZ_free(struct LDKCOption_InboundHTLCStateDetailsZ _res); + +/** + * Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_clone(const struct LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_InboundHTLCStateDetailsZ o); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. + */ +void CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_ok(struct LDKInboundHTLCDetails o); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. + */ +void CResult_InboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_InboundHTLCDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_some(enum LDKOutboundHTLCStateDetails o); + +/** + * Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state + */ +void COption_OutboundHTLCStateDetailsZ_free(struct LDKCOption_OutboundHTLCStateDetailsZ _res); + +/** + * Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_clone(const struct LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_OutboundHTLCStateDetailsZ o); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. + */ +void CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_ok(struct LDKOutboundHTLCDetails o); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. + */ +void CResult_OutboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. + */ +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + */ +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); + +/** + * Constructs a new COption_ChannelShutdownStateZ containing nothing + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state + */ +void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); + +/** + * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_InboundHTLCDetailsZ_free(struct LDKCVec_InboundHTLCDetailsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_OutboundHTLCDetailsZ_free(struct LDKCVec_OutboundHTLCDetailsZ _res); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. + */ +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. + */ +void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -32970,6 +33488,11 @@ bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostna */ MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); +/** + * Get the string representation of a Hostname object + */ +struct LDKStr Hostname_to_str(const struct LDKHostname *NONNULL_PTR o); + /** * Serialize the Hostname object into a byte array which can be read by Hostname_read */ @@ -33225,6 +33748,11 @@ struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNUL */ struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); +/** + * Get the string representation of a UntrustedString object + */ +struct LDKStr UntrustedString_to_str(const struct LDKUntrustedString *NONNULL_PTR o); + /** * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. */ @@ -33239,6 +33767,11 @@ void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, stru */ MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); +/** + * Get the string representation of a PrintableString object + */ +struct LDKStr PrintableString_to_str(const struct LDKPrintableString *NONNULL_PTR o); + /** * Frees any resources used by the TrackedSpendableOutput, if is_owned is set and inner is non-NULL. */ @@ -33550,6 +34083,11 @@ bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_P */ uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); +/** + * Get the string representation of a Level object + */ +struct LDKStr Level_to_str(const enum LDKLevel *NONNULL_PTR o); + /** * Returns the most verbose logging level. */ @@ -35911,6 +36449,11 @@ bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoi */ uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); +/** + * Get the string representation of a OutPoint object + */ +struct LDKStr OutPoint_to_str(const struct LDKOutPoint *NONNULL_PTR o); + /** * Serialize the OutPoint object into a byte array which can be read by OutPoint_read */ @@ -36273,1866 +36816,2019 @@ void ChainParameters_free(struct LDKChainParameters this_obj); /** * The network for determining the `chain_hash` in Lightning messages. */ -enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); +enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); + +/** + * The network for determining the `chain_hash` in Lightning messages. + */ +void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); + +/** + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + */ +struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); + +/** + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + */ +void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); + +/** + * Constructs a new ChainParameters given each field + */ +MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); + +/** + * Creates a copy of the ChainParameters + */ +struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); + +/** + * Frees any resources used by the RecentPaymentDetails + */ +void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); + +/** + * Creates a copy of the RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); + +/** + * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); + +/** + * Utility method to constructs a new Pending-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); + +/** + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); + +/** + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); + +/** + * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. + */ +void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); + +/** + * The list of channels to be included in the invoice route hints. + */ +struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); + +/** + * The list of channels to be included in the invoice route hints. + */ +void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); + +/** + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. + */ +uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); + +/** + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. + */ +void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The pubkey of the real backing node that would ultimately receive the payment. + */ +struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); + +/** + * The pubkey of the real backing node that would ultimately receive the payment. + */ +void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new PhantomRouteHints given each field + */ +MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); + +/** + * Creates a copy of the PhantomRouteHints + */ +struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); + +/** + * Constructs a new `ChannelManager` to hold several channels and route between them. + * + * The current time or latest block header time can be provided as the `current_timestamp`. + * + * This is the main \"logic hub\" for all channel-related actions, and implements + * [`ChannelMessageHandler`]. + * + * Non-proportional fees are fixed according to our risk using the provided fee estimator. + * + * Users need to notify the new `ChannelManager` when a new block is connected or + * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting + * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for + * more details. + * + * [`block_connected`]: chain::Listen::block_connected + * [`block_disconnected`]: chain::Listen::block_disconnected + * [`params.best_block.block_hash`]: chain::BestBlock::block_hash + */ +MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params, uint32_t current_timestamp); + +/** + * Gets the current configuration applied to all new channels. + */ +MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Creates a new outbound channel to the given remote node and with the given value. + * + * `user_channel_id` will be provided back as in + * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a + * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it + * is simply copied to events and otherwise ignored. + * + * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is + * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. + * + * Note that we do not check if you are currently connected to the given peer. If no + * connection is available, the outbound `open_channel` message may fail to send, resulting in + * the channel eventually being silently forgotten (dropped on reload). + * + * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the + * channel. Otherwise, a random one will be generated for you. + * + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for + * one derived from the funding transaction's TXID. If the counterparty rejects the channel + * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. + * + * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id + * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id + * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id + * + * Note that temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKChannelId temporary_channel_id, struct LDKUserConfig override_config); + +/** + * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for + * more information. + */ +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Gets the list of usable channels, in random order. Useful as an argument to + * [`Router::find_route`] to ensure non-announced channels are used. + * + * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the + * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria + * are. + */ +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Gets the list of channels we have with a given counterparty, in random order. + */ +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); + +/** + * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a + * successful path, or have unresolved HTLCs. + * + * This can be useful for payments that may have been prepared, but ultimately not sent, as a + * result of a crash. If such a payment exists, is not listed here, and an + * [`Event::PaymentSent`] has not been received, you may consider resending the payment. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + */ +MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate. + * * If our counterparty is the channel initiator, we will require a channel closing + * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which + * would appear on a force-closure transaction, whichever is lower. We will allow our + * counterparty to pay as much fee as they'd like, however. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); + +/** + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated + * the channel being closed or not: + * * If we are the channel initiator, we will pay at least this feerate on the closing + * transaction. The upper-bound is set by + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * * If our counterparty is the channel initiator, we will refuse to accept a channel closure + * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which + * will appear on a force-closure transaction, whichever is lower). + * + * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. + * Will fail if a shutdown script has already been set for this channel by + * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must + * also be compatible with our and the counterparty's features. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + * + * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); + +/** + * Force closes a channel, immediately broadcasting the latest local transaction(s) and + * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to + * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding + * channel. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); + +/** + * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting + * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the + * `counterparty_node_id` isn't the counterparty of the corresponding channel. + * + * You can always broadcast the latest local transaction(s) via + * [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); + +/** + * Force close all channels, immediately broadcasting the latest local commitment transaction + * for each to the chain and rejecting new HTLCs on each. + */ +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Force close all channels rejecting new HTLCs on each but without broadcasting the latest + * local transaction(s). + */ +void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Sends a payment along a given route. + * + * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] + * fields for more info. + * + * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via + * [`PeerManager::process_events`]). + * + * # 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 + * second payment with the same [`PaymentId`]. + * + * Thus, in order to ensure duplicate payments are not sent, you should implement your own + * tracking of payments, including state to indicate once a payment has completed. Because you + * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should + * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the + * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. + * + * Additionally, in the scenario where we begin the process of sending a payment, but crash + * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're + * 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. + * + * 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, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * The network for determining the `chain_hash` in Lightning messages. + * 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`. */ -void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); +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); /** - * The hash and height of the latest block successfully connected. + * Signals that no further attempts for the given payment should occur. Useful if you have a + * pending outbound payment with retries remaining, but wish to stop retrying the payment before + * retries are exhausted. * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. - */ -struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); - -/** - * The hash and height of the latest block successfully connected. + * # Event Generation * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. - */ -void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); - -/** - * Constructs a new ChainParameters given each field + * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon + * as there are no remaining pending HTLCs for this payment. + * + * Note that calling this method does *not* prevent a payment from succeeding. You must still + * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to + * determine the ultimate status of a payment. + * + * # Requested Invoices + * + * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning + * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`] + * and prevent any attempts at paying it once received. The other events may only be generated + * once the invoice has been received. + * + * # Restart Behavior + * + * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for + * [`Event::InvoiceRequestFailed`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** - * Creates a copy of the ChainParameters + * Send a spontaneous payment, which is a payment that does not require the recipient to have + * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify + * the preimage, it must be a cryptographically secure random value that no intermediate node + * 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 */ -struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); +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); /** - * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. + * 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 [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous + * payments. + * + * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend */ -void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); +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); /** - * Base routing fee in millisatoshis. + * 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. */ -uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); /** - * Base routing fee in millisatoshis. + * Sends payment probes over all paths of a route that would be used to pay the given + * amount to the given `node_id`. + * + * See [`ChannelManager::send_preflight_probes`] for more information. */ -void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * Sends payment probes over all paths of a route that would be used to pay a route found + * according to the given [`RouteParameters`]. + * + * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting + * the actual payment. Note this is only useful if there likely is sufficient time for the + * probe to settle before sending out the actual payment, e.g., when waiting for user + * confirmation in a wallet UI. + * + * Otherwise, there is a chance the probe could take up some liquidity needed to complete the + * actual payment. Users should therefore be cautious and might avoid sending probes if + * liquidity is scarce and/or they don't expect the probe to return before they send the + * payment. To mitigate this issue, channels with available liquidity less than the required + * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight + * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. */ -uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * Call this upon creation of a funding transaction for the given channel. + * + * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs + * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. + * + * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation + * across the p2p network. + * + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. + * + * May panic if the output found in the funding transaction is duplicative with some other + * channel (note that this should be trivially prevented by using unique funding transaction + * keys per-channel). + * + * Do NOT broadcast the funding transaction yourself. When we have safely received our + * counterparty's signature the funding transaction will automatically be broadcast via the + * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. + * + * Note that this includes RBF or similar transaction replacement strategies - lightning does + * not currently support replacing a funding transaction on an existing channel. Instead, + * create a new channel with a conflicting funding transaction. + * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See + * for more details. + * + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed */ -void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * Call this upon creation of a batch funding transaction for the given channels. + * + * Return values are identical to [`Self::funding_transaction_generated`], respective to + * each individual channel and transaction output. + * + * Do NOT broadcast the funding transaction yourself. This batch funding transaction + * will only be broadcast when we have safely received and persisted the counterparty's + * signature for each channel. + * + * If there is an error, all channels in the batch are to be considered closed. */ -uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); /** - * Constructs a new CounterpartyForwardingInfo given each field + * Atomically updates the [`ChannelConfig`] for the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); /** - * Creates a copy of the CounterpartyForwardingInfo + * Attempts to forward an intercepted HTLC over the provided channel id and with the provided + * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. + * + * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time + * channel to a receiving node if the node lacks sufficient inbound liquidity. + * + * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use + * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the + * receiver's invoice route hints. These route hints will signal to LDK to generate an + * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. + * + * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop + * you from forwarding more than you received. See + * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount + * than expected. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat */ -struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); /** - * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. + * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to + * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted */ -void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); /** - * The node_id of our counterparty + * Processes HTLCs which are pending waiting on random forward delay. + * + * Should only really ever be called in response to a PendingHTLCsForwardable event. + * Will likely generate further events. */ -struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The node_id of our counterparty + * Performs actions which should happen on startup and roughly once per minute thereafter. + * + * This currently includes: + * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, + * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more + * than a minute, informing the network that they should no longer attempt to route over + * the channel. + * * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs + * with the current [`ChannelConfig`]. + * * Removing peers which have disconnected but and no longer have any channels. + * * Force-closing and removing channels which have not completed establishment in a timely manner. + * * 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`. + * + * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate + * estimate fetches. + * + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelConfig`]: crate::util::config::ChannelConfig */ -void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect + * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources + * along the path (including in our own channel on which we received it). + * + * Note that in some cases around unclean shutdown, it is possible the payment may have + * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a + * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment + * may have already been failed automatically by LDK if it was nearing its expiration time. + * + * While LDK will never claim a payment automatically on your behalf (i.e. without you calling + * [`ChannelManager::claim_funds`]), you should still monitor for + * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on + * startup during which time claims that were in-progress at shutdown may be replayed. */ -struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the + * reason for the failure. + * + * See [`FailureCode`] for valid failure codes. */ -void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any + * [`MessageSendEvent`]s needed to claim the payment. * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * This method is guaranteed to ensure the payment has been claimed but only if the current + * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race + * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment + * successful. It will generally be available in the next [`process_pending_events`] call. * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat - */ -uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); - -/** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. + * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or + * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` + * event matches your expectation. If you fail to do so and call this method, you may provide + * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * This function will fail the payment if it has custom TLVs with even type numbers, as we + * will assume they are unknown. If you intend to accept even custom TLVs, you should use + * [`claim_funds_with_known_custom_tlvs`]. * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline + * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed + * [`process_pending_events`]: EventsProvider::process_pending_events + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs */ -void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); +void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. + * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with + * even type numbers. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * # Note + * + * You MUST check you've understood all even TLVs before using this to + * claim, otherwise you may unintentionally agree to some protocol you do not understand. + * + * [`claim_funds`]: Self::claim_funds */ -struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Gets the node_id held by this ChannelManager */ -void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. + * + * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, + * and the `counterparty_node_id` parameter is the id of the peer which has requested to open + * the channel. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Note that this method will return an error and reject the channel, if it requires support + * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be + * used to accept such channels. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(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); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating + * it as confirmed immediately. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel + * and (if the counterparty agrees), enables forwarding of payments immediately. + * + * This fully trusts that the counterparty has honestly and correctly constructed the funding + * transaction and blindly assumes that it will eventually confirm. + * + * If it does not confirm before we decide to close the channel, or if the funding transaction + * does not pay to the correct script the correct amount, *you will lose funds*. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +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); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the + * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will + * not have an expiration unless otherwise set on the builder. + * + * # Privacy + * + * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the offer. + * However, if one is not found, uses a one-hop [`BlindedPath`] with + * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case, + * the node must be announced, otherwise, there is no way to find a path to the introduction in + * order to send the [`InvoiceRequest`]. + * + * Also, uses a derived signing pubkey in the offer for recipient privacy. + * + * # Limitations + * + * Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s + * reply path. + * + * # Errors + * + * Errors if the parameterized [`Router`] is unable to create a blinded path for the offer. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the + * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the refund. + * 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 + * block time minus two hours is used for the current time when determining if the refund has + * expired. + * + * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail + * with an [`Event::InvoiceRequestFailed`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Privacy + * + * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the refund. + * However, if one is not found, uses a one-hop [`BlindedPath`] with + * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case, + * the node must be announced, otherwise, there is no way to find a path to the introduction in + * order to send the [`Bolt12Invoice`]. + * + * Also, uses a derived payer id in the refund for payer privacy. + * + * # Limitations + * + * Requires a direct connection to an introduction node in the responding + * [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - `amount_msats` is invalid, or + * - the parameterized [`Router`] is unable to create a blinded path for the refund. + * + * [`Refund`]: crate::offers::refund::Refund + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); /** - * Constructs a new ChannelCounterparty given each field + * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and + * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual + * [`Bolt12Invoice`] once it is received. + * + * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by + * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. + * The optional parameters are used in the builder, if `Some`: + * - `quantity` for [`InvoiceRequest::quantity`] which must be set if + * [`Offer::expects_quantity`] is `true`. + * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and + * - `payer_note` for [`InvoiceRequest::payer_note`]. + * + * 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 + * + * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`] + * as the introduction node and a derived payer id for payer privacy. As such, currently, the + * node must be announced. Otherwise, there is no way to find a path to the introduction node + * in order to send the [`Bolt12Invoice`]. + * + * # 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 + * [`Bolt12Invoice::payment_paths`]. * - * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); - -/** - * Creates a copy of the ChannelCounterparty - */ -struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); - -/** - * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. - */ -void ChannelDetails_free(struct LDKChannelDetails this_obj); - -/** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - the provided parameters are invalid for the offer, + * - the offer is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice + * request. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note + * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion + * message. + * + * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a + * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding + * [`PaymentPreimage`]. It is returned purely for informational purposes. + * + * # 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. + * + * # Errors + * + * Errors if: + * - the refund is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for + * the invoice. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * Gets a payment secret and payment hash for use in an invoice given to a third party wishing + * to pay us. + * + * This differs from [`create_inbound_payment_for_hash`] only in that it generates the + * [`PaymentHash`] and [`PaymentPreimage`] for you. + * + * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`] event, which + * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. That + * should then be passed directly to [`claim_funds`]. + * + * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [`claim_funds`]: Self::claim_funds + * [`PaymentClaimable`]: events::Event::PaymentClaimable + * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose + * [`PaymentPurpose::preimage`]: events::PaymentPurpose::preimage + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is + * stored external to LDK. + * + * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a + * payment secret fetched via this method or [`create_inbound_payment`], and which is at least + * the `min_value_msat` provided here, if one is provided. + * + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. + * + * `min_value_msat` should be set if the invoice being generated contains a value. Any payment + * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` + * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the + * sender \"proof-of-payment\" unless they have paid the required amount. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. This should roughly match the expiry time set in the invoice. + * After this many seconds, we will remove the inbound payment, resulting in any attempts to + * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for + * invoices when no timeout is set. + * + * Note that we use block header time to time-out pending inbound payments (with some margin + * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will + * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. + * If you need exact expiry semantics, you should enforce them upon receipt of + * [`PaymentClaimable`]. + * + * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` + * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`PaymentClaimable`]: events::Event::PaymentClaimable */ -void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. + * Gets an LDK-generated payment preimage from a payment hash and payment secret that were + * previously returned from [`create_inbound_payment`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`create_inbound_payment`]: Self::create_inbound_payment */ -struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. + * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids + * are used when constructing the phantom invoice's route hints. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * [phantom node payments]: crate::sign::PhantomKeysManager */ -void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); +MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. + * Gets route hints for use in receiving [phantom node payments]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [phantom node payments]: crate::sign::PhantomKeysManager */ -struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. + * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are + * used when constructing the route hints for HTLCs intended to be intercepted. See + * [`ChannelManager::forward_intercepted_htlc`]. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that this method is not guaranteed to return unique values, you may need to call it a few + * times to get a unique scid. */ -void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. - * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. - * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * Gets inflight HTLC information by processing pending outbound payments that are in + * our channels. May be used during pathfinding to account for in-use channel liquidity. */ -struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. - * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. - * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is */ -struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. - * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. - * - * [`short_channel_id`]: Self::short_channel_id + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. + * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or + * may have events that need processing. * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. + * In order to check if this [`ChannelManager`] needs persisting, call + * [`Self::get_and_clear_needs_persistence`]. * - * [`short_channel_id`]: Self::short_channel_id + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`ChannelManager`] and should instead register actions to be taken later. */ -void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The value, in satoshis, of this channel as appears in the funding output + * Returns true if this [`ChannelManager`] needs to be persisted. + * + * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that + * indicates this should be checked. */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The value, in satoshis, of this channel as appears in the funding output + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * Fetches the set of [`NodeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects - * serialized with LDK versions prior to 0.0.113. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects - * serialized with LDK versions prior to 0.0.113. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); +MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The currently negotiated fee rate denominated in satoshi per 1000 weight units, - * which is applied to commitment and HTLC transactions. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The currently negotiated fee rate denominated in satoshi per 1000 weight units, - * which is applied to commitment and HTLC transactions. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is */ -void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * 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`] + * 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 */ -uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * 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`] + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); /** - * 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. + * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); /** - * 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. + * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read */ -uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * Read a BlindedForward from a byte array, created by BlindedForward_write */ -void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read */ -uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write */ -void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * Read a BlindedFailure from a byte array, created by BlindedFailure_write */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * A cryptographically secure source of entropy. */ -struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * A cryptographically secure source of entropy. */ -void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); /** - * True if the channel was initiated (and thus funded) by us. + * A signer that is able to perform node-scoped cryptographic operations. */ -bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * True if the channel was initiated (and thus funded) by us. + * A signer that is able to perform node-scoped cryptographic operations. */ -void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * The fee_estimator for use in the ChannelManager in the future. * - * Returns a copy of the field. + * No calls to the FeeEstimator will be made during deserialization. */ -struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * The chain::Watch for use in the ChannelManager in the future. * - * This is a strict superset of `is_channel_ready`. + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * The chain::Watch for use in the ChannelManager in the future. * - * This is a strict superset of `is_channel_ready`. + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** - * True if this channel is (or will be) publicly-announced. + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * True if this channel is (or will be) publicly-announced. + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** - * Creates a copy of the ChannelDetails + * Simple utility function to create a ChannelManagerReadArgs which creates the monitor + * HashMap for you. This is primarily useful for C bindings where it is not practical to + * populate a HashMap directly from C. */ -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); +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); /** - * Gets the current SCID which should be used to identify this channel for inbound payments. - * This should be used for providing invoice hints or in any other context where our - * counterparty will forward a payment to us. - * - * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the - * [`ChannelDetails::short_channel_id`]. See those for more information. + * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** - * Gets the current SCID which should be used to identify this channel for outbound payments. - * This should be used in [`Route`]s to describe the first hop or in other contexts where - * we're sending or forwarding a payment outbound over this channel. - * - * This is either the [`ChannelDetails::short_channel_id`], if set, or the - * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); + +struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); + +void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the ChannelShutdownState + * Constructs a new DelayedPaymentBasepoint given each field */ -enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); +MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); /** - * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState + * Checks if two DelayedPaymentBasepoints 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. */ -enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); +bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); /** - * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState + * Creates a copy of the DelayedPaymentBasepoint */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); +struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); /** - * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. */ -enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); +uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); /** - * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState + * Get inner Public Key */ -enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); +MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState + *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); +MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * Checks if two ChannelShutdownStates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read */ -bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); +struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); /** - * Frees any resources used by the RecentPaymentDetails + * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write */ -void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); /** - * Creates a copy of the RecentPaymentDetails + * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. */ -struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); +void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); + +struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); + +void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + * Constructs a new DelayedPaymentKey given each field */ -struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); /** - * Utility method to constructs a new Pending-variant RecentPaymentDetails + * Checks if two DelayedPaymentKeys 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. */ -struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); +bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); /** - * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails + * Creates a copy of the DelayedPaymentKey */ -struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); +struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); /** - * Utility method to constructs a new Abandoned-variant RecentPaymentDetails + *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. + *Build a delayedpubkey directly from an already-derived private key */ -void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); /** - * The list of channels to be included in the invoice route hints. + * Get inner Public Key */ -struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); /** - * The list of channels to be included in the invoice route hints. + * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read */ -void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); +struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write */ -uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. */ -void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); +void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); + +struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); + +void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Constructs a new HtlcBasepoint given each field */ -struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Checks if two HtlcBasepoints 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. */ -void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); /** - * Constructs a new PhantomRouteHints given each field + * Creates a copy of the HtlcBasepoint */ -MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); +struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); /** - * Creates a copy of the PhantomRouteHints + * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. */ -struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); +uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); /** - * Constructs a new `ChannelManager` to hold several channels and route between them. - * - * The current time or latest block header time can be provided as the `current_timestamp`. - * - * This is the main \"logic hub\" for all channel-related actions, and implements - * [`ChannelMessageHandler`]. - * - * Non-proportional fees are fixed according to our risk using the provided fee estimator. - * - * Users need to notify the new `ChannelManager` when a new block is connected or - * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting - * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for - * more details. - * - * [`block_connected`]: chain::Listen::block_connected - * [`block_disconnected`]: chain::Listen::block_disconnected - * [`params.best_block.block_hash`]: chain::BestBlock::block_hash + * Get inner Public Key */ -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 LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); /** - * Gets the current configuration applied to all new channels. + *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * Creates a new outbound channel to the given remote node and with the given value. - * - * `user_channel_id` will be provided back as in - * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events - * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a - * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it - * is simply copied to events and otherwise ignored. - * - * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is - * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. - * - * Note that we do not check if you are currently connected to the given peer. If no - * connection is available, the outbound `open_channel` message may fail to send, resulting in - * the channel eventually being silently forgotten (dropped on reload). - * - * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the - * channel. Otherwise, a random one will be generated for you. - * - * Returns the new Channel's temporary `channel_id`. This ID will appear as - * [`Event::FundingGenerationReady::temporary_channel_id`] and in - * [`ChannelDetails::channel_id`] until after - * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for - * one derived from the funding transaction's TXID. If the counterparty rejects the channel - * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. - * - * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id - * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id - * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id - * - * Note that temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read */ -MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKChannelId temporary_channel_id, struct LDKUserConfig override_config); +struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); /** - * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for - * more information. + * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); /** - * Gets the list of usable channels, in random order. Useful as an argument to - * [`Router::find_route`] to ensure non-announced channels are used. - * - * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the - * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria - * are. + * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +void HtlcKey_free(struct LDKHtlcKey this_obj); + +struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); + +void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Gets the list of channels we have with a given counterparty, in random order. + * Constructs a new HtlcKey given each field */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); +MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); /** - * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a - * successful path, or have unresolved HTLCs. - * - * This can be useful for payments that may have been prepared, but ultimately not sent, as a - * result of a crash. If such a payment exists, is not listed here, and an - * [`Event::PaymentSent`] has not been received, you may consider resending the payment. - * - * [`Event::PaymentSent`]: events::Event::PaymentSent + * Checks if two HtlcKeys 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. */ -MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); +bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] - * fee estimate. - * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which - * would appear on a force-closure transaction, whichever is lower. We will allow our - * counterparty to pay as much fee as they'd like, however. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + * Creates a copy of the HtlcKey */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); +struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated - * the channel being closed or not: - * * If we are the channel initiator, we will pay at least this feerate on the closing - * transaction. The upper-bound is set by - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] - * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). - * * If our counterparty is the channel initiator, we will refuse to accept a channel closure - * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which - * will appear on a force-closure transaction, whichever is lower). - * - * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. - * Will fail if a shutdown script has already been set for this channel by - * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must - * also be compatible with our and the counterparty's features. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown - * - * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None + *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Force closes a channel, immediately broadcasting the latest local transaction(s) and - * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to - * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding - * channel. + *Build a htlcpubkey directly from an already-derived private key */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); /** - * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting - * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the - * `counterparty_node_id` isn't the counterparty of the corresponding channel. - * - * You can always broadcast the latest local transaction(s) via - * [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. + * Get inner Public Key */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); +MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); /** - * Force close all channels, immediately broadcasting the latest local commitment transaction - * for each to the chain and rejecting new HTLCs on each. + * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read */ -void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); /** - * Force close all channels rejecting new HTLCs on each but without broadcasting the latest - * local transaction(s). + * Read a HtlcKey from a byte array, created by HtlcKey_write */ -void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); /** - * Sends a payment along a given route. - * - * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] - * fields for more info. - * - * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via - * [`PeerManager::process_events`]). - * - * # 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 - * second payment with the same [`PaymentId`]. - * - * Thus, in order to ensure duplicate payments are not sent, you should implement your own - * tracking of payments, including state to indicate once a payment has completed. Because you - * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should - * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the - * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. - * - * Additionally, in the scenario where we begin the process of sending a payment, but crash - * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're - * 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. - * - * 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! + * Adds a tweak to a public key to derive a new public key. * - * [`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 + * May panic if `tweak` is not the output of a SHA-256 hash. */ -MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]); + +/** + * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. + */ +void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); + +struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); + +void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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`. + * Constructs a new RevocationBasepoint given each field */ -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 LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); /** - * Signals that no further attempts for the given payment should occur. Useful if you have a - * pending outbound payment with retries remaining, but wish to stop retrying the payment before - * retries are exhausted. - * - * # Event Generation - * - * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon - * as there are no remaining pending HTLCs for this payment. - * - * Note that calling this method does *not* prevent a payment from succeeding. You must still - * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to - * determine the ultimate status of a payment. - * - * # Requested Invoices - * - * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning - * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`] - * and prevent any attempts at paying it once received. The other events may only be generated - * once the invoice has been received. - * - * # Restart Behavior - * - * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the - * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for - * [`Event::InvoiceRequestFailed`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Checks if two RevocationBasepoints 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. */ -void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); +bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); /** - * Send a spontaneous payment, which is a payment that does not require the recipient to have - * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify - * the preimage, it must be a cryptographically secure random value that no intermediate node - * 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 + * Creates a copy of the RevocationBasepoint */ -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); +struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); /** - * 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 [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous - * payments. - * - * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend + * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. */ -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); +uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); /** - * 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. + * Get inner Public Key */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); /** - * Sends payment probes over all paths of a route that would be used to pay the given - * amount to the given `node_id`. - * - * See [`ChannelManager::send_preflight_probes`] for more information. + * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); +struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); /** - * Sends payment probes over all paths of a route that would be used to pay a route found - * according to the given [`RouteParameters`]. - * - * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting - * the actual payment. Note this is only useful if there likely is sufficient time for the - * probe to settle before sending out the actual payment, e.g., when waiting for user - * confirmation in a wallet UI. - * - * Otherwise, there is a chance the probe could take up some liquidity needed to complete the - * actual payment. Users should therefore be cautious and might avoid sending probes if - * liquidity is scarce and/or they don't expect the probe to return before they send the - * payment. To mitigate this issue, channels with available liquidity less than the required - * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight - * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. + * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); +struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); /** - * Call this upon creation of a funding transaction for the given channel. - * - * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs - * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. - * - * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation - * across the p2p network. - * - * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided - * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. - * - * May panic if the output found in the funding transaction is duplicative with some other - * channel (note that this should be trivially prevented by using unique funding transaction - * keys per-channel). - * - * Do NOT broadcast the funding transaction yourself. When we have safely received our - * counterparty's signature the funding transaction will automatically be broadcast via the - * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. - * - * Note that this includes RBF or similar transaction replacement strategies - lightning does - * not currently support replacing a funding transaction on an existing channel. Instead, - * create a new channel with a conflicting funding transaction. - * - * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend - * the wallet software generating the funding transaction to apply anti-fee sniping as - * implemented by Bitcoin Core wallet. See - * for more details. - * - * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady - * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed + * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); +void RevocationKey_free(struct LDKRevocationKey this_obj); + +struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); + +void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Call this upon creation of a batch funding transaction for the given channels. - * - * Return values are identical to [`Self::funding_transaction_generated`], respective to - * each individual channel and transaction output. - * - * Do NOT broadcast the funding transaction yourself. This batch funding transaction - * will only be broadcast when we have safely received and persisted the counterparty's - * signature for each channel. - * - * If there is an error, all channels in the batch are to be considered closed. + * Constructs a new RevocationKey given each field */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); +MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); /** - * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. - * - * Once the updates are applied, each eligible channel (advertised with a known short channel - * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], - * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated - * containing the new [`ChannelUpdate`] message which should be broadcast to the network. - * - * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect - * `counterparty_node_id` is provided. - * - * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value - * below [`MIN_CLTV_EXPIRY_DELTA`]. - * - * If an error is returned, none of the updates should be considered applied. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths - * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat - * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta - * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelUnavailable`]: APIError::ChannelUnavailable - * [`APIMisuseError`]: APIError::APIMisuseError + * Checks if two RevocationKeys 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. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); +bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); /** - * Atomically updates the [`ChannelConfig`] for the given channels. - * - * Once the updates are applied, each eligible channel (advertised with a known short channel - * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], - * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated - * containing the new [`ChannelUpdate`] message which should be broadcast to the network. - * - * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect - * `counterparty_node_id` is provided. - * - * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value - * below [`MIN_CLTV_EXPIRY_DELTA`]. - * - * If an error is returned, none of the updates should be considered applied. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths - * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat - * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta - * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelUnavailable`]: APIError::ChannelUnavailable - * [`APIMisuseError`]: APIError::APIMisuseError + * Creates a copy of the RevocationKey */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); +struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); /** - * Attempts to forward an intercepted HTLC over the provided channel id and with the provided - * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. - * - * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time - * channel to a receiving node if the node lacks sufficient inbound liquidity. - * - * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use - * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the - * receiver's invoice route hints. These route hints will signal to LDK to generate an - * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or - * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. - * - * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop - * you from forwarding more than you received. See - * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount - * than expected. - * - * Errors if the event was not handled in time, in which case the HTLC was automatically failed - * backwards. - * - * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs - * [`HTLCIntercepted`]: events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat + * Generates a non-cryptographic 64-bit hash of the RevocationKey. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); +uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); /** - * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to - * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. + * Derives a per-commitment-transaction revocation public key from one party's per-commitment + * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of + * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public + * key instead of private keys. * - * Errors if the event was not handled in time, in which case the HTLC was automatically failed - * backwards. + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). * - * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); +MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Processes HTLCs which are pending waiting on random forward delay. - * - * Should only really ever be called in response to a PendingHTLCsForwardable event. - * Will likely generate further events. + * Get inner Public Key */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); /** - * Performs actions which should happen on startup and roughly once per minute thereafter. - * - * This currently includes: - * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, - * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more - * than a minute, informing the network that they should no longer attempt to route over - * the channel. - * * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs - * with the current [`ChannelConfig`]. - * * Removing peers which have disconnected but and no longer have any channels. - * * Force-closing and removing channels which have not completed establishment in a timely manner. - * * 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`. - * - * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate - * estimate fetches. - * - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelConfig`]: crate::util::config::ChannelConfig + * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read */ -void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); /** - * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect - * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources - * along the path (including in our own channel on which we received it). - * - * Note that in some cases around unclean shutdown, it is possible the payment may have - * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a - * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment - * may have already been failed automatically by LDK if it was nearing its expiration time. - * - * While LDK will never claim a payment automatically on your behalf (i.e. without you calling - * [`ChannelManager::claim_funds`]), you should still monitor for - * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on - * startup during which time claims that were in-progress at shutdown may be replayed. + * Read a RevocationKey from a byte array, created by RevocationKey_write */ -void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); /** - * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the - * reason for the failure. - * - * See [`FailureCode`] for valid failure codes. + * Creates a copy of the InboundHTLCStateDetails */ -void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_clone(const enum LDKInboundHTLCStateDetails *NONNULL_PTR orig); /** - * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any - * [`MessageSendEvent`]s needed to claim the payment. - * - * This method is guaranteed to ensure the payment has been claimed but only if the current - * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race - * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment - * successful. It will generally be available in the next [`process_pending_events`] call. - * - * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or - * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` - * event matches your expectation. If you fail to do so and call this method, you may provide - * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. - * - * This function will fail the payment if it has custom TLVs with even type numbers, as we - * will assume they are unknown. If you intend to accept even custom TLVs, you should use - * [`claim_funds_with_known_custom_tlvs`]. - * - * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable - * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline - * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed - * [`process_pending_events`]: EventsProvider::process_pending_events - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash - * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant InboundHTLCStateDetails */ -void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); /** - * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with - * even type numbers. - * - * # Note - * - * You MUST check you've understood all even TLVs before using this to - * claim, otherwise you may unintentionally agree to some protocol you do not understand. - * - * [`claim_funds`]: Self::claim_funds + * Utility method to constructs a new Committed-variant InboundHTLCStateDetails */ -void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_committed(void); /** - * Gets the node_id held by this ChannelManager + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFulfill-variant InboundHTLCStateDetails */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill(void); /** - * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. - * - * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, - * and the `counterparty_node_id` parameter is the id of the peer which has requested to open - * the channel. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Note that this method will return an error and reject the channel, if it requires support - * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be - * used to accept such channels. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFail-variant InboundHTLCStateDetails */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(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); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail(void); /** - * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating - * it as confirmed immediately. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel - * and (if the counterparty agrees), enables forwarding of payments immediately. - * - * This fully trusts that the counterparty has honestly and correctly constructed the funding - * transaction and blindly assumes that it will eventually confirm. - * - * If it does not confirm before we decide to close the channel, or if the funding transaction - * does not pay to the correct script the correct amount, *you will lose funds*. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * Serialize the InboundHTLCStateDetails object into a byte array which can be read by InboundHTLCStateDetails_read */ -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); +struct LDKCVec_u8Z InboundHTLCStateDetails_write(const enum LDKInboundHTLCStateDetails *NONNULL_PTR obj); /** - * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the - * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer will - * not have an expiration unless otherwise set on the builder. - * - * # Privacy - * - * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the offer. - * However, if one is not found, uses a one-hop [`BlindedPath`] with - * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case, - * the node must be announced, otherwise, there is no way to find a path to the introduction in - * order to send the [`InvoiceRequest`]. - * - * Also, uses a derived signing pubkey in the offer for recipient privacy. - * - * # Limitations - * - * Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s - * reply path. - * - * # Errors - * - * Errors if the parameterized [`Router`] is unable to create a blinded path for the offer. - * - * [`Offer`]: crate::offers::offer::Offer - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * Read a InboundHTLCStateDetails from a byte array, created by InboundHTLCStateDetails_write */ -MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ InboundHTLCStateDetails_read(struct LDKu8slice ser); /** - * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the - * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund. - * - * # Payment - * - * The provided `payment_id` is used to ensure that only one invoice is paid for the refund. - * 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 - * block time minus two hours is used for the current time when determining if the refund has - * expired. - * - * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the - * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail - * with an [`Event::InvoiceRequestFailed`]. - * - * If `max_total_routing_fee_msat` is not specified, The default from - * [`RouteParameters::from_payment_params_and_value`] is applied. - * - * # Privacy - * - * Uses [`MessageRouter::create_blinded_paths`] to construct a [`BlindedPath`] for the refund. - * However, if one is not found, uses a one-hop [`BlindedPath`] with - * [`ChannelManager::get_our_node_id`] as the introduction node instead. In the latter case, - * the node must be announced, otherwise, there is no way to find a path to the introduction in - * order to send the [`Bolt12Invoice`]. - * - * Also, uses a derived payer id in the refund for payer privacy. - * - * # Limitations - * - * Requires a direct connection to an introduction node in the responding - * [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if: - * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, - * - `amount_msats` is invalid, or - * - the parameterized [`Router`] is unable to create a blinded path for the refund. - * - * [`Refund`]: crate::offers::refund::Refund - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * Frees any resources used by the InboundHTLCDetails, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); +void InboundHTLCDetails_free(struct LDKInboundHTLCDetails this_obj); /** - * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and - * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual - * [`Bolt12Invoice`] once it is received. - * - * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by - * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. - * The optional parameters are used in the builder, if `Some`: - * - `quantity` for [`InvoiceRequest::quantity`] which must be set if - * [`Offer::expects_quantity`] is `true`. - * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and - * - `payer_note` for [`InvoiceRequest::payer_note`]. - * - * 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 - * - * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`] - * as the introduction node and a derived payer id for payer privacy. As such, currently, the - * node must be announced. Otherwise, there is no way to find a path to the introduction node - * in order to send the [`Bolt12Invoice`]. - * - * # 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 - * [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if: - * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, - * - the provided parameters are invalid for the offer, - * - the offer is for an unsupported chain, or - * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice - * request. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity - * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note - * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); +uint64_t InboundHTLCDetails_get_htlc_id(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion - * message. - * - * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a - * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding - * [`PaymentPreimage`]. It is returned purely for informational purposes. - * - * # 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. - * - * # Errors - * - * Errors if: - * - the refund is for an unsupported chain, or - * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for - * the invoice. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. + */ +void InboundHTLCDetails_set_htlc_id(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The amount in msat. */ -MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); +uint64_t InboundHTLCDetails_get_amount_msat(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Gets a payment secret and payment hash for use in an invoice given to a third party wishing - * to pay us. - * - * This differs from [`create_inbound_payment_for_hash`] only in that it generates the - * [`PaymentHash`] and [`PaymentPreimage`] for you. - * - * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`] event, which - * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. That - * should then be passed directly to [`claim_funds`]. - * - * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. - * - * Note that a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. - * - * # Note - * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. - * - * Errors if `min_value_msat` is greater than total bitcoin supply. - * - * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. - * - * [`claim_funds`]: Self::claim_funds - * [`PaymentClaimable`]: events::Event::PaymentClaimable - * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose - * [`PaymentPurpose::preimage`]: events::PaymentPurpose::preimage - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * The amount in msat. */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +void InboundHTLCDetails_set_amount_msat(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is - * stored external to LDK. - * - * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a - * payment secret fetched via this method or [`create_inbound_payment`], and which is at least - * the `min_value_msat` provided here, if one is provided. - * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though - * note that LDK will not stop you from registering duplicate payment hashes for inbound - * payments. + * The block height at which this HTLC expires. + */ +uint32_t InboundHTLCDetails_get_cltv_expiry(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); + +/** + * The block height at which this HTLC expires. + */ +void InboundHTLCDetails_set_cltv_expiry(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The payment hash. + */ +const uint8_t (*InboundHTLCDetails_get_payment_hash(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr))[32]; + +/** + * The payment hash. + */ +void InboundHTLCDetails_set_payment_hash(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The state of the HTLC in the state machine. * - * `min_value_msat` should be set if the invoice being generated contains a value. Any payment - * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the - * sender \"proof-of-payment\" unless they have paid the required amount. + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. This should roughly match the expiry time set in the invoice. - * After this many seconds, we will remove the inbound payment, resulting in any attempts to - * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for - * invoices when no timeout is set. + * See [`InboundHTLCStateDetails`] for information on the specific states. * - * Note that we use block header time to time-out pending inbound payments (with some margin - * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. - * If you need exact expiry semantics, you should enforce them upon receipt of - * [`PaymentClaimable`]. + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. + */ +struct LDKCOption_InboundHTLCStateDetailsZ InboundHTLCDetails_get_state(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); + +/** + * The state of the HTLC in the state machine. * - * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` - * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. * - * Note that a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * See [`InboundHTLCStateDetails`] for information on the specific states. * - * # Note + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. + */ +void InboundHTLCDetails_set_state(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_InboundHTLCStateDetailsZ val); + +/** + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. * - * Errors if `min_value_msat` is greater than total bitcoin supply. + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. + */ +bool InboundHTLCDetails_get_is_dust(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); + +/** + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. * - * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. * - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentClaimable`]: events::Event::PaymentClaimable + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); +void InboundHTLCDetails_set_is_dust(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * Gets an LDK-generated payment preimage from a payment hash and payment secret that were - * previously returned from [`create_inbound_payment`]. - * - * [`create_inbound_payment`]: Self::create_inbound_payment + * Constructs a new InboundHTLCDetails given each field */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKInboundHTLCDetails InboundHTLCDetails_new(uint64_t htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_InboundHTLCStateDetailsZ state_arg, bool is_dust_arg); /** - * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids - * are used when constructing the phantom invoice's route hints. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * Creates a copy of the InboundHTLCDetails */ -MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKInboundHTLCDetails InboundHTLCDetails_clone(const struct LDKInboundHTLCDetails *NONNULL_PTR orig); /** - * Gets route hints for use in receiving [phantom node payments]. + * Serialize the InboundHTLCDetails object into a byte array which can be read by InboundHTLCDetails_read + */ +struct LDKCVec_u8Z InboundHTLCDetails_write(const struct LDKInboundHTLCDetails *NONNULL_PTR obj); + +/** + * Read a InboundHTLCDetails from a byte array, created by InboundHTLCDetails_write + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ InboundHTLCDetails_read(struct LDKu8slice ser); + +/** + * Creates a copy of the OutboundHTLCStateDetails + */ +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_clone(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR orig); + +/** + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant OutboundHTLCStateDetails + */ +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); + +/** + * Utility method to constructs a new Committed-variant OutboundHTLCStateDetails + */ +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_committed(void); + +/** + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveSuccess-variant OutboundHTLCStateDetails + */ +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success(void); + +/** + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFailure-variant OutboundHTLCStateDetails + */ +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure(void); + +/** + * Serialize the OutboundHTLCStateDetails object into a byte array which can be read by OutboundHTLCStateDetails_read + */ +struct LDKCVec_u8Z OutboundHTLCStateDetails_write(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR obj); + +/** + * Read a OutboundHTLCStateDetails from a byte array, created by OutboundHTLCStateDetails_write + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ OutboundHTLCStateDetails_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the OutboundHTLCDetails, if is_owned is set and inner is non-NULL. + */ +void OutboundHTLCDetails_free(struct LDKOutboundHTLCDetails this_obj); + +/** + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. * - * [phantom node payments]: crate::sign::PhantomKeysManager + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCOption_u64Z OutboundHTLCDetails_get_htlc_id(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are - * used when constructing the route hints for HTLCs intended to be intercepted. See - * [`ChannelManager::forward_intercepted_htlc`]. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. * - * Note that this method is not guaranteed to return unique values, you may need to call it a few - * times to get a unique scid. + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_htlc_id(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Gets inflight HTLC information by processing pending outbound payments that are in - * our channels. May be used during pathfinding to account for in-use channel liquidity. + * The amount in msat. */ -MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t OutboundHTLCDetails_get_amount_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The amount in msat. */ -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_amount_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * The block height at which this HTLC expires. */ -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint32_t OutboundHTLCDetails_get_cltv_expiry(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * The block height at which this HTLC expires. */ -struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_cltv_expiry(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * The payment hash. */ -struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*OutboundHTLCDetails_get_payment_hash(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr))[32]; /** - * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or - * may have events that need processing. + * The payment hash. + */ +void OutboundHTLCDetails_set_payment_hash(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The state of the HTLC in the state machine. * - * In order to check if this [`ChannelManager`] needs persisting, call - * [`Self::get_and_clear_needs_persistence`]. + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. * - * Note that callbacks registered on the [`Future`] MUST NOT call back into this - * [`ChannelManager`] and should instead register actions to be taken later. + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCOption_OutboundHTLCStateDetailsZ OutboundHTLCDetails_get_state(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Returns true if this [`ChannelManager`] needs to be persisted. + * The state of the HTLC in the state machine. * - * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that - * indicates this should be checked. + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_state(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_OutboundHTLCStateDetailsZ val); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * The extra fee being skimmed off the top of this HTLC. */ -MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCOption_u64Z OutboundHTLCDetails_get_skimmed_fee_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Fetches the set of [`NodeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * The extra fee being skimmed off the top of this HTLC. */ -MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_skimmed_fee_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +bool OutboundHTLCDetails_get_is_dust(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +void OutboundHTLCDetails_set_is_dust(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Constructs a new OutboundHTLCDetails given each field */ -MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutboundHTLCDetails OutboundHTLCDetails_new(struct LDKCOption_u64Z htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_OutboundHTLCStateDetailsZ state_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, bool is_dust_arg); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * Creates a copy of the OutboundHTLCDetails */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKOutboundHTLCDetails OutboundHTLCDetails_clone(const struct LDKOutboundHTLCDetails *NONNULL_PTR orig); /** - * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read */ -struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_u8Z OutboundHTLCDetails_write(const struct LDKOutboundHTLCDetails *NONNULL_PTR obj); /** - * 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 + * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write */ -struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ OutboundHTLCDetails_read(struct LDKu8slice ser); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. */ -struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); +void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); + +/** + * Base routing fee in millisatoshis. + */ +uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); + +/** + * Base routing fee in millisatoshis. + */ +void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + */ +uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); + +/** + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + */ +void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. + */ +uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); + +/** + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. + */ +void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Constructs a new CounterpartyForwardingInfo given each field + */ +MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); + +/** + * Creates a copy of the CounterpartyForwardingInfo + */ +struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); /** * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read @@ -38145,542 +38841,766 @@ struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterparty struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); /** - * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read - */ -struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); - -/** - * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write + * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); +void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); /** - * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read + * The node_id of our counterparty */ -struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); +struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a ChannelDetails from a byte array, created by ChannelDetails_write + * The node_id of our counterparty */ -struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); +void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); +struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); +void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); +uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a BlindedForward from a byte array, created by BlindedForward_write + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); +void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); +struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); +void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); /** - * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); +void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Read a BlindedFailure from a byte array, created by BlindedFailure_write + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); +void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read + * Constructs a new ChannelCounterparty given each field + * + * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); /** - * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read + * Creates a copy of the ChannelCounterparty */ -struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); +struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); /** - * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write + * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); /** - * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. + * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write */ -void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); /** - * A cryptographically secure source of entropy. + * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. */ -const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_free(struct LDKChannelDetails this_obj); /** - * A cryptographically secure source of entropy. + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); +struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * A signer that is able to perform node-scoped cryptographic operations. + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * A signer that is able to perform node-scoped cryptographic operations. + * Parameters which apply to our counterparty. See individual fields for more information. */ -void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); +struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * Parameters which apply to our counterparty. See individual fields for more information. */ -const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); +struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The fee_estimator for use in the ChannelManager in the future. + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. * - * No calls to the FeeEstimator will be made during deserialization. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The fee_estimator for use in the ChannelManager in the future. + * The features which this channel operates with. See individual features for more info. * - * No calls to the FeeEstimator will be made during deserialization. + * `None` until negotiation completes and the channel type is finalized. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); +struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The chain::Watch for use in the ChannelManager in the future. + * The features which this channel operates with. See individual features for more info. * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * `None` until negotiation completes and the channel type is finalized. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The chain::Watch for use in the ChannelManager in the future. + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); +struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. + * + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). + * + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). * - * No calls to the router will be made during deserialization. + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required */ -const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. * - * No calls to the router will be made during deserialization. + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id */ -void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); +struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. + * + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The value, in satoshis, of this channel as appears in the funding output */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The value, in satoshis, of this channel as appears in the funding output */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); +struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Simple utility function to create a ChannelManagerReadArgs which creates the monitor - * HashMap for you. This is primarily useful for C bindings where it is not practical to - * populate a HashMap directly from C. + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -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); +void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ -void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); - -struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); - -void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); /** - * Constructs a new DelayedPaymentBasepoint given each field + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); +struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two DelayedPaymentBasepoints 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. + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); +void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a copy of the DelayedPaymentBasepoint + * 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`] */ -struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); +uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. + * 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 DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); +void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Get inner Public Key + * 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. */ -MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. + * 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. */ -MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ -struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); +uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ -struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); +void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); - -struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); - -void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new DelayedPaymentKey given each field + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); +void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two DelayedPaymentKeys 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. + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the DelayedPaymentKey + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - *Build a delayedpubkey directly from an already-derived private key + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Get inner Public Key + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. */ -MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. */ -struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); +struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); - -struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); - -void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Constructs a new HtlcBasepoint given each field + * True if the channel was initiated (and thus funded) by us. */ -MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); +bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two HtlcBasepoints 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. + * True if the channel was initiated (and thus funded) by us. */ -bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); +void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a copy of the HtlcBasepoint + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); +bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); +void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Get inner Public Key + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); +struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. */ -MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); +void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); /** - * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_channel_ready`. */ -struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); +bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_channel_ready`. */ -struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); +void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. + * True if this channel is (or will be) publicly-announced. */ -void HtlcKey_free(struct LDKHtlcKey this_obj); - -struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); - -void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new HtlcKey given each field + * True if this channel is (or will be) publicly-announced. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); +void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Checks if two HtlcKeys 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. + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the HtlcKey + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); +void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - *Build a htlcpubkey directly from an already-derived private key + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); +void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Get inner Public Key + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Read a HtlcKey from a byte array, created by HtlcKey_write + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); +struct LDKCVec_InboundHTLCDetailsZ ChannelDetails_get_pending_inbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Adds a tweak to a public key to derive a new public key. + * Pending inbound HTLCs. * - * May panic if `tweak` is not the output of a SHA-256 hash. + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]); +void ChannelDetails_set_pending_inbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_InboundHTLCDetailsZ val); /** - * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); - -struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); - -void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_OutboundHTLCDetailsZ ChannelDetails_get_pending_outbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new RevocationBasepoint given each field + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); +void ChannelDetails_set_pending_outbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_OutboundHTLCDetailsZ val); /** - * Checks if two RevocationBasepoints 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. + * Constructs a new ChannelDetails given each field + * + * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 */ -bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); +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_public_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 RevocationBasepoint + * Creates a copy of the ChannelDetails */ -struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. + * Gets the current SCID which should be used to identify this channel for inbound payments. + * This should be used for providing invoice hints or in any other context where our + * counterparty will forward a payment to us. + * + * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the + * [`ChannelDetails::short_channel_id`]. See those for more information. */ -uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Get inner Public Key + * Gets the current SCID which should be used to identify this channel for outbound payments. + * This should be used in [`Route`]s to describe the first hop or in other contexts where + * we're sending or forwarding a payment outbound over this channel. + * + * This is either the [`ChannelDetails::short_channel_id`], if set, or the + * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + * + * [`Route`]: crate::routing::router::Route */ -MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read + * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read */ -struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); /** - * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write + * Read a ChannelDetails from a byte array, created by ChannelDetails_write */ -struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); +struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); /** - * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelShutdownState */ -void RevocationKey_free(struct LDKRevocationKey this_obj); - -struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); - -void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); /** - * Constructs a new RevocationKey given each field + * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState */ -MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); +enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); /** - * Checks if two RevocationKeys 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. + * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState */ -bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); /** - * Creates a copy of the RevocationKey + * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState */ -struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); +enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); /** - * Generates a non-cryptographic 64-bit hash of the RevocationKey. + * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState */ -uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); +enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); /** - * Derives a per-commitment-transaction revocation public key from one party's per-commitment - * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of - * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public - * key instead of private keys. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). - * - * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key + * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState */ -MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); /** - * Get inner Public Key + * Checks if two ChannelShutdownStates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); +bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); /** - * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read + * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read */ -struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); /** - * Read a RevocationKey from a byte array, created by RevocationKey_write + * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write */ -struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); /** * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. @@ -41580,6 +42500,11 @@ uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NON */ bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); +/** + * Get the string representation of a SocketAddressParseError object + */ +struct LDKStr SocketAddressParseError_to_str(const enum LDKSocketAddressParseError *NONNULL_PTR o); + /** * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. * @@ -42860,6 +43785,11 @@ bool TrampolineOnionPacket_eq(const struct LDKTrampolineOnionPacket *NONNULL_PTR */ struct LDKCVec_u8Z TrampolineOnionPacket_write(const struct LDKTrampolineOnionPacket *NONNULL_PTR obj); +/** + * Get the string representation of a DecodeError object + */ +struct LDKStr DecodeError_to_str(const struct LDKDecodeError *NONNULL_PTR o); + /** * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ @@ -43625,6 +44555,11 @@ MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); */ struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); +/** + * Get the string representation of a PeerHandleError object + */ +struct LDKStr PeerHandleError_to_str(const struct LDKPeerHandleError *NONNULL_PTR o); + /** * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. */ @@ -46765,6 +47700,11 @@ MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LD */ MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +/** + * Get the string representation of a ShutdownScript object + */ +struct LDKStr ShutdownScript_to_str(const struct LDKShutdownScript *NONNULL_PTR o); + /** * Frees any resources used by the ChannelId, if is_owned is set and inner is non-NULL. */ @@ -46850,6 +47790,11 @@ 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); + /** * Frees any resources used by the Retry */ @@ -47564,6 +48509,11 @@ struct LDKQuantity Quantity_one(void); */ struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); +/** + * Get the string representation of a Offer object + */ +struct LDKStr Offer_to_str(const struct LDKOffer *NONNULL_PTR o); + /** * Frees any resources used by the InvoiceWithExplicitSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ @@ -48282,6 +49232,11 @@ struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NO */ MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); +/** + * Get the string representation of a InvoiceError object + */ +struct LDKStr InvoiceError_to_str(const struct LDKInvoiceError *NONNULL_PTR o); + /** * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read */ @@ -49388,6 +50343,11 @@ struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); */ struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s); +/** + * Get the string representation of a Refund object + */ +struct LDKStr Refund_to_str(const struct LDKRefund *NONNULL_PTR o); + /** * Creates a copy of the UtxoLookupError */ @@ -49508,6 +50468,11 @@ MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR */ MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); +/** + * Get the string representation of a NodeId object + */ +struct LDKStr NodeId_to_str(const struct LDKNodeId *NONNULL_PTR o); + /** * Generates a non-cryptographic 64-bit hash of the NodeId. */ @@ -49740,6 +50705,11 @@ struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdat */ bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); +/** + * Get the string representation of a ChannelUpdateInfo object + */ +struct LDKStr ChannelUpdateInfo_to_str(const struct LDKChannelUpdateInfo *NONNULL_PTR o); + /** * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read */ @@ -49862,6 +50832,11 @@ bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDK */ MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); +/** + * Get the string representation of a ChannelInfo object + */ +struct LDKStr ChannelInfo_to_str(const struct LDKChannelInfo *NONNULL_PTR o); + /** * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ @@ -50150,6 +51125,11 @@ uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o); */ bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); +/** + * Get the string representation of a NodeAlias object + */ +struct LDKStr NodeAlias_to_str(const struct LDKNodeAlias *NONNULL_PTR o); + /** * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read */ @@ -50219,6 +51199,11 @@ bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeIn */ MUST_USE_RES bool NodeInfo_is_tor_only(const struct LDKNodeInfo *NONNULL_PTR this_arg); +/** + * Get the string representation of a NodeInfo object + */ +struct LDKStr NodeInfo_to_str(const struct LDKNodeInfo *NONNULL_PTR o); + /** * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read */ @@ -50239,6 +51224,11 @@ struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR */ struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); +/** + * Get the string representation of a NetworkGraph object + */ +struct LDKStr NetworkGraph_to_str(const struct LDKNetworkGraph *NONNULL_PTR o); + /** * Creates a new, empty, network graph. */ @@ -50907,6 +51897,11 @@ MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR th */ MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); +/** + * Get the string representation of a Route object + */ +struct LDKStr Route_to_str(const struct LDKRoute *NONNULL_PTR o); + /** * Serialize the Route object into a byte array which can be read by Route_read */ @@ -54705,6 +55700,11 @@ struct LDKClosureReason ClosureReason_htlcs_timed_out(void); */ bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); +/** + * Get the string representation of a ClosureReason object + */ +struct LDKStr ClosureReason_to_str(const struct LDKClosureReason *NONNULL_PTR o); + /** * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read */ diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 0d43611..0f40b39 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -118,10 +118,6 @@ class BlindedFailure; class FailureCode; class ChannelManager; class ChainParameters; -class CounterpartyForwardingInfo; -class ChannelCounterparty; -class ChannelDetails; -class ChannelShutdownState; class RecentPaymentDetails; class PhantomRouteHints; class ChannelManagerReadArgs; @@ -229,6 +225,14 @@ class TrampolineOnionPacket; class Level; class Record; class Logger; +class InboundHTLCStateDetails; +class InboundHTLCDetails; +class OutboundHTLCStateDetails; +class OutboundHTLCDetails; +class CounterpartyForwardingInfo; +class ChannelCounterparty; +class ChannelDetails; +class ChannelShutdownState; class FutureCallback; class Future; class Sleeper; @@ -474,13 +478,15 @@ class CResult_PaymentFailureReasonDecodeErrorZ; class COption_SocketAddressZ; class CResult_COption_MonitorEventZDecodeErrorZ; class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; -class CResult_DescriptionCreationErrorZ; +class CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ; class CResult_RoutingFeesDecodeErrorZ; class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; +class CResult_DescriptionCreationErrorZ; class CResult_PaymentRelayDecodeErrorZ; class CResult_QueryShortChannelIdsDecodeErrorZ; class CResult_VerifiedInvoiceRequestNoneZ; class CResult_UpdateAddHTLCDecodeErrorZ; +class COption_OutboundHTLCStateDetailsZ; class COption_MonitorEventZ; class COption_TypeZ; class CResult_COption_TypeZDecodeErrorZ; @@ -524,6 +530,8 @@ class CVec_ECDSASignatureZ; class CResult_ChannelUpdateInfoDecodeErrorZ; class CVec_UpdateFailHTLCZ; class CVec_TxOutZ; +class CVec_InboundHTLCDetailsZ; +class CVec_OutboundHTLCDetailsZ; class CResult_BuiltCommitmentTransactionDecodeErrorZ; class CResult_TrackedSpendableOutputDecodeErrorZ; class CVec_SpendableOutputDescriptorZ; @@ -562,6 +570,7 @@ class COption_HTLCClaimZ; class COption_boolZ; class COption_StrZ; class CResult_ProbabilisticScorerDecodeErrorZ; +class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; class CResult_ShutdownScriptDecodeErrorZ; class CResult_SiPrefixBolt11ParseErrorZ; class C2Tuple_usizeTransactionZ; @@ -585,6 +594,7 @@ class CResult_FundingSignedDecodeErrorZ; class CResult_RecoverableSignatureNoneZ; class CResult_SocketAddressDecodeErrorZ; class C2Tuple_Z; +class CResult_InboundHTLCDetailsDecodeErrorZ; class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; class CVec_PathZ; class CResult_NetworkGraphDecodeErrorZ; @@ -632,9 +642,10 @@ class COption_ThirtyTwoBytesZ; class CVec_u64Z; class CResult_NoneBolt12SemanticErrorZ; class COption_SecretKeyZ; +class COption_InboundHTLCStateDetailsZ; class CResult_UnknownPaymentContextDecodeErrorZ; -class CResult_OutputSweeperDecodeErrorZ; class CResult_C2Tuple_CVec_u8Zu64ZNoneZ; +class CResult_OutputSweeperDecodeErrorZ; class COption_EventZ; class CResult_ChannelTypeFeaturesDecodeErrorZ; class COption_CVec_SocketAddressZZ; @@ -657,6 +668,7 @@ class CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ; class CResult_OnionMessagePathNoneZ; class C2Tuple_u32CVec_u8ZZ; class CVec_C2Tuple_PublicKeyTypeZZ; +class CResult_OutboundHTLCDetailsDecodeErrorZ; class CResult_RefundBolt12ParseErrorZ; class CResult_u32GraphSyncErrorZ; class CVec_C2Tuple_u64CVec_u8ZZZ; @@ -665,7 +677,7 @@ class CResult_OffersMessageDecodeErrorZ; class CResult_NoneAPIErrorZ; class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; class COption_f64Z; -class CResult_ChannelDetailsDecodeErrorZ; +class CResult_TxRemoveInputDecodeErrorZ; class CVec_PublicKeyZ; class C2Tuple_CVec_u8Zu64Z; class CVec_C2Tuple_usizeTransactionZZ; @@ -673,7 +685,7 @@ class CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; class CResult_PendingHTLCRoutingDecodeErrorZ; class C2Tuple_u64u64Z; class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; -class CResult_TxRemoveInputDecodeErrorZ; +class CResult_ChannelDetailsDecodeErrorZ; class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; class CResult_RecipientOnionFieldsDecodeErrorZ; class C2Tuple_u32TxOutZ; @@ -704,10 +716,10 @@ class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; class CResult_TransactionU16LenLimitedDecodeErrorZ; class COption_AmountZ; class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; -class CResult_CounterpartyForwardingInfoDecodeErrorZ; +class CResult_OpenChannelV2DecodeErrorZ; class CResult_BestBlockDecodeErrorZ; class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; -class CResult_OpenChannelV2DecodeErrorZ; +class CResult_CounterpartyForwardingInfoDecodeErrorZ; class CResult_OutputSpendStatusDecodeErrorZ; class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; class CResult_RouteDecodeErrorZ; @@ -2957,65 +2969,6 @@ public: const LDKChainParameters* operator &() const { return &self; } const LDKChainParameters* operator ->() const { return &self; } }; -class CounterpartyForwardingInfo { -private: - LDKCounterpartyForwardingInfo self; -public: - CounterpartyForwardingInfo(const CounterpartyForwardingInfo&) = delete; - CounterpartyForwardingInfo(CounterpartyForwardingInfo&& o) : self(o.self) { memset(&o, 0, sizeof(CounterpartyForwardingInfo)); } - CounterpartyForwardingInfo(LDKCounterpartyForwardingInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCounterpartyForwardingInfo)); } - operator LDKCounterpartyForwardingInfo() && { LDKCounterpartyForwardingInfo res = self; memset(&self, 0, sizeof(LDKCounterpartyForwardingInfo)); return res; } - ~CounterpartyForwardingInfo() { CounterpartyForwardingInfo_free(self); } - CounterpartyForwardingInfo& operator=(CounterpartyForwardingInfo&& o) { CounterpartyForwardingInfo_free(self); self = o.self; memset(&o, 0, sizeof(CounterpartyForwardingInfo)); return *this; } - LDKCounterpartyForwardingInfo* operator &() { return &self; } - LDKCounterpartyForwardingInfo* operator ->() { return &self; } - const LDKCounterpartyForwardingInfo* operator &() const { return &self; } - const LDKCounterpartyForwardingInfo* operator ->() const { return &self; } -}; -class ChannelCounterparty { -private: - LDKChannelCounterparty self; -public: - ChannelCounterparty(const ChannelCounterparty&) = delete; - ChannelCounterparty(ChannelCounterparty&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelCounterparty)); } - ChannelCounterparty(LDKChannelCounterparty&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelCounterparty)); } - operator LDKChannelCounterparty() && { LDKChannelCounterparty res = self; memset(&self, 0, sizeof(LDKChannelCounterparty)); return res; } - ~ChannelCounterparty() { ChannelCounterparty_free(self); } - ChannelCounterparty& operator=(ChannelCounterparty&& o) { ChannelCounterparty_free(self); self = o.self; memset(&o, 0, sizeof(ChannelCounterparty)); return *this; } - LDKChannelCounterparty* operator &() { return &self; } - LDKChannelCounterparty* operator ->() { return &self; } - const LDKChannelCounterparty* operator &() const { return &self; } - const LDKChannelCounterparty* operator ->() const { return &self; } -}; -class ChannelDetails { -private: - LDKChannelDetails self; -public: - ChannelDetails(const ChannelDetails&) = delete; - ChannelDetails(ChannelDetails&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelDetails)); } - ChannelDetails(LDKChannelDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelDetails)); } - operator LDKChannelDetails() && { LDKChannelDetails res = self; memset(&self, 0, sizeof(LDKChannelDetails)); return res; } - ~ChannelDetails() { ChannelDetails_free(self); } - ChannelDetails& operator=(ChannelDetails&& o) { ChannelDetails_free(self); self = o.self; memset(&o, 0, sizeof(ChannelDetails)); return *this; } - LDKChannelDetails* operator &() { return &self; } - LDKChannelDetails* operator ->() { return &self; } - const LDKChannelDetails* operator &() const { return &self; } - const LDKChannelDetails* operator ->() const { return &self; } -}; -class ChannelShutdownState { -private: - LDKChannelShutdownState self; -public: - ChannelShutdownState(const ChannelShutdownState&) = delete; - ChannelShutdownState(ChannelShutdownState&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelShutdownState)); } - ChannelShutdownState(LDKChannelShutdownState&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelShutdownState)); } - operator LDKChannelShutdownState() && { LDKChannelShutdownState res = self; memset(&self, 0, sizeof(LDKChannelShutdownState)); return res; } - ChannelShutdownState& operator=(ChannelShutdownState&& o) { self = o.self; memset(&o, 0, sizeof(ChannelShutdownState)); return *this; } - LDKChannelShutdownState* operator &() { return &self; } - LDKChannelShutdownState* operator ->() { return &self; } - const LDKChannelShutdownState* operator &() const { return &self; } - const LDKChannelShutdownState* operator ->() const { return &self; } -}; class RecentPaymentDetails { private: LDKRecentPaymentDetails self; @@ -5204,6 +5157,123 @@ public: */ inline void log(struct LDKRecord record); }; +class InboundHTLCStateDetails { +private: + LDKInboundHTLCStateDetails self; +public: + InboundHTLCStateDetails(const InboundHTLCStateDetails&) = delete; + InboundHTLCStateDetails(InboundHTLCStateDetails&& o) : self(o.self) { memset(&o, 0, sizeof(InboundHTLCStateDetails)); } + InboundHTLCStateDetails(LDKInboundHTLCStateDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInboundHTLCStateDetails)); } + operator LDKInboundHTLCStateDetails() && { LDKInboundHTLCStateDetails res = self; memset(&self, 0, sizeof(LDKInboundHTLCStateDetails)); return res; } + InboundHTLCStateDetails& operator=(InboundHTLCStateDetails&& o) { self = o.self; memset(&o, 0, sizeof(InboundHTLCStateDetails)); return *this; } + LDKInboundHTLCStateDetails* operator &() { return &self; } + LDKInboundHTLCStateDetails* operator ->() { return &self; } + const LDKInboundHTLCStateDetails* operator &() const { return &self; } + const LDKInboundHTLCStateDetails* operator ->() const { return &self; } +}; +class InboundHTLCDetails { +private: + LDKInboundHTLCDetails self; +public: + InboundHTLCDetails(const InboundHTLCDetails&) = delete; + InboundHTLCDetails(InboundHTLCDetails&& o) : self(o.self) { memset(&o, 0, sizeof(InboundHTLCDetails)); } + InboundHTLCDetails(LDKInboundHTLCDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInboundHTLCDetails)); } + operator LDKInboundHTLCDetails() && { LDKInboundHTLCDetails res = self; memset(&self, 0, sizeof(LDKInboundHTLCDetails)); return res; } + ~InboundHTLCDetails() { InboundHTLCDetails_free(self); } + InboundHTLCDetails& operator=(InboundHTLCDetails&& o) { InboundHTLCDetails_free(self); self = o.self; memset(&o, 0, sizeof(InboundHTLCDetails)); return *this; } + LDKInboundHTLCDetails* operator &() { return &self; } + LDKInboundHTLCDetails* operator ->() { return &self; } + const LDKInboundHTLCDetails* operator &() const { return &self; } + const LDKInboundHTLCDetails* operator ->() const { return &self; } +}; +class OutboundHTLCStateDetails { +private: + LDKOutboundHTLCStateDetails self; +public: + OutboundHTLCStateDetails(const OutboundHTLCStateDetails&) = delete; + OutboundHTLCStateDetails(OutboundHTLCStateDetails&& o) : self(o.self) { memset(&o, 0, sizeof(OutboundHTLCStateDetails)); } + OutboundHTLCStateDetails(LDKOutboundHTLCStateDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOutboundHTLCStateDetails)); } + operator LDKOutboundHTLCStateDetails() && { LDKOutboundHTLCStateDetails res = self; memset(&self, 0, sizeof(LDKOutboundHTLCStateDetails)); return res; } + OutboundHTLCStateDetails& operator=(OutboundHTLCStateDetails&& o) { self = o.self; memset(&o, 0, sizeof(OutboundHTLCStateDetails)); return *this; } + LDKOutboundHTLCStateDetails* operator &() { return &self; } + LDKOutboundHTLCStateDetails* operator ->() { return &self; } + const LDKOutboundHTLCStateDetails* operator &() const { return &self; } + const LDKOutboundHTLCStateDetails* operator ->() const { return &self; } +}; +class OutboundHTLCDetails { +private: + LDKOutboundHTLCDetails self; +public: + OutboundHTLCDetails(const OutboundHTLCDetails&) = delete; + OutboundHTLCDetails(OutboundHTLCDetails&& o) : self(o.self) { memset(&o, 0, sizeof(OutboundHTLCDetails)); } + OutboundHTLCDetails(LDKOutboundHTLCDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOutboundHTLCDetails)); } + operator LDKOutboundHTLCDetails() && { LDKOutboundHTLCDetails res = self; memset(&self, 0, sizeof(LDKOutboundHTLCDetails)); return res; } + ~OutboundHTLCDetails() { OutboundHTLCDetails_free(self); } + OutboundHTLCDetails& operator=(OutboundHTLCDetails&& o) { OutboundHTLCDetails_free(self); self = o.self; memset(&o, 0, sizeof(OutboundHTLCDetails)); return *this; } + LDKOutboundHTLCDetails* operator &() { return &self; } + LDKOutboundHTLCDetails* operator ->() { return &self; } + const LDKOutboundHTLCDetails* operator &() const { return &self; } + const LDKOutboundHTLCDetails* operator ->() const { return &self; } +}; +class CounterpartyForwardingInfo { +private: + LDKCounterpartyForwardingInfo self; +public: + CounterpartyForwardingInfo(const CounterpartyForwardingInfo&) = delete; + CounterpartyForwardingInfo(CounterpartyForwardingInfo&& o) : self(o.self) { memset(&o, 0, sizeof(CounterpartyForwardingInfo)); } + CounterpartyForwardingInfo(LDKCounterpartyForwardingInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCounterpartyForwardingInfo)); } + operator LDKCounterpartyForwardingInfo() && { LDKCounterpartyForwardingInfo res = self; memset(&self, 0, sizeof(LDKCounterpartyForwardingInfo)); return res; } + ~CounterpartyForwardingInfo() { CounterpartyForwardingInfo_free(self); } + CounterpartyForwardingInfo& operator=(CounterpartyForwardingInfo&& o) { CounterpartyForwardingInfo_free(self); self = o.self; memset(&o, 0, sizeof(CounterpartyForwardingInfo)); return *this; } + LDKCounterpartyForwardingInfo* operator &() { return &self; } + LDKCounterpartyForwardingInfo* operator ->() { return &self; } + const LDKCounterpartyForwardingInfo* operator &() const { return &self; } + const LDKCounterpartyForwardingInfo* operator ->() const { return &self; } +}; +class ChannelCounterparty { +private: + LDKChannelCounterparty self; +public: + ChannelCounterparty(const ChannelCounterparty&) = delete; + ChannelCounterparty(ChannelCounterparty&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelCounterparty)); } + ChannelCounterparty(LDKChannelCounterparty&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelCounterparty)); } + operator LDKChannelCounterparty() && { LDKChannelCounterparty res = self; memset(&self, 0, sizeof(LDKChannelCounterparty)); return res; } + ~ChannelCounterparty() { ChannelCounterparty_free(self); } + ChannelCounterparty& operator=(ChannelCounterparty&& o) { ChannelCounterparty_free(self); self = o.self; memset(&o, 0, sizeof(ChannelCounterparty)); return *this; } + LDKChannelCounterparty* operator &() { return &self; } + LDKChannelCounterparty* operator ->() { return &self; } + const LDKChannelCounterparty* operator &() const { return &self; } + const LDKChannelCounterparty* operator ->() const { return &self; } +}; +class ChannelDetails { +private: + LDKChannelDetails self; +public: + ChannelDetails(const ChannelDetails&) = delete; + ChannelDetails(ChannelDetails&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelDetails)); } + ChannelDetails(LDKChannelDetails&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelDetails)); } + operator LDKChannelDetails() && { LDKChannelDetails res = self; memset(&self, 0, sizeof(LDKChannelDetails)); return res; } + ~ChannelDetails() { ChannelDetails_free(self); } + ChannelDetails& operator=(ChannelDetails&& o) { ChannelDetails_free(self); self = o.self; memset(&o, 0, sizeof(ChannelDetails)); return *this; } + LDKChannelDetails* operator &() { return &self; } + LDKChannelDetails* operator ->() { return &self; } + const LDKChannelDetails* operator &() const { return &self; } + const LDKChannelDetails* operator ->() const { return &self; } +}; +class ChannelShutdownState { +private: + LDKChannelShutdownState self; +public: + ChannelShutdownState(const ChannelShutdownState&) = delete; + ChannelShutdownState(ChannelShutdownState&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelShutdownState)); } + ChannelShutdownState(LDKChannelShutdownState&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelShutdownState)); } + operator LDKChannelShutdownState() && { LDKChannelShutdownState res = self; memset(&self, 0, sizeof(LDKChannelShutdownState)); return res; } + ChannelShutdownState& operator=(ChannelShutdownState&& o) { self = o.self; memset(&o, 0, sizeof(ChannelShutdownState)); return *this; } + LDKChannelShutdownState* operator &() { return &self; } + LDKChannelShutdownState* operator ->() { return &self; } + const LDKChannelShutdownState* operator &() const { return &self; } + const LDKChannelShutdownState* operator ->() const { return &self; } +}; class FutureCallback { private: LDKFutureCallback self; @@ -9065,20 +9135,20 @@ public: const LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator &() const { return &self; } const LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ* operator ->() const { return &self; } }; -class CResult_DescriptionCreationErrorZ { +class CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { private: - LDKCResult_DescriptionCreationErrorZ self; + LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ self; public: - CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; - CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } - CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } - operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } - ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } - CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } - LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } - LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ(const CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ&) = delete; + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ(CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ)); } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ)); } + operator LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ() && { LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ)); return res; } + ~CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ() { CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(self); } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ& operator=(CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ&& o) { CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ)); return *this; } + LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator ->() const { return &self; } }; class CResult_RoutingFeesDecodeErrorZ { private: @@ -9110,6 +9180,21 @@ public: const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator ->() const { return &self; } }; +class CResult_DescriptionCreationErrorZ { +private: + LDKCResult_DescriptionCreationErrorZ self; +public: + CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; + CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } + CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } + operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } + ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } + CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } + LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } + LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } +}; class CResult_PaymentRelayDecodeErrorZ { private: LDKCResult_PaymentRelayDecodeErrorZ self; @@ -9170,6 +9255,21 @@ public: const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } }; +class COption_OutboundHTLCStateDetailsZ { +private: + LDKCOption_OutboundHTLCStateDetailsZ self; +public: + COption_OutboundHTLCStateDetailsZ(const COption_OutboundHTLCStateDetailsZ&) = delete; + COption_OutboundHTLCStateDetailsZ(COption_OutboundHTLCStateDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_OutboundHTLCStateDetailsZ)); } + COption_OutboundHTLCStateDetailsZ(LDKCOption_OutboundHTLCStateDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_OutboundHTLCStateDetailsZ)); } + operator LDKCOption_OutboundHTLCStateDetailsZ() && { LDKCOption_OutboundHTLCStateDetailsZ res = self; memset(&self, 0, sizeof(LDKCOption_OutboundHTLCStateDetailsZ)); return res; } + ~COption_OutboundHTLCStateDetailsZ() { COption_OutboundHTLCStateDetailsZ_free(self); } + COption_OutboundHTLCStateDetailsZ& operator=(COption_OutboundHTLCStateDetailsZ&& o) { COption_OutboundHTLCStateDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_OutboundHTLCStateDetailsZ)); return *this; } + LDKCOption_OutboundHTLCStateDetailsZ* operator &() { return &self; } + LDKCOption_OutboundHTLCStateDetailsZ* operator ->() { return &self; } + const LDKCOption_OutboundHTLCStateDetailsZ* operator &() const { return &self; } + const LDKCOption_OutboundHTLCStateDetailsZ* operator ->() const { return &self; } +}; class COption_MonitorEventZ { private: LDKCOption_MonitorEventZ self; @@ -9815,6 +9915,36 @@ public: const LDKCVec_TxOutZ* operator &() const { return &self; } const LDKCVec_TxOutZ* operator ->() const { return &self; } }; +class CVec_InboundHTLCDetailsZ { +private: + LDKCVec_InboundHTLCDetailsZ self; +public: + CVec_InboundHTLCDetailsZ(const CVec_InboundHTLCDetailsZ&) = delete; + CVec_InboundHTLCDetailsZ(CVec_InboundHTLCDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_InboundHTLCDetailsZ)); } + CVec_InboundHTLCDetailsZ(LDKCVec_InboundHTLCDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_InboundHTLCDetailsZ)); } + operator LDKCVec_InboundHTLCDetailsZ() && { LDKCVec_InboundHTLCDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_InboundHTLCDetailsZ)); return res; } + ~CVec_InboundHTLCDetailsZ() { CVec_InboundHTLCDetailsZ_free(self); } + CVec_InboundHTLCDetailsZ& operator=(CVec_InboundHTLCDetailsZ&& o) { CVec_InboundHTLCDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_InboundHTLCDetailsZ)); return *this; } + LDKCVec_InboundHTLCDetailsZ* operator &() { return &self; } + LDKCVec_InboundHTLCDetailsZ* operator ->() { return &self; } + const LDKCVec_InboundHTLCDetailsZ* operator &() const { return &self; } + const LDKCVec_InboundHTLCDetailsZ* operator ->() const { return &self; } +}; +class CVec_OutboundHTLCDetailsZ { +private: + LDKCVec_OutboundHTLCDetailsZ self; +public: + CVec_OutboundHTLCDetailsZ(const CVec_OutboundHTLCDetailsZ&) = delete; + CVec_OutboundHTLCDetailsZ(CVec_OutboundHTLCDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_OutboundHTLCDetailsZ)); } + CVec_OutboundHTLCDetailsZ(LDKCVec_OutboundHTLCDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_OutboundHTLCDetailsZ)); } + operator LDKCVec_OutboundHTLCDetailsZ() && { LDKCVec_OutboundHTLCDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_OutboundHTLCDetailsZ)); return res; } + ~CVec_OutboundHTLCDetailsZ() { CVec_OutboundHTLCDetailsZ_free(self); } + CVec_OutboundHTLCDetailsZ& operator=(CVec_OutboundHTLCDetailsZ&& o) { CVec_OutboundHTLCDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_OutboundHTLCDetailsZ)); return *this; } + LDKCVec_OutboundHTLCDetailsZ* operator &() { return &self; } + LDKCVec_OutboundHTLCDetailsZ* operator ->() { return &self; } + const LDKCVec_OutboundHTLCDetailsZ* operator &() const { return &self; } + const LDKCVec_OutboundHTLCDetailsZ* operator ->() const { return &self; } +}; class CResult_BuiltCommitmentTransactionDecodeErrorZ { private: LDKCResult_BuiltCommitmentTransactionDecodeErrorZ self; @@ -10385,6 +10515,21 @@ public: const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ProbabilisticScorerDecodeErrorZ* 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 CResult_ShutdownScriptDecodeErrorZ { private: LDKCResult_ShutdownScriptDecodeErrorZ self; @@ -10730,6 +10875,21 @@ public: const LDKC2Tuple_Z* operator &() const { return &self; } const LDKC2Tuple_Z* operator ->() const { return &self; } }; +class CResult_InboundHTLCDetailsDecodeErrorZ { +private: + LDKCResult_InboundHTLCDetailsDecodeErrorZ self; +public: + CResult_InboundHTLCDetailsDecodeErrorZ(const CResult_InboundHTLCDetailsDecodeErrorZ&) = delete; + CResult_InboundHTLCDetailsDecodeErrorZ(CResult_InboundHTLCDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); } + CResult_InboundHTLCDetailsDecodeErrorZ(LDKCResult_InboundHTLCDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); } + operator LDKCResult_InboundHTLCDetailsDecodeErrorZ() && { LDKCResult_InboundHTLCDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); return res; } + ~CResult_InboundHTLCDetailsDecodeErrorZ() { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); } + CResult_InboundHTLCDetailsDecodeErrorZ& operator=(CResult_InboundHTLCDetailsDecodeErrorZ&& o) { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); return *this; } + LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() { return &self; } + LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } +}; class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { private: LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ self; @@ -11435,6 +11595,21 @@ public: const LDKCOption_SecretKeyZ* operator &() const { return &self; } const LDKCOption_SecretKeyZ* operator ->() const { return &self; } }; +class COption_InboundHTLCStateDetailsZ { +private: + LDKCOption_InboundHTLCStateDetailsZ self; +public: + COption_InboundHTLCStateDetailsZ(const COption_InboundHTLCStateDetailsZ&) = delete; + COption_InboundHTLCStateDetailsZ(COption_InboundHTLCStateDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); } + COption_InboundHTLCStateDetailsZ(LDKCOption_InboundHTLCStateDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); } + operator LDKCOption_InboundHTLCStateDetailsZ() && { LDKCOption_InboundHTLCStateDetailsZ res = self; memset(&self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); return res; } + ~COption_InboundHTLCStateDetailsZ() { COption_InboundHTLCStateDetailsZ_free(self); } + COption_InboundHTLCStateDetailsZ& operator=(COption_InboundHTLCStateDetailsZ&& o) { COption_InboundHTLCStateDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); return *this; } + LDKCOption_InboundHTLCStateDetailsZ* operator &() { return &self; } + LDKCOption_InboundHTLCStateDetailsZ* operator ->() { return &self; } + const LDKCOption_InboundHTLCStateDetailsZ* operator &() const { return &self; } + const LDKCOption_InboundHTLCStateDetailsZ* operator ->() const { return &self; } +}; class CResult_UnknownPaymentContextDecodeErrorZ { private: LDKCResult_UnknownPaymentContextDecodeErrorZ self; @@ -11450,21 +11625,6 @@ public: const LDKCResult_UnknownPaymentContextDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UnknownPaymentContextDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_OutputSweeperDecodeErrorZ { -private: - LDKCResult_OutputSweeperDecodeErrorZ self; -public: - CResult_OutputSweeperDecodeErrorZ(const CResult_OutputSweeperDecodeErrorZ&) = delete; - CResult_OutputSweeperDecodeErrorZ(CResult_OutputSweeperDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); } - CResult_OutputSweeperDecodeErrorZ(LDKCResult_OutputSweeperDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); } - operator LDKCResult_OutputSweeperDecodeErrorZ() && { LDKCResult_OutputSweeperDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); return res; } - ~CResult_OutputSweeperDecodeErrorZ() { CResult_OutputSweeperDecodeErrorZ_free(self); } - CResult_OutputSweeperDecodeErrorZ& operator=(CResult_OutputSweeperDecodeErrorZ&& o) { CResult_OutputSweeperDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); return *this; } - LDKCResult_OutputSweeperDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutputSweeperDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutputSweeperDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutputSweeperDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_C2Tuple_CVec_u8Zu64ZNoneZ { private: LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ self; @@ -11480,6 +11640,21 @@ public: const LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* operator ->() const { return &self; } }; +class CResult_OutputSweeperDecodeErrorZ { +private: + LDKCResult_OutputSweeperDecodeErrorZ self; +public: + CResult_OutputSweeperDecodeErrorZ(const CResult_OutputSweeperDecodeErrorZ&) = delete; + CResult_OutputSweeperDecodeErrorZ(CResult_OutputSweeperDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); } + CResult_OutputSweeperDecodeErrorZ(LDKCResult_OutputSweeperDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); } + operator LDKCResult_OutputSweeperDecodeErrorZ() && { LDKCResult_OutputSweeperDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); return res; } + ~CResult_OutputSweeperDecodeErrorZ() { CResult_OutputSweeperDecodeErrorZ_free(self); } + CResult_OutputSweeperDecodeErrorZ& operator=(CResult_OutputSweeperDecodeErrorZ&& o) { CResult_OutputSweeperDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); return *this; } + LDKCResult_OutputSweeperDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutputSweeperDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutputSweeperDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutputSweeperDecodeErrorZ* operator ->() const { return &self; } +}; class COption_EventZ { private: LDKCOption_EventZ self; @@ -11810,6 +11985,21 @@ public: const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; } }; +class CResult_OutboundHTLCDetailsDecodeErrorZ { +private: + LDKCResult_OutboundHTLCDetailsDecodeErrorZ self; +public: + CResult_OutboundHTLCDetailsDecodeErrorZ(const CResult_OutboundHTLCDetailsDecodeErrorZ&) = delete; + CResult_OutboundHTLCDetailsDecodeErrorZ(CResult_OutboundHTLCDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutboundHTLCDetailsDecodeErrorZ)); } + CResult_OutboundHTLCDetailsDecodeErrorZ(LDKCResult_OutboundHTLCDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ)); } + operator LDKCResult_OutboundHTLCDetailsDecodeErrorZ() && { LDKCResult_OutboundHTLCDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ)); return res; } + ~CResult_OutboundHTLCDetailsDecodeErrorZ() { CResult_OutboundHTLCDetailsDecodeErrorZ_free(self); } + CResult_OutboundHTLCDetailsDecodeErrorZ& operator=(CResult_OutboundHTLCDetailsDecodeErrorZ&& o) { CResult_OutboundHTLCDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutboundHTLCDetailsDecodeErrorZ)); return *this; } + LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_RefundBolt12ParseErrorZ { private: LDKCResult_RefundBolt12ParseErrorZ self; @@ -11930,20 +12120,20 @@ public: const LDKCOption_f64Z* operator &() const { return &self; } const LDKCOption_f64Z* operator ->() const { return &self; } }; -class CResult_ChannelDetailsDecodeErrorZ { +class CResult_TxRemoveInputDecodeErrorZ { private: - LDKCResult_ChannelDetailsDecodeErrorZ self; + LDKCResult_TxRemoveInputDecodeErrorZ self; public: - CResult_ChannelDetailsDecodeErrorZ(const CResult_ChannelDetailsDecodeErrorZ&) = delete; - CResult_ChannelDetailsDecodeErrorZ(CResult_ChannelDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); } - CResult_ChannelDetailsDecodeErrorZ(LDKCResult_ChannelDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); } - operator LDKCResult_ChannelDetailsDecodeErrorZ() && { LDKCResult_ChannelDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); return res; } - ~CResult_ChannelDetailsDecodeErrorZ() { CResult_ChannelDetailsDecodeErrorZ_free(self); } - CResult_ChannelDetailsDecodeErrorZ& operator=(CResult_ChannelDetailsDecodeErrorZ&& o) { CResult_ChannelDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); return *this; } - LDKCResult_ChannelDetailsDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; } + CResult_TxRemoveInputDecodeErrorZ(const CResult_TxRemoveInputDecodeErrorZ&) = delete; + CResult_TxRemoveInputDecodeErrorZ(CResult_TxRemoveInputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxRemoveInputDecodeErrorZ)); } + CResult_TxRemoveInputDecodeErrorZ(LDKCResult_TxRemoveInputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxRemoveInputDecodeErrorZ)); } + operator LDKCResult_TxRemoveInputDecodeErrorZ() && { LDKCResult_TxRemoveInputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxRemoveInputDecodeErrorZ)); return res; } + ~CResult_TxRemoveInputDecodeErrorZ() { CResult_TxRemoveInputDecodeErrorZ_free(self); } + CResult_TxRemoveInputDecodeErrorZ& operator=(CResult_TxRemoveInputDecodeErrorZ&& o) { CResult_TxRemoveInputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxRemoveInputDecodeErrorZ)); return *this; } + LDKCResult_TxRemoveInputDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxRemoveInputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() const { return &self; } }; class CVec_PublicKeyZ { private: @@ -12050,20 +12240,20 @@ public: const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } }; -class CResult_TxRemoveInputDecodeErrorZ { +class CResult_ChannelDetailsDecodeErrorZ { private: - LDKCResult_TxRemoveInputDecodeErrorZ self; + LDKCResult_ChannelDetailsDecodeErrorZ self; public: - CResult_TxRemoveInputDecodeErrorZ(const CResult_TxRemoveInputDecodeErrorZ&) = delete; - CResult_TxRemoveInputDecodeErrorZ(CResult_TxRemoveInputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxRemoveInputDecodeErrorZ)); } - CResult_TxRemoveInputDecodeErrorZ(LDKCResult_TxRemoveInputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxRemoveInputDecodeErrorZ)); } - operator LDKCResult_TxRemoveInputDecodeErrorZ() && { LDKCResult_TxRemoveInputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxRemoveInputDecodeErrorZ)); return res; } - ~CResult_TxRemoveInputDecodeErrorZ() { CResult_TxRemoveInputDecodeErrorZ_free(self); } - CResult_TxRemoveInputDecodeErrorZ& operator=(CResult_TxRemoveInputDecodeErrorZ&& o) { CResult_TxRemoveInputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxRemoveInputDecodeErrorZ)); return *this; } - LDKCResult_TxRemoveInputDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxRemoveInputDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelDetailsDecodeErrorZ(const CResult_ChannelDetailsDecodeErrorZ&) = delete; + CResult_ChannelDetailsDecodeErrorZ(CResult_ChannelDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); } + CResult_ChannelDetailsDecodeErrorZ(LDKCResult_ChannelDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); } + operator LDKCResult_ChannelDetailsDecodeErrorZ() && { LDKCResult_ChannelDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); return res; } + ~CResult_ChannelDetailsDecodeErrorZ() { CResult_ChannelDetailsDecodeErrorZ_free(self); } + CResult_ChannelDetailsDecodeErrorZ& operator=(CResult_ChannelDetailsDecodeErrorZ&& o) { CResult_ChannelDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); return *this; } + LDKCResult_ChannelDetailsDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; } }; class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { private: @@ -12515,20 +12705,20 @@ public: const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator ->() const { return &self; } }; -class CResult_CounterpartyForwardingInfoDecodeErrorZ { +class CResult_OpenChannelV2DecodeErrorZ { private: - LDKCResult_CounterpartyForwardingInfoDecodeErrorZ self; + LDKCResult_OpenChannelV2DecodeErrorZ self; public: - CResult_CounterpartyForwardingInfoDecodeErrorZ(const CResult_CounterpartyForwardingInfoDecodeErrorZ&) = delete; - CResult_CounterpartyForwardingInfoDecodeErrorZ(CResult_CounterpartyForwardingInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyForwardingInfoDecodeErrorZ)); } - CResult_CounterpartyForwardingInfoDecodeErrorZ(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ)); } - operator LDKCResult_CounterpartyForwardingInfoDecodeErrorZ() && { LDKCResult_CounterpartyForwardingInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ)); return res; } - ~CResult_CounterpartyForwardingInfoDecodeErrorZ() { CResult_CounterpartyForwardingInfoDecodeErrorZ_free(self); } - CResult_CounterpartyForwardingInfoDecodeErrorZ& operator=(CResult_CounterpartyForwardingInfoDecodeErrorZ&& o) { CResult_CounterpartyForwardingInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyForwardingInfoDecodeErrorZ)); return *this; } - LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; } + 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_BestBlockDecodeErrorZ { private: @@ -12560,20 +12750,20 @@ public: const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator ->() const { return &self; } }; -class CResult_OpenChannelV2DecodeErrorZ { +class CResult_CounterpartyForwardingInfoDecodeErrorZ { private: - LDKCResult_OpenChannelV2DecodeErrorZ self; + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ 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; } + CResult_CounterpartyForwardingInfoDecodeErrorZ(const CResult_CounterpartyForwardingInfoDecodeErrorZ&) = delete; + CResult_CounterpartyForwardingInfoDecodeErrorZ(CResult_CounterpartyForwardingInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyForwardingInfoDecodeErrorZ)); } + CResult_CounterpartyForwardingInfoDecodeErrorZ(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ)); } + operator LDKCResult_CounterpartyForwardingInfoDecodeErrorZ() && { LDKCResult_CounterpartyForwardingInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ)); return res; } + ~CResult_CounterpartyForwardingInfoDecodeErrorZ() { CResult_CounterpartyForwardingInfoDecodeErrorZ_free(self); } + CResult_CounterpartyForwardingInfoDecodeErrorZ& operator=(CResult_CounterpartyForwardingInfoDecodeErrorZ&& o) { CResult_CounterpartyForwardingInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyForwardingInfoDecodeErrorZ)); return *this; } + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; } }; class CResult_OutputSpendStatusDecodeErrorZ { private: diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index a4b922d..c15c8d8 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -3813,29 +3813,29 @@ impl Clone for CResult_NoneIOErrorZ { /// 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 dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. +/// 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::channelmanager::ChannelDetails, + 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 { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] { + #[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 { +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() } } @@ -9666,43 +9666,6 @@ pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) /// 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) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not -pub enum COption_ChannelShutdownStateZ { - /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState - Some(crate::lightning::ln::channelmanager::ChannelShutdownState), - /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing - None -} -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::channelmanager::ChannelShutdownState { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState -pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channelmanager::ChannelShutdownState) -> COption_ChannelShutdownStateZ { - COption_ChannelShutdownStateZ::Some(o) -} -#[no_mangle] -/// 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::channelmanager::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) } -#[repr(C)] /// The contents of CResult_ChannelIdAPIErrorZ pub union CResult_ChannelIdAPIErrorZPtr { /// A pointer to the contents in the success state. @@ -11077,41 +11040,41 @@ impl Clone for CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ { } } #[repr(C)] -/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ -pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// The contents of CResult_PhantomRouteHintsDecodeErrorZ +pub union CResult_PhantomRouteHintsDecodeErrorZPtr { /// A 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::CounterpartyForwardingInfo, + pub result: *mut crate::lightning::ln::channelmanager::PhantomRouteHints, /// 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::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ { - /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either +pub struct CResult_PhantomRouteHintsDecodeErrorZ { + /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, 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_PhantomRouteHintsDecodeErrorZPtr, + /// Whether this CResult_PhantomRouteHintsDecodeErrorZ 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::channelmanager::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { - CResult_CounterpartyForwardingInfoDecodeErrorZ { - contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ { + CResult_PhantomRouteHintsDecodeErrorZ { + contents: CResult_PhantomRouteHintsDecodeErrorZPtr { 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_PhantomRouteHintsDecodeErrorZ in the error state. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ { + CResult_PhantomRouteHintsDecodeErrorZ { + contents: CResult_PhantomRouteHintsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11119,13 +11082,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_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> 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_PhantomRouteHintsDecodeErrorZ. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { } +impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11138,16 +11101,16 @@ impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { } } } -impl From> for CResult_CounterpartyForwardingInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PhantomRouteHintsDecodeErrorZ { + 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_PhantomRouteHintsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err } + CResult_PhantomRouteHintsDecodeErrorZPtr { err } }; Self { contents, @@ -11155,59 +11118,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_PhantomRouteHintsDecodeErrorZPtr { + 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_PhantomRouteHintsDecodeErrorZPtr { 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_PhantomRouteHintsDecodeErrorZ 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_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelCounterpartyDecodeErrorZ -pub union CResult_ChannelCounterpartyDecodeErrorZPtr { +/// The contents of CResult_BlindedForwardDecodeErrorZ +pub union CResult_BlindedForwardDecodeErrorZPtr { /// A 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::ChannelCounterparty, + pub result: *mut crate::lightning::ln::channelmanager::BlindedForward, /// 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::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::BlindedForward 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_BlindedForwardDecodeErrorZ { + /// The contents of this CResult_BlindedForwardDecodeErrorZ, 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_BlindedForwardDecodeErrorZPtr, + /// Whether this CResult_BlindedForwardDecodeErrorZ 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::channelmanager::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ { - CResult_ChannelCounterpartyDecodeErrorZ { - contents: CResult_ChannelCounterpartyDecodeErrorZPtr { +/// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ { + CResult_BlindedForwardDecodeErrorZ { + contents: CResult_BlindedForwardDecodeErrorZPtr { 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_BlindedForwardDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ { + CResult_BlindedForwardDecodeErrorZ { + contents: CResult_BlindedForwardDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11215,13 +11178,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_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> 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_BlindedForwardDecodeErrorZ. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { } +impl Drop for CResult_BlindedForwardDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11234,16 +11197,16 @@ impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { } } } -impl From> for CResult_ChannelCounterpartyDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedForwardDecodeErrorZ { + 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_BlindedForwardDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelCounterpartyDecodeErrorZPtr { err } + CResult_BlindedForwardDecodeErrorZPtr { err } }; Self { contents, @@ -11251,59 +11214,59 @@ 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_BlindedForwardDecodeErrorZPtr { + 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_BlindedForwardDecodeErrorZPtr { 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_BlindedForwardDecodeErrorZ 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_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelDetailsDecodeErrorZ -pub union CResult_ChannelDetailsDecodeErrorZPtr { +/// The contents of CResult_PendingHTLCRoutingDecodeErrorZ +pub union CResult_PendingHTLCRoutingDecodeErrorZPtr { /// A 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::ChannelDetails, + pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCRouting, /// 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::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting 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_PendingHTLCRoutingDecodeErrorZ { + /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, 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_PendingHTLCRoutingDecodeErrorZPtr, + /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ 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::channelmanager::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ { - CResult_ChannelDetailsDecodeErrorZ { - contents: CResult_ChannelDetailsDecodeErrorZPtr { +/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ { + CResult_PendingHTLCRoutingDecodeErrorZ { + contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { 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_PendingHTLCRoutingDecodeErrorZ in the error state. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ { + CResult_PendingHTLCRoutingDecodeErrorZ { + contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11311,13 +11274,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_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> 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_PendingHTLCRoutingDecodeErrorZ. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { } +impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11330,16 +11293,16 @@ impl Drop for CResult_ChannelDetailsDecodeErrorZ { } } } -impl From> for CResult_ChannelDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PendingHTLCRoutingDecodeErrorZ { + 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_PendingHTLCRoutingDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelDetailsDecodeErrorZPtr { err } + CResult_PendingHTLCRoutingDecodeErrorZPtr { err } }; Self { contents, @@ -11347,59 +11310,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_PendingHTLCRoutingDecodeErrorZPtr { + 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_PendingHTLCRoutingDecodeErrorZPtr { 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_PendingHTLCRoutingDecodeErrorZ 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_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PhantomRouteHintsDecodeErrorZ -pub union CResult_PhantomRouteHintsDecodeErrorZPtr { +/// The contents of CResult_PendingHTLCInfoDecodeErrorZ +pub union CResult_PendingHTLCInfoDecodeErrorZPtr { /// A 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::PhantomRouteHints, + 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, } #[repr(C)] -/// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo 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_PhantomRouteHintsDecodeErrorZ { - /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either +pub struct CResult_PendingHTLCInfoDecodeErrorZ { + /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr, - /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. + pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr, + /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ { - CResult_PhantomRouteHintsDecodeErrorZ { - contents: CResult_PhantomRouteHintsDecodeErrorZPtr { +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ { + CResult_PendingHTLCInfoDecodeErrorZ { + contents: CResult_PendingHTLCInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ { - CResult_PhantomRouteHintsDecodeErrorZ { - contents: CResult_PhantomRouteHintsDecodeErrorZPtr { +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ { + CResult_PendingHTLCInfoDecodeErrorZ { + contents: CResult_PendingHTLCInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11407,13 +11370,13 @@ pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { } -impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { +/// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { } +impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11426,16 +11389,16 @@ impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { } } } -impl From> for CResult_PhantomRouteHintsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PendingHTLCInfoDecodeErrorZ { + 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_PhantomRouteHintsDecodeErrorZPtr { result } + CResult_PendingHTLCInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PhantomRouteHintsDecodeErrorZPtr { err } + CResult_PendingHTLCInfoDecodeErrorZPtr { err } }; Self { contents, @@ -11443,59 +11406,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedForwardDecodeErrorZ -pub union CResult_BlindedForwardDecodeErrorZPtr { +/// The contents of CResult_BlindedFailureDecodeErrorZ +pub union CResult_BlindedFailureDecodeErrorZPtr { /// A 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::BlindedForward, + pub result: *mut crate::lightning::ln::channelmanager::BlindedFailure, /// 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_BlindedForwardDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::BlindedFailure 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_BlindedForwardDecodeErrorZ { - /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either +pub struct CResult_BlindedFailureDecodeErrorZ { + /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedForwardDecodeErrorZPtr, - /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state. + pub contents: CResult_BlindedFailureDecodeErrorZPtr, + /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ { - CResult_BlindedForwardDecodeErrorZ { - contents: CResult_BlindedForwardDecodeErrorZPtr { +/// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ { + CResult_BlindedFailureDecodeErrorZ { + contents: CResult_BlindedFailureDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ { - CResult_BlindedForwardDecodeErrorZ { - contents: CResult_BlindedForwardDecodeErrorZPtr { +/// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ { + CResult_BlindedFailureDecodeErrorZ { + contents: CResult_BlindedFailureDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11503,13 +11466,13 @@ pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { } -impl Drop for CResult_BlindedForwardDecodeErrorZ { +/// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { } +impl Drop for CResult_BlindedFailureDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11522,16 +11485,16 @@ impl Drop for CResult_BlindedForwardDecodeErrorZ { } } } -impl From> for CResult_BlindedForwardDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedFailureDecodeErrorZ { + 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_BlindedForwardDecodeErrorZPtr { result } + CResult_BlindedFailureDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedForwardDecodeErrorZPtr { err } + CResult_BlindedFailureDecodeErrorZPtr { err } }; Self { contents, @@ -11539,59 +11502,135 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCRoutingDecodeErrorZ -pub union CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ChannelMonitorZ { + /// 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::ChannelMonitor, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ChannelMonitorZ { + #[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::ChannelMonitor] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ChannelMonitorZ { + 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_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { } +impl Drop for CVec_ChannelMonitorZ { + 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_ChannelMonitorZ { + 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_ThirtyTwoBytesChannelManagerZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::lightning::ln::channelmanager::ChannelManager, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ThirtyTwoBytesChannelManagerZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) { + (self.a, self.b) + } +} +/// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ { + C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { /// A 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::PendingHTLCRouting, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ, /// 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_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ 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_PendingHTLCRoutingDecodeErrorZ { - /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr, - /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ { - CResult_PendingHTLCRoutingDecodeErrorZ { - contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ { - CResult_PendingHTLCRoutingDecodeErrorZ { - contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11599,13 +11638,13 @@ pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { } -impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11618,16 +11657,16 @@ impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { } } } -impl From> for CResult_PendingHTLCRoutingDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { + 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_PendingHTLCRoutingDecodeErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCRoutingDecodeErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err } }; Self { contents, @@ -11635,59 +11674,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCInfoDecodeErrorZ -pub union CResult_PendingHTLCInfoDecodeErrorZPtr { +/// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ +pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr { /// A 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, + pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure, /// 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_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::config::MaxDustHTLCExposure 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_PendingHTLCInfoDecodeErrorZ { - /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either +pub struct CResult_MaxDustHTLCExposureDecodeErrorZ { + /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr, - /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. + pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr, + /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ { - CResult_PendingHTLCInfoDecodeErrorZ { - contents: CResult_PendingHTLCInfoDecodeErrorZPtr { +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ { + CResult_MaxDustHTLCExposureDecodeErrorZ { + contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ { - CResult_PendingHTLCInfoDecodeErrorZ { - contents: CResult_PendingHTLCInfoDecodeErrorZPtr { +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ { + CResult_MaxDustHTLCExposureDecodeErrorZ { + contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11695,13 +11717,13 @@ pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { } -impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { +/// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { } +impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11714,16 +11736,16 @@ impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { } } } -impl From> for CResult_PendingHTLCInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_MaxDustHTLCExposureDecodeErrorZ { + 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_PendingHTLCInfoDecodeErrorZPtr { result } + CResult_MaxDustHTLCExposureDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCInfoDecodeErrorZPtr { err } + CResult_MaxDustHTLCExposureDecodeErrorZPtr { err } }; Self { contents, @@ -11731,59 +11753,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedFailureDecodeErrorZ -pub union CResult_BlindedFailureDecodeErrorZPtr { +/// The contents of CResult_ChannelConfigDecodeErrorZ +pub union CResult_ChannelConfigDecodeErrorZPtr { /// A 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::BlindedFailure, + pub result: *mut crate::lightning::util::config::ChannelConfig, /// 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_BlindedFailureDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedFailureDecodeErrorZ { - /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either +pub struct CResult_ChannelConfigDecodeErrorZ { + /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedFailureDecodeErrorZPtr, - /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. + pub contents: CResult_ChannelConfigDecodeErrorZPtr, + /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ { - CResult_BlindedFailureDecodeErrorZ { - contents: CResult_BlindedFailureDecodeErrorZPtr { +/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ { + CResult_ChannelConfigDecodeErrorZ { + contents: CResult_ChannelConfigDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ { - CResult_BlindedFailureDecodeErrorZ { - contents: CResult_BlindedFailureDecodeErrorZPtr { +/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ { + CResult_ChannelConfigDecodeErrorZ { + contents: CResult_ChannelConfigDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11791,13 +11813,13 @@ pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { } -impl Drop for CResult_BlindedFailureDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { } +impl Drop for CResult_ChannelConfigDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11810,16 +11832,16 @@ impl Drop for CResult_BlindedFailureDecodeErrorZ { } } } -impl From> for CResult_BlindedFailureDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelConfigDecodeErrorZ { + 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_BlindedFailureDecodeErrorZPtr { result } + CResult_ChannelConfigDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedFailureDecodeErrorZPtr { err } + CResult_ChannelConfigDecodeErrorZPtr { err } }; Self { contents, @@ -11827,59 +11849,133 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelShutdownStateDecodeErrorZ -pub union CResult_ChannelShutdownStateDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not +pub enum COption_MaxDustHTLCExposureZ { + /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure + Some(crate::lightning::util::config::MaxDustHTLCExposure), + /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing + None +} +impl COption_MaxDustHTLCExposureZ { + #[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::util::config::MaxDustHTLCExposure { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure +pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ { + COption_MaxDustHTLCExposureZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_MaxDustHTLCExposureZ containing nothing +pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ { + COption_MaxDustHTLCExposureZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state +pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { } +#[no_mangle] +/// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::errors::APIError or not +pub enum COption_APIErrorZ { + /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError + Some(crate::lightning::util::errors::APIError), + /// When we're in this state, this COption_APIErrorZ contains nothing + None +} +impl COption_APIErrorZ { + #[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::util::errors::APIError { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError +pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ { + COption_APIErrorZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_APIErrorZ containing nothing +pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ { + COption_APIErrorZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state +pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { } +#[no_mangle] +/// Creates a new COption_APIErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_APIErrorZDecodeErrorZ +pub union CResult_COption_APIErrorZDecodeErrorZPtr { /// A 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::ChannelShutdownState, + pub result: *mut crate::c_types::derived::COption_APIErrorZ, /// 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::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_APIErrorZ 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_COption_APIErrorZDecodeErrorZ { + /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, 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_COption_APIErrorZDecodeErrorZPtr, + /// Whether this CResult_COption_APIErrorZDecodeErrorZ 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::channelmanager::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ { - CResult_ChannelShutdownStateDecodeErrorZ { - contents: CResult_ChannelShutdownStateDecodeErrorZPtr { +/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { + CResult_COption_APIErrorZDecodeErrorZ { + contents: CResult_COption_APIErrorZDecodeErrorZPtr { 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_COption_APIErrorZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ { + CResult_COption_APIErrorZDecodeErrorZ { + contents: CResult_COption_APIErrorZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11887,13 +11983,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_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> 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_COption_APIErrorZDecodeErrorZ. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { } +impl Drop for CResult_COption_APIErrorZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11906,16 +12002,16 @@ impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { } } } -impl From> for CResult_ChannelShutdownStateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_APIErrorZDecodeErrorZ { + 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_COption_APIErrorZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelShutdownStateDecodeErrorZPtr { err } + CResult_COption_APIErrorZDecodeErrorZPtr { err } }; Self { contents, @@ -11923,135 +12019,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_COption_APIErrorZDecodeErrorZPtr { + 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_COption_APIErrorZDecodeErrorZPtr { 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_COption_APIErrorZDecodeErrorZ 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) } +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChannelMonitorZ { - /// 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::ChannelMonitor, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChannelMonitorZ { - #[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::ChannelMonitor] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ +pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, } -impl From> for CVec_ChannelMonitorZ { - 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_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_ChannelMonitorUpdateDecodeErrorZ { + /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, + /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { } -impl Drop for CVec_ChannelMonitorZ { - 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_ChannelMonitorZ { - 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_ThirtyTwoBytesChannelManagerZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::lightning::ln::channelmanager::ChannelManager, -} -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)> for C2Tuple_ThirtyTwoBytesChannelManagerZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_ThirtyTwoBytesChannelManagerZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager) { - (self.a, self.b) - } -} -/// Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::channelmanager::ChannelManager) -> C2Tuple_ThirtyTwoBytesChannelManagerZ { - C2Tuple_ThirtyTwoBytesChannelManagerZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { } -#[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { - /// A 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_ThirtyTwoBytesChannelManagerZ, - /// 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_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ 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_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12059,13 +12079,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err( } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } +impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12078,16 +12098,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelMonitorUpdateDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result } + CResult_ChannelMonitorUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err } + CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -12095,42 +12115,96 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ -pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not +pub enum COption_MonitorEventZ { + /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + Some(crate::lightning::chain::channelmonitor::MonitorEvent), + /// When we're in this state, this COption_MonitorEventZ contains nothing + None +} +impl COption_MonitorEventZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent +pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { + COption_MonitorEventZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_MonitorEventZ containing nothing +pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { + COption_MonitorEventZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state +pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } +#[no_mangle] +/// Creates a new COption_MonitorEventZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_MonitorEventZDecodeErrorZ +pub union CResult_COption_MonitorEventZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::util::config::MaxDustHTLCExposure, + pub result: *mut crate::c_types::derived::COption_MonitorEventZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::config::MaxDustHTLCExposure on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_MaxDustHTLCExposureDecodeErrorZ { - /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either +pub struct CResult_COption_MonitorEventZDecodeErrorZ { + /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr, - /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state. + pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr, + /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ { - CResult_MaxDustHTLCExposureDecodeErrorZ { - contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ { - CResult_MaxDustHTLCExposureDecodeErrorZ { - contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12138,13 +12212,13 @@ pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { } -impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ { +/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } +impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12157,16 +12231,16 @@ impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ { } } } -impl From> for CResult_MaxDustHTLCExposureDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_MonitorEventZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_MaxDustHTLCExposureDecodeErrorZPtr { result } + CResult_COption_MonitorEventZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_MaxDustHTLCExposureDecodeErrorZPtr { err } + CResult_COption_MonitorEventZDecodeErrorZPtr { err } }; Self { contents, @@ -12174,59 +12248,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelConfigDecodeErrorZ -pub union CResult_ChannelConfigDecodeErrorZPtr { +/// The contents of CResult_HTLCUpdateDecodeErrorZ +pub union CResult_HTLCUpdateDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::util::config::ChannelConfig, + pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelConfigDecodeErrorZ { - /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either +pub struct CResult_HTLCUpdateDecodeErrorZ { + /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelConfigDecodeErrorZPtr, - /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. + pub contents: CResult_HTLCUpdateDecodeErrorZPtr, + /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ { - CResult_ChannelConfigDecodeErrorZ { - contents: CResult_ChannelConfigDecodeErrorZPtr { +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ { - CResult_ChannelConfigDecodeErrorZ { - contents: CResult_ChannelConfigDecodeErrorZPtr { +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12234,13 +12308,13 @@ pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { } -impl Drop for CResult_ChannelConfigDecodeErrorZ { +/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } +impl Drop for CResult_HTLCUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12253,16 +12327,16 @@ impl Drop for CResult_ChannelConfigDecodeErrorZ { } } } -impl From> for CResult_ChannelConfigDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { +impl From> for CResult_HTLCUpdateDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ChannelConfigDecodeErrorZPtr { result } + CResult_HTLCUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelConfigDecodeErrorZPtr { err } + CResult_HTLCUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -12270,458 +12344,587 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not -pub enum COption_MaxDustHTLCExposureZ { - /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure - Some(crate::lightning::util::config::MaxDustHTLCExposure), - /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing - None +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OutPointCVec_u8ZZ { + /// The element at position 0 + pub a: crate::lightning::chain::transaction::OutPoint, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_u8Z, } -impl COption_MaxDustHTLCExposureZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ { + fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() +} +impl C2Tuple_OutPointCVec_u8ZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) { + (self.a, self.b) } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::config::MaxDustHTLCExposure { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl Clone for C2Tuple_OutPointCVec_u8ZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure -pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ { - COption_MaxDustHTLCExposureZ::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 C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. #[no_mangle] -/// Constructs a new COption_MaxDustHTLCExposureZ containing nothing -pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ { - COption_MaxDustHTLCExposureZ::None +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ { + C2Tuple_OutPointCVec_u8ZZ { a, b, } } + #[no_mangle] -/// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state -pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { } -#[no_mangle] -/// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) } +/// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::util::errors::APIError or not -pub enum COption_APIErrorZ { - /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError - Some(crate::lightning::util::errors::APIError), - /// When we're in this state, this COption_APIErrorZ contains nothing - None +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u32CVec_u8ZZ { + /// The element at position 0 + pub a: u32, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_u8Z, } -impl COption_APIErrorZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ { + fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() +} +impl C2Tuple_u32CVec_u8ZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) { + (self.a, self.b) } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::errors::APIError { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl Clone for C2Tuple_u32CVec_u8ZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError -pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ { - COption_APIErrorZ::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 C2Tuple_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. #[no_mangle] -/// Constructs a new COption_APIErrorZ containing nothing -pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ { - COption_APIErrorZ::None +pub extern "C" fn C2Tuple_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ { + C2Tuple_u32CVec_u8ZZ { a, b, } } + #[no_mangle] -/// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state -pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { } -#[no_mangle] -/// Creates a new COption_APIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_COption_APIErrorZDecodeErrorZ -pub union CResult_COption_APIErrorZDecodeErrorZPtr { - /// A 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_APIErrorZ, - /// 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, -} +/// Frees any resources used by the C2Tuple_u32CVec_u8ZZ. +pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { } #[repr(C)] -/// A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_APIErrorZ 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_APIErrorZDecodeErrorZ { - /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_APIErrorZDecodeErrorZPtr, - /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_u32CVec_u8ZZZ { + /// 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_u32CVec_u8ZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { - CResult_COption_APIErrorZDecodeErrorZ { - contents: CResult_COption_APIErrorZDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl CVec_C2Tuple_u32CVec_u8ZZZ { + #[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_COption_APIErrorZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ { - CResult_COption_APIErrorZDecodeErrorZ { - contents: CResult_COption_APIErrorZDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32CVec_u8ZZ] { + 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_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool { - o.result_ok +impl From> for CVec_C2Tuple_u32CVec_u8ZZZ { + 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_COption_APIErrorZDecodeErrorZ. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { } -impl Drop for CResult_COption_APIErrorZDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { } +impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ { 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_APIErrorZDecodeErrorZ { - 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_APIErrorZDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_APIErrorZDecodeErrorZPtr { 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_COption_APIErrorZDecodeErrorZ { +impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr { - 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_COption_APIErrorZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ -pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ, } -#[repr(C)] -/// A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelMonitorUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. - pub result_ok: bool, +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } } -#[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +/// 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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + /// 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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + #[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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + 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_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { - o.result_ok +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + 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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { + 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::chan_utils::CommitmentTransactions of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_CommitmentTransactionZ { + /// 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::CommitmentTransaction, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_CommitmentTransactionZ { + #[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::CommitmentTransaction] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_CommitmentTransactionZ { + 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_ChannelMonitorUpdateDecodeErrorZ. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } -impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { } +impl Drop for CVec_CommitmentTransactionZ { 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_ChannelMonitorUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ChannelMonitorUpdateDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } - }; +impl Clone for CVec_CommitmentTransactionZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u32TxOutZ { + /// The element at position 0 + pub a: u32, + /// The element at position 1 + pub b: crate::c_types::TxOut, +} +impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { + fn from (tup: (u32, crate::c_types::TxOut)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, } } } -impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ { +impl C2Tuple_u32TxOutZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u32TxOutZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - 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_ChannelMonitorUpdateDecodeErrorZ 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_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32TxOutZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { + C2Tuple_u32TxOutZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u32TxOutZ. +pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not -pub enum COption_MonitorEventZ { - /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent - Some(crate::lightning::chain::channelmonitor::MonitorEvent), - /// When we're in this state, this COption_MonitorEventZ contains nothing - None +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_u32TxOutZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_MonitorEventZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_C2Tuple_u32TxOutZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_C2Tuple_u32TxOutZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } } } #[no_mangle] -/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent -pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { - COption_MonitorEventZ::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } +impl Drop for CVec_C2Tuple_u32TxOutZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } } -#[no_mangle] -/// Constructs a new COption_MonitorEventZ containing nothing -pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { - COption_MonitorEventZ::None +impl Clone for CVec_C2Tuple_u32TxOutZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } } #[no_mangle] -/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state -pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } -#[no_mangle] -/// Creates a new COption_MonitorEventZ which has the same data as `orig` +/// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_COption_MonitorEventZDecodeErrorZ -pub union CResult_COption_MonitorEventZDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::COption_MonitorEventZ, - /// 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 extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { } #[repr(C)] -/// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_MonitorEventZDecodeErrorZ { - /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr, - /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TransactionOutputsZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TransactionOutputsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TransactionOutputsZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } } #[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } +impl Drop for CVec_TransactionOutputsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -#[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl Clone for CVec_TransactionOutputsZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { - o.result_ok +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_BalanceZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::chain::channelmonitor::Balance, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_BalanceZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_BalanceZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } } #[no_mangle] -/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } -impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } +impl Drop for CVec_BalanceZ { fn drop(&mut self) { - if self.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_COption_MonitorEventZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_COption_MonitorEventZDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_MonitorEventZDecodeErrorZPtr { err } - }; +impl Clone for CVec_BalanceZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::lightning::chain::channelmonitor::ChannelMonitor, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, } } } -impl Clone for CResult_COption_MonitorEventZDecodeErrorZ { +impl C2Tuple_ThirtyTwoBytesChannelMonitorZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - 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_COption_MonitorEventZDecodeErrorZ 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_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } +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_HTLCUpdateDecodeErrorZ -pub union CResult_HTLCUpdateDecodeErrorZPtr { +/// 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::lightning::chain::channelmonitor::HTLCUpdate, + 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_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_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_HTLCUpdateDecodeErrorZ { - /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either +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_HTLCUpdateDecodeErrorZPtr, - /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// Creates a new CResult_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_HTLCUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// Creates a new CResult_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, @@ -12729,13 +12932,13 @@ pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } -impl Drop for CResult_HTLCUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_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() } { @@ -12748,16 +12951,16 @@ impl Drop for CResult_HTLCUpdateDecodeErrorZ { } } } -impl From> for CResult_HTLCUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_HTLCUpdateDecodeErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCUpdateDecodeErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } }; Self { contents, @@ -12765,87 +12968,45 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_HTLCUpdateDecodeErrorZPtr { + 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_HTLCUpdateDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OutPointCVec_u8ZZ { - /// The element at position 0 - pub a: crate::lightning::chain::transaction::OutPoint, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_u8Z, -} -impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointCVec_u8ZZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OutPointCVec_u8ZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OutPointCVec_u8ZZ { - 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_clone(orig: &C2Tuple_OutPointCVec_u8ZZ) -> C2Tuple_OutPointCVec_u8ZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointCVec_u8ZZ { - C2Tuple_OutPointCVec_u8ZZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. -pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { } +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_u32CVec_u8ZZ { +pub struct C2Tuple_PublicKeyTypeZ { /// The element at position 0 - pub a: u32, + pub a: crate::c_types::PublicKey, /// The element at position 1 - pub b: crate::c_types::derived::CVec_u8Z, + pub b: crate::lightning::ln::wire::Type, } -impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32CVec_u8ZZ { - fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { +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_u32CVec_u8ZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) { +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_u32CVec_u8ZZ { +impl Clone for C2Tuple_PublicKeyTypeZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -12856,40 +13017,40 @@ impl Clone for C2Tuple_u32CVec_u8ZZ { #[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_u32CVec_u8ZZ_clone(orig: &C2Tuple_u32CVec_u8ZZ) -> C2Tuple_u32CVec_u8ZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. +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_u32CVec_u8ZZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32CVec_u8ZZ { - C2Tuple_u32CVec_u8ZZ { a, b, } +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_u32CVec_u8ZZ. -pub extern "C" fn C2Tuple_u32CVec_u8ZZ_free(_res: C2Tuple_u32CVec_u8ZZ) { } +/// 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_u32CVec_u8ZZs of arbitrary size. +/// 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_u32CVec_u8ZZZ { +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_u32CVec_u8ZZ, + pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_u32CVec_u8ZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +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_u32CVec_u8ZZ] { + #[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_u32CVec_u8ZZZ { - fn from(v: Vec) -> Self { +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() } } @@ -12897,14 +13058,14 @@ impl From> for CVec_C2Tuple_u } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32CVec_u8ZZZ_free(_res: CVec_C2Tuple_u32CVec_u8ZZZ) { } -impl Drop for CVec_C2Tuple_u32CVec_u8ZZZ { +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_u32CVec_u8ZZZ { +impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -12914,26 +13075,26 @@ impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ { } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { +pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ { /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, + pub a: crate::c_types::PublicKey, /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ, + pub b: crate::c_types::derived::CVec_SocketAddressZ, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ)) -> Self { +impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ { + fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) { +impl C2Tuple_PublicKeyCVec_SocketAddressZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) { (self.a, self.b) } } -impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { +impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -12944,40 +13105,40 @@ impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { #[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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. +pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { - C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { a, b, } +pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { + C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ) { } +/// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ. +pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { +pub struct CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { /// 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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ, + pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { + #[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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { + 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() } } @@ -12985,14 +13146,14 @@ impl From Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -13001,117 +13162,208 @@ impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { } } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_CommitmentTransactionZ { - /// 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::CommitmentTransaction, - /// The number of elements pointed to by `data`. - pub datalen: usize +#[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 CVec_CommitmentTransactionZ { - #[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_OnionMessageContentsZ { + #[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::CommitmentTransaction] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[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!() } } } -impl From> for CVec_CommitmentTransactionZ { - 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_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] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { } -impl Drop for CVec_CommitmentTransactionZ { +/// 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.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_CommitmentTransactionZ { +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 { - 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_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_u32TxOutZ { +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ { /// The element at position 0 - pub a: u32, + pub a: crate::lightning::onion_message::packet::OnionMessageContents, /// The element at position 1 - pub b: crate::c_types::TxOut, -} -impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { - fn from (tup: (u32, crate::c_types::TxOut)) -> Self { + pub b: crate::lightning::onion_message::messenger::Destination, + /// The element at position 2 + pub c: crate::lightning::blinded_path::BlindedPath, +} +impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ { + fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self { Self { a: tup.0, b: tup.1, + c: tup.2, } } } -impl C2Tuple_u32TxOutZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { - (self.a, self.b) +impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) { + (self.a, self.b, self.c) } } -impl Clone for C2Tuple_u32TxOutZ { +impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ { 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_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32TxOutZ from the contained elements. +pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { - C2Tuple_u32TxOutZ { a, b, } +pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { + C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_u32TxOutZ. -pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } +/// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ. +pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_u32TxOutZZ { +pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ, + pub data: *mut crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_u32TxOutZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_u32TxOutZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { + 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() } } @@ -13119,14 +13371,14 @@ impl From> for CVec_C2Tuple_u32T } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } -impl Drop for CVec_C2Tuple_u32TxOutZZ { +pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { } +impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { fn drop(&mut self) { if self.datalen == 0 { return; } let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_u32TxOutZZ { +impl Clone for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -13135,117 +13387,199 @@ impl Clone for CVec_C2Tuple_u32TxOutZZ { } } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ, +#[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 From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { - Self { - a: tup.0, - b: tup.1, - } +impl COption_TypeZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) { - (self.a, self.b) + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - 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::ln::wire::Type { + 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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. +/// 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] -pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { a, b, } +/// Constructs a new COption_TypeZ containing nothing +pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { + COption_TypeZ::None } - #[no_mangle] -/// Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ) { } +/// 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)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_TransactionOutputsZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// 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, } -impl CVec_TransactionOutputsZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[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, } } -impl From> for CVec_TransactionOutputsZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } +#[no_mangle] +/// 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] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } -impl Drop for CVec_TransactionOutputsZ { +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.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_TransactionOutputsZ { +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 { - 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_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::chain::channelmonitor::Balances of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_BalanceZ { +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::chain::channelmonitor::Balance, + pub data: *mut crate::lightning::ln::peer_handler::PeerDetails, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_BalanceZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +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::chain::channelmonitor::Balance] { + #[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_BalanceZ { - fn from(v: Vec) -> Self { +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() } } @@ -13253,99 +13587,333 @@ impl From> for CVec_Balanc } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } -impl Drop for CVec_BalanceZ { +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)) }; } } -impl Clone for CVec_BalanceZ { +#[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 { - 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_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)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ThirtyTwoBytesChannelMonitorZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::lightning::chain::channelmonitor::ChannelMonitor, +/// 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, + } } -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)> for C2Tuple_ThirtyTwoBytesChannelMonitorZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self { - Self { - a: tup.0, - b: tup.1, +/// 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 C2Tuple_ThirtyTwoBytesChannelMonitorZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor) { - (self.a, self.b) +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 C2Tuple_ThirtyTwoBytesChannelMonitorZ { +impl Clone for CResult_boolPeerHandleErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } #[no_mangle] -/// Creates a new tuple which has the same data as `orig` +/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_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_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { +/// 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 crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, + 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::ln::msgs::DecodeError, + pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError, } #[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_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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either +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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. + pub contents: CResult_u32GraphSyncErrorZPtr, + /// Whether this CResult_u32GraphSyncErrorZ 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_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_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_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, @@ -13353,13 +13921,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_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> 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_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() } { @@ -13372,16 +13940,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_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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } + CResult_u32GraphSyncErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } + CResult_u32GraphSyncErrorZPtr { err } }; Self { contents, @@ -13389,89 +13957,126 @@ 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 }))) - } } - } else { - Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[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_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, +/// 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, + } } -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, +/// 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 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 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 C2Tuple_PublicKeyTypeZ { +impl Clone for CResult_CVec_u8ZIOErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + Self { result_ok: true, contents: CResult_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_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) { } +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::Strs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_PublicKeyTypeZZ { +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::derived::C2Tuple_PublicKeyTypeZ, + pub data: *mut crate::c_types::Str, /// 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_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::derived::C2Tuple_PublicKeyTypeZ] { + #[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_C2Tuple_PublicKeyTypeZZ { - 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() } } @@ -13479,14 +14084,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_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_C2Tuple_PublicKeyTypeZZ { +impl Clone for CVec_StrZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -13495,71 +14100,125 @@ impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { } } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PublicKeyCVec_SocketAddressZZ { - /// The element at position 0 - pub a: crate::c_types::PublicKey, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_SocketAddressZ, +/// 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::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::c_types::IOError, } -impl From<(crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)> for C2Tuple_PublicKeyCVec_SocketAddressZZ { - fn from (tup: (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ)) -> Self { - Self { - a: tup.0, - b: tup.1, +#[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. +/// `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 + /// `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 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 { + 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 { + 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_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> 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 { + 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 C2Tuple_PublicKeyCVec_SocketAddressZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::c_types::derived::CVec_SocketAddressZ) { - (self.a, self.b) +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_CVec_StrZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_StrZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for C2Tuple_PublicKeyCVec_SocketAddressZZ { +impl Clone for CResult_CVec_StrZIOErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + Self { result_ok: true, contents: CResult_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 tuple 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 C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig: &C2Tuple_PublicKeyCVec_SocketAddressZZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::c_types::derived::CVec_SocketAddressZ) -> C2Tuple_PublicKeyCVec_SocketAddressZZ { - C2Tuple_PublicKeyCVec_SocketAddressZZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ. -pub extern "C" fn C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res: C2Tuple_PublicKeyCVec_SocketAddressZZ) { } +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_PublicKeyCVec_SocketAddressZZs 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_PublicKeyCVec_SocketAddressZZZ { +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_PublicKeyCVec_SocketAddressZZ, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { - #[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_PublicKeyCVec_SocketAddressZZ] { + #[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_PublicKeyCVec_SocketAddressZZZ { - 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() } } @@ -13567,14 +14226,14 @@ impl From> f } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res: CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ) { } -impl Drop for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { +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_PublicKeyCVec_SocketAddressZZZ { +impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -13583,78 +14242,137 @@ impl Clone for CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { } } #[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 +/// 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::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::c_types::IOError, } -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!() } +#[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. +/// `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 + /// `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 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 { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } #[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) +/// 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, + } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Constructs a new COption_OnionMessageContentsZ containing nothing -pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ { - COption_OnionMessageContentsZ::None +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { + o.result_ok } #[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) { } +/// 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() } { + 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_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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + fn clone(&self) -> 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 }))) + } } + } else { + 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 COption_OnionMessageContentsZ which has the same data as `orig` +/// 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 COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) } +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_COption_OnionMessageContentsZDecodeErrorZ -pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr { +/// 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::COption_OnionMessageContentsZ, + 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, + 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_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_COption_OnionMessageContentsZDecodeErrorZ { - /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, 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_COption_OnionMessageContentsZDecodeErrorZPtr, - /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ 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_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 { +/// 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_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_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, @@ -13662,13 +14380,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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> 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_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() } { @@ -13681,16 +14399,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_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_COption_OnionMessageContentsZDecodeErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } }; Self { contents, @@ -13698,188 +14416,155 @@ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + 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` +/// 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_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_OnionMessageContentsDestinationBlindedPathZ { - /// 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::Destination, - /// The element at position 2 - pub c: crate::lightning::blinded_path::BlindedPath, -} -impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)> for C3Tuple_OnionMessageContentsDestinationBlindedPathZ { - fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } - } -} -impl C3Tuple_OnionMessageContentsDestinationBlindedPathZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::Destination, crate::lightning::blinded_path::BlindedPath) { - (self.a, self.b, self.c) - } +/// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ +pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { + /// A 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, + /// 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, } -impl Clone for C3Tuple_OnionMessageContentsDestinationBlindedPathZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } - } +#[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. +/// `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 + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr, + /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state. + pub result_ok: bool, } #[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_OnionMessageContentsDestinationBlindedPathZ_clone(orig: &C3Tuple_OnionMessageContentsDestinationBlindedPathZ) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::Destination, c: crate::lightning::blinded_path::BlindedPath) -> C3Tuple_OnionMessageContentsDestinationBlindedPathZ { - C3Tuple_OnionMessageContentsDestinationBlindedPathZ { a, b, c, } +/// 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 { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } } - #[no_mangle] -/// Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ. -pub extern "C" fn C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res: C3Tuple_OnionMessageContentsDestinationBlindedPathZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { - /// 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_OnionMessageContentsDestinationBlindedPathZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { - #[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_OnionMessageContentsDestinationBlindedPathZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +/// 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 { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } -impl From> for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { - 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_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ) { } -impl Drop for CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { +/// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ. +pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { } +impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { 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_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { - 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_UnsignedInvoiceRequestBolt12SemanticErrorZ { + 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 } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -#[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!() } +impl Clone for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { + 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 }))) + } } + } } } #[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` +/// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ 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) } +pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_TypeZDecodeErrorZ -pub union CResult_COption_TypeZDecodeErrorZPtr { +/// 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 crate::c_types::derived::COption_TypeZ, + 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::msgs::DecodeError, + pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError, } #[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_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_COption_TypeZDecodeErrorZ { - /// The contents of this CResult_COption_TypeZDecodeErrorZ, 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_COption_TypeZDecodeErrorZPtr, - /// Whether this CResult_COption_TypeZDecodeErrorZ 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_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_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_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_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, @@ -13887,13 +14572,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_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> 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_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() } { @@ -13906,16 +14591,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_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_COption_TypeZDecodeErrorZPtr { result } + CResult_InvoiceRequestBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_TypeZDecodeErrorZPtr { err } + CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -13923,170 +14608,207 @@ 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_InvoiceRequestBolt12SemanticErrorZPtr { + 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_InvoiceRequestBolt12SemanticErrorZPtr { + 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` +/// 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_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { 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 +/// An enum which can either contain a crate::c_types::SecretKey or not +pub enum COption_SecretKeyZ { + /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey + Some(crate::c_types::SecretKey), + /// When we're in this state, this COption_SecretKeyZ contains nothing None } -impl COption_SocketAddressZ { +impl COption_SecretKeyZ { #[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 { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::SecretKey { 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) +/// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey +pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ { + COption_SecretKeyZ::Some(o) } #[no_mangle] -/// Constructs a new COption_SocketAddressZ containing nothing -pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ { - COption_SocketAddressZ::None +/// Constructs a new COption_SecretKeyZ containing nothing +pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ { + COption_SecretKeyZ::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) { } +/// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state +pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { } #[no_mangle] -/// Creates a new COption_SocketAddressZ which has the same data as `orig` +/// Creates a new COption_SecretKeyZ 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) } +pub extern "C" fn COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { 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 +/// 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 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::offers::parse::Bolt12SemanticError, } -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) } +#[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. +/// `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 + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ 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 { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -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] +/// 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, } } +/// 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_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { } -impl Drop for CVec_PeerDetailsZ { +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> 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 { 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_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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { 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_CVec_u8ZPeerHandleErrorZ -pub union CResult_CVec_u8ZPeerHandleErrorZPtr { +/// 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::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, + 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_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_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_CVec_u8ZPeerHandleErrorZ { - /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either +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_CVec_u8ZPeerHandleErrorZPtr, - /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + pub contents: CResult_VerifiedInvoiceRequestNoneZPtr, + /// Whether this CResult_VerifiedInvoiceRequestNoneZ 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_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_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)), +/// 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_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> 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_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_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_u8ZPeerHandleErrorZ { - 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_u8ZPeerHandleErrorZPtr { result } + CResult_VerifiedInvoiceRequestNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZPeerHandleErrorZPtr { 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, @@ -14094,58 +14816,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_VerifiedInvoiceRequestNoneZPtr { + 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_VerifiedInvoiceRequestNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ 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_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { 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_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::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::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError, } #[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_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_NonePeerHandleErrorZ { - /// The contents of this CResult_NonePeerHandleErrorZ, 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_NonePeerHandleErrorZPtr, - /// Whether this CResult_NonePeerHandleErrorZ 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_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_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_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_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, @@ -14153,15 +14876,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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> 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_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() } { + 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) }; @@ -14169,16 +14895,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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonePeerHandleErrorZPtr { err } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -14186,59 +14912,42 @@ impl From 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 { +/// 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 bool, + 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::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[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_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_boolPeerHandleErrorZ { - /// The contents of this CResult_boolPeerHandleErrorZ, 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_boolPeerHandleErrorZPtr, - /// Whether this CResult_boolPeerHandleErrorZ 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_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_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_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_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, @@ -14246,13 +14955,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_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> 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_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() } { @@ -14265,16 +14974,16 @@ impl Drop for CResult_boolPeerHandleErrorZ { } } } -impl From> for CResult_boolPeerHandleErrorZ { - 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_boolPeerHandleErrorZPtr { result } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolPeerHandleErrorZPtr { err } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } }; Self { contents, @@ -14282,138 +14991,208 @@ 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_InvoiceRequestFieldsDecodeErrorZPtr { + 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_InvoiceRequestFieldsDecodeErrorZPtr { + 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, +/// 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] -/// 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, - } +/// Constructs a new COption_ECDSASignatureZ containing nothing +pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ { + COption_ECDSASignatureZ::None } #[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, +/// 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!() } } } -/// 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 +/// 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] -/// 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, - } - } +/// 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_CVec_u8ZIOErrorZ -pub union CResult_CVec_u8ZIOErrorZPtr { +/// 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::c_types::derived::CVec_u8Z, + 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::c_types::IOError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[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. +/// 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_CVec_u8ZIOErrorZ { - /// The contents of this CResult_CVec_u8ZIOErrorZ, 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_CVec_u8ZIOErrorZPtr, - /// Whether this CResult_CVec_u8ZIOErrorZ 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_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 { +/// 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_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 { +/// 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, @@ -14421,13 +15200,13 @@ pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CR } /// 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_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> 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_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() } { @@ -14440,16 +15219,16 @@ impl Drop for CResult_CVec_u8ZIOErrorZ { } } } -impl From> for CResult_CVec_u8ZIOErrorZ { - 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_CVec_u8ZIOErrorZPtr { result } + CResult_SocketAddressDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZIOErrorZPtr { err } + CResult_SocketAddressDecodeErrorZPtr { err } }; Self { contents, @@ -14457,105 +15236,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_SocketAddressDecodeErrorZPtr { + 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_SocketAddressDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZIOErrorZ 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_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { 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 -} -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) } - } -} -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] -/// 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 { - 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_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) - } -} +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_StrZIOErrorZ -pub union CResult_CVec_StrZIOErrorZPtr { +/// 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::c_types::derived::CVec_StrZ, + 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::c_types::IOError, + pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError, } #[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_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_CVec_StrZIOErrorZ { - /// The contents of this CResult_CVec_StrZIOErrorZ, 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_CVec_StrZIOErrorZPtr, - /// Whether this CResult_CVec_StrZIOErrorZ 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_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 { +} +#[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 { 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_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, @@ -14563,13 +15296,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_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> 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_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() } { @@ -14582,16 +15315,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_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_CVec_StrZIOErrorZPtr { result } + CResult_SocketAddressSocketAddressParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_StrZIOErrorZPtr { err } + CResult_SocketAddressSocketAddressParseErrorZPtr { err } }; Self { contents, @@ -14599,47 +15332,47 @@ 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 }))) + 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_CVec_StrZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { + 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` +/// 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_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { +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::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, + pub data: *mut crate::lightning::ln::msgs::UpdateAddHTLC, /// 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 { +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::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] { + #[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_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { - fn from(v: Vec) -> Self { +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() } } @@ -14647,14 +15380,14 @@ impl From> f } #[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 { +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_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { +impl Clone for CVec_UpdateAddHTLCZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -14663,329 +15396,179 @@ impl Clone for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { } } #[repr(C)] -/// 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::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::c_types::IOError, -} -#[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. -/// `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 - /// `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 result_ok: bool, +/// 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 } -#[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 { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +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 } -} -#[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 { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFulfillHTLC] { + 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { - o.result_ok +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 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 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.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_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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { +impl Clone for CVec_UpdateFulfillHTLCZ { fn clone(&self) -> 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 }))) - } } - } else { - Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { - 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_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_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::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::c_types::IOError, -} #[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. -/// `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 - /// `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 result_ok: bool, +/// 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 } -#[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 { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +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 } -} -#[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 { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailHTLC] { + 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_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> 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 { - 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 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() } } } } -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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } - }; - Self { - contents, - result_ok: 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 { + 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 CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { +impl Clone for CVec_UpdateFailHTLCZ { fn clone(&self) -> Self { - if self.result_ok { - 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { - 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_ThirtyTwoBytesChannelMonitorZIOErrorZ 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) } -#[repr(C)] -/// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ -pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { - /// A 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, - /// 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_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. -/// `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 - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr, - /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state. - pub result_ok: bool, +/// 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 } -#[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 { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +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 } -} -#[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 { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::UpdateFailMalformedHTLC] { + 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_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool { - o.result_ok +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 any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ. -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { } -impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { +/// 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.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_UnsignedInvoiceRequestBolt12SemanticErrorZ { - 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 } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { 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_UnsignedInvoiceRequestBolt12SemanticErrorZ { +impl Clone for CVec_UpdateFailMalformedHTLCZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { - 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 }))) - } } - } + 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_UnsignedInvoiceRequestBolt12SemanticErrorZ 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) } #[repr(C)] -/// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ -pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// 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_request::InvoiceRequest, + 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_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_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_InvoiceRequestBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, 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_InvoiceRequestBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ 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_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_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_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_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, @@ -14993,13 +15576,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_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> 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_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() } { @@ -15012,16 +15595,16 @@ impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { } } } -impl From> for CResult_InvoiceRequestBolt12SemanticErrorZ { - 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_InvoiceRequestBolt12SemanticErrorZPtr { result } + CResult_AcceptChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } + CResult_AcceptChannelDecodeErrorZPtr { err } }; Self { contents, @@ -15029,96 +15612,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { - 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_InvoiceRequestBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[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)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::SecretKey or not -pub enum COption_SecretKeyZ { - /// When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey - Some(crate::c_types::SecretKey), - /// When we're in this state, this COption_SecretKeyZ contains nothing - None -} -impl COption_SecretKeyZ { - #[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::SecretKey { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey -pub extern "C" fn COption_SecretKeyZ_some(o: crate::c_types::SecretKey) -> COption_SecretKeyZ { - COption_SecretKeyZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_SecretKeyZ containing nothing -pub extern "C" fn COption_SecretKeyZ_none() -> COption_SecretKeyZ { - COption_SecretKeyZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state -pub extern "C" fn COption_SecretKeyZ_free(_res: COption_SecretKeyZ) { } -#[no_mangle] -/// Creates a new COption_SecretKeyZ 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 COption_SecretKeyZ_clone(orig: &COption_SecretKeyZ) -> COption_SecretKeyZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// 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::InvoiceWithExplicitSigningPubkeyBuilder, + 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_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_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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ 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_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_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_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_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, @@ -15126,13 +15672,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_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> 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_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() } { @@ -15145,16 +15691,16 @@ impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticError } } } -impl From> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } + CResult_AcceptChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } + CResult_AcceptChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -15162,74 +15708,95 @@ 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_VerifiedInvoiceRequestNoneZ -pub union CResult_VerifiedInvoiceRequestNoneZPtr { +/// 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::VerifiedInvoiceRequest, - /// 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::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_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () 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_VerifiedInvoiceRequestNoneZ { - /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, 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_VerifiedInvoiceRequestNoneZPtr, - /// Whether this CResult_VerifiedInvoiceRequestNoneZ 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_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 { +/// 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_VerifiedInvoiceRequestNoneZ in the error state. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ { - CResult_VerifiedInvoiceRequestNoneZ { - contents: CResult_VerifiedInvoiceRequestNoneZPtr { - err: core::ptr::null_mut(), +/// 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, } } /// 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 { +pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> 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 { +/// 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() } { 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_VerifiedInvoiceRequestNoneZ { - 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_VerifiedInvoiceRequestNoneZPtr { result } + CResult_StfuDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_StfuDecodeErrorZPtr { err } }; Self { contents, @@ -15237,59 +15804,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_StfuDecodeErrorZPtr { + 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_StfuDecodeErrorZPtr { + 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_StfuDecodeErrorZ 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_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_SpliceDecodeErrorZ +pub union CResult_SpliceDecodeErrorZPtr { /// A 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::Splice, /// 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_SpliceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Splice 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_SpliceDecodeErrorZ { + /// The contents of this CResult_SpliceDecodeErrorZ, 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_SpliceDecodeErrorZPtr, + /// Whether this CResult_SpliceDecodeErrorZ 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_SpliceDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ { + CResult_SpliceDecodeErrorZ { + contents: CResult_SpliceDecodeErrorZPtr { 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_SpliceDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ { + CResult_SpliceDecodeErrorZ { + contents: CResult_SpliceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15297,13 +15864,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_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> 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_SpliceDecodeErrorZ. +pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { } +impl Drop for CResult_SpliceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15316,16 +15883,16 @@ impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ } } } -impl From> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceDecodeErrorZ { + 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_SpliceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } + CResult_SpliceDecodeErrorZPtr { err } }; Self { contents, @@ -15333,42 +15900,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SpliceDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ -pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// 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::offers::invoice_request::InvoiceRequestFields, + 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::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_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_InvoiceRequestFieldsDecodeErrorZ { - /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, 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_InvoiceRequestFieldsDecodeErrorZPtr, - /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ 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_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_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_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 { + } +} +#[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 { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15376,13 +15960,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_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> 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_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() } { @@ -15395,16 +15979,16 @@ impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { } } } -impl From> for CResult_InvoiceRequestFieldsDecodeErrorZ { - 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_InvoiceRequestFieldsDecodeErrorZPtr { result } + CResult_SpliceAckDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } + CResult_SpliceAckDecodeErrorZPtr { err } }; Self { contents, @@ -15412,208 +15996,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_SpliceAckDecodeErrorZPtr { + 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_SpliceAckDecodeErrorZPtr { 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_SpliceAckDecodeErrorZ 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_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressDecodeErrorZ -pub union CResult_SocketAddressDecodeErrorZPtr { +/// 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::SocketAddress, + 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 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_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_SocketAddressDecodeErrorZ { - /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either +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_SocketAddressDecodeErrorZPtr, - /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state. + pub contents: CResult_SpliceLockedDecodeErrorZPtr, + /// Whether this CResult_SpliceLockedDecodeErrorZ 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_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, } } #[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_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, @@ -15621,13 +16056,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_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> 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_SpliceLockedDecodeErrorZ. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { } +impl Drop for CResult_SpliceLockedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15640,16 +16075,16 @@ impl Drop for CResult_SocketAddressDecodeErrorZ { } } } -impl From> for CResult_SocketAddressDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_SocketAddressDecodeErrorZPtr { result } + CResult_SpliceLockedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressDecodeErrorZPtr { err } + CResult_SpliceLockedDecodeErrorZPtr { err } }; Self { contents, @@ -15657,59 +16092,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_SpliceLockedDecodeErrorZPtr { + 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_SpliceLockedDecodeErrorZPtr { 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_SpliceLockedDecodeErrorZ 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_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressSocketAddressParseErrorZ -pub union CResult_SocketAddressSocketAddressParseErrorZPtr { +/// 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::SocketAddress, + 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::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_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_SocketAddressSocketAddressParseErrorZ { - /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, 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_SocketAddressSocketAddressParseErrorZPtr, - /// Whether this CResult_SocketAddressSocketAddressParseErrorZ 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_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_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_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_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, @@ -15717,13 +16152,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_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> 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_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() } { @@ -15736,16 +16171,16 @@ impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { } } } -impl From> for CResult_SocketAddressSocketAddressParseErrorZ { - 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_SocketAddressSocketAddressParseErrorZPtr { result } + CResult_TxAddInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressSocketAddressParseErrorZPtr { err } + CResult_TxAddInputDecodeErrorZPtr { err } }; Self { contents, @@ -15753,243 +16188,59 @@ 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_TxAddInputDecodeErrorZPtr { + 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_TxAddInputDecodeErrorZPtr { + 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_TxAddInputDecodeErrorZ 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 { - 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_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelDecodeErrorZ -pub union CResult_AcceptChannelDecodeErrorZPtr { +/// 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::AcceptChannel, + 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_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_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_AcceptChannelDecodeErrorZ { - /// The contents of this CResult_AcceptChannelDecodeErrorZ, 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_AcceptChannelDecodeErrorZPtr, - /// Whether this CResult_AcceptChannelDecodeErrorZ 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_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_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_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_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, @@ -15997,13 +16248,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_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> 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_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() } { @@ -16016,16 +16267,16 @@ impl Drop for CResult_AcceptChannelDecodeErrorZ { } } } -impl From> for CResult_AcceptChannelDecodeErrorZ { - 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_AcceptChannelDecodeErrorZPtr { result } + CResult_TxAddOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelDecodeErrorZPtr { err } + CResult_TxAddOutputDecodeErrorZPtr { err } }; Self { contents, @@ -16033,59 +16284,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_TxAddOutputDecodeErrorZPtr { + 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_TxAddOutputDecodeErrorZPtr { 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_TxAddOutputDecodeErrorZ 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_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelV2DecodeErrorZ -pub union CResult_AcceptChannelV2DecodeErrorZPtr { +/// 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::AcceptChannelV2, + 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_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_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_AcceptChannelV2DecodeErrorZ { - /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, 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_AcceptChannelV2DecodeErrorZPtr, - /// Whether this CResult_AcceptChannelV2DecodeErrorZ 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_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_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_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_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, @@ -16093,13 +16344,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_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> 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_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() } { @@ -16112,16 +16363,16 @@ impl Drop for CResult_AcceptChannelV2DecodeErrorZ { } } } -impl From> for CResult_AcceptChannelV2DecodeErrorZ { - 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_AcceptChannelV2DecodeErrorZPtr { result } + CResult_TxRemoveInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelV2DecodeErrorZPtr { err } + CResult_TxRemoveInputDecodeErrorZPtr { err } }; Self { contents, @@ -16129,59 +16380,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_TxRemoveInputDecodeErrorZPtr { + 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_TxRemoveInputDecodeErrorZPtr { 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_TxRemoveInputDecodeErrorZ 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_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_StfuDecodeErrorZ -pub union CResult_StfuDecodeErrorZPtr { +/// 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::Stfu, + 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_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_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_StfuDecodeErrorZ { - /// The contents of this CResult_StfuDecodeErrorZ, 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_StfuDecodeErrorZPtr, - /// Whether this CResult_StfuDecodeErrorZ 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_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_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_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_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, @@ -16189,13 +16440,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_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> 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_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() } { @@ -16208,16 +16459,16 @@ impl Drop for CResult_StfuDecodeErrorZ { } } } -impl From> for CResult_StfuDecodeErrorZ { - 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_StfuDecodeErrorZPtr { result } + CResult_TxRemoveOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StfuDecodeErrorZPtr { err } + CResult_TxRemoveOutputDecodeErrorZPtr { err } }; Self { contents, @@ -16225,59 +16476,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_TxRemoveOutputDecodeErrorZPtr { + 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_TxRemoveOutputDecodeErrorZPtr { 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_TxRemoveOutputDecodeErrorZ 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_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceDecodeErrorZ -pub union CResult_SpliceDecodeErrorZPtr { +/// 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::Splice, + 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_SpliceDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Splice 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_SpliceDecodeErrorZ { - /// The contents of this CResult_SpliceDecodeErrorZ, 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_SpliceDecodeErrorZPtr, - /// Whether this CResult_SpliceDecodeErrorZ 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_SpliceDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Splice) -> CResult_SpliceDecodeErrorZ { - CResult_SpliceDecodeErrorZ { - contents: CResult_SpliceDecodeErrorZPtr { +/// 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_SpliceDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceDecodeErrorZ { - CResult_SpliceDecodeErrorZ { - contents: CResult_SpliceDecodeErrorZPtr { +/// 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, @@ -16285,13 +16536,13 @@ pub extern "C" fn CResult_SpliceDecodeErrorZ_err(e: crate::lightning::ln::msgs:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceDecodeErrorZ_is_ok(o: &CResult_SpliceDecodeErrorZ) -> 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_SpliceDecodeErrorZ. -pub extern "C" fn CResult_SpliceDecodeErrorZ_free(_res: CResult_SpliceDecodeErrorZ) { } -impl Drop for CResult_SpliceDecodeErrorZ { +/// 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() } { @@ -16304,16 +16555,16 @@ impl Drop for CResult_SpliceDecodeErrorZ { } } } -impl From> for CResult_SpliceDecodeErrorZ { - 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_SpliceDecodeErrorZPtr { result } + CResult_TxCompleteDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceDecodeErrorZPtr { err } + CResult_TxCompleteDecodeErrorZPtr { err } }; Self { contents, @@ -16321,59 +16572,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceDecodeErrorZPtr { - 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_SpliceDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceDecodeErrorZ 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_SpliceDecodeErrorZ_clone(orig: &CResult_SpliceDecodeErrorZ) -> CResult_SpliceDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceAckDecodeErrorZ -pub union CResult_SpliceAckDecodeErrorZPtr { +/// 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::SpliceAck, + 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_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_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_SpliceAckDecodeErrorZ { - /// The contents of this CResult_SpliceAckDecodeErrorZ, 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_SpliceAckDecodeErrorZPtr, - /// Whether this CResult_SpliceAckDecodeErrorZ 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_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_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_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_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, @@ -16381,13 +16632,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_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> 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_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() } { @@ -16400,16 +16651,16 @@ impl Drop for CResult_SpliceAckDecodeErrorZ { } } } -impl From> for CResult_SpliceAckDecodeErrorZ { - 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_SpliceAckDecodeErrorZPtr { result } + CResult_TxSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceAckDecodeErrorZPtr { err } + CResult_TxSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -16417,59 +16668,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_TxSignaturesDecodeErrorZPtr { + 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_TxSignaturesDecodeErrorZPtr { 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_TxSignaturesDecodeErrorZ 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_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceLockedDecodeErrorZ -pub union CResult_SpliceLockedDecodeErrorZPtr { +/// 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::SpliceLocked, + 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_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_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_SpliceLockedDecodeErrorZ { - /// The contents of this CResult_SpliceLockedDecodeErrorZ, 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_SpliceLockedDecodeErrorZPtr, - /// Whether this CResult_SpliceLockedDecodeErrorZ 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_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_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_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_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, @@ -16477,13 +16728,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_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> 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_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() } { @@ -16496,16 +16747,16 @@ impl Drop for CResult_SpliceLockedDecodeErrorZ { } } } -impl From> for CResult_SpliceLockedDecodeErrorZ { - 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_SpliceLockedDecodeErrorZPtr { result } + CResult_TxInitRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceLockedDecodeErrorZPtr { err } + CResult_TxInitRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16513,59 +16764,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_TxInitRbfDecodeErrorZPtr { + 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_TxInitRbfDecodeErrorZPtr { 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_TxInitRbfDecodeErrorZ 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_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAddInputDecodeErrorZ -pub union CResult_TxAddInputDecodeErrorZPtr { +/// 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::TxAddInput, + 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_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_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_TxAddInputDecodeErrorZ { - /// The contents of this CResult_TxAddInputDecodeErrorZ, 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_TxAddInputDecodeErrorZPtr, - /// Whether this CResult_TxAddInputDecodeErrorZ 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_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_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_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_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, @@ -16573,13 +16824,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_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> 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_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() } { @@ -16592,16 +16843,16 @@ impl Drop for CResult_TxAddInputDecodeErrorZ { } } } -impl From> for CResult_TxAddInputDecodeErrorZ { - 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_TxAddInputDecodeErrorZPtr { result } + CResult_TxAckRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddInputDecodeErrorZPtr { err } + CResult_TxAckRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16609,59 +16860,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_TxAckRbfDecodeErrorZPtr { + 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_TxAckRbfDecodeErrorZPtr { 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_TxAckRbfDecodeErrorZ 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_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAddOutputDecodeErrorZ -pub union CResult_TxAddOutputDecodeErrorZPtr { +/// 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::TxAddOutput, + 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_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_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_TxAddOutputDecodeErrorZ { - /// The contents of this CResult_TxAddOutputDecodeErrorZ, 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_TxAddOutputDecodeErrorZPtr, - /// Whether this CResult_TxAddOutputDecodeErrorZ 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_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_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_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_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, @@ -16669,13 +16920,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_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> 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_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() } { @@ -16688,16 +16939,16 @@ impl Drop for CResult_TxAddOutputDecodeErrorZ { } } } -impl From> for CResult_TxAddOutputDecodeErrorZ { - 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_TxAddOutputDecodeErrorZPtr { result } + CResult_TxAbortDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddOutputDecodeErrorZPtr { err } + CResult_TxAbortDecodeErrorZPtr { err } }; Self { contents, @@ -16705,59 +16956,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_TxAbortDecodeErrorZPtr { + 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_TxAbortDecodeErrorZPtr { 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_TxAbortDecodeErrorZ 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_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveInputDecodeErrorZ -pub union CResult_TxRemoveInputDecodeErrorZPtr { +/// 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::TxRemoveInput, + 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_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_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_TxRemoveInputDecodeErrorZ { - /// The contents of this CResult_TxRemoveInputDecodeErrorZ, 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_TxRemoveInputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveInputDecodeErrorZ 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_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_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_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_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, @@ -16765,13 +17016,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_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> 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_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() } { @@ -16784,16 +17035,16 @@ impl Drop for CResult_TxRemoveInputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveInputDecodeErrorZ { - 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_TxRemoveInputDecodeErrorZPtr { result } + CResult_AnnouncementSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveInputDecodeErrorZPtr { err } + CResult_AnnouncementSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -16801,59 +17052,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_AnnouncementSignaturesDecodeErrorZPtr { + 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_AnnouncementSignaturesDecodeErrorZPtr { 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_AnnouncementSignaturesDecodeErrorZ 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_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveOutputDecodeErrorZ -pub union CResult_TxRemoveOutputDecodeErrorZPtr { +/// 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::TxRemoveOutput, + 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_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_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_TxRemoveOutputDecodeErrorZ { - /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, 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_TxRemoveOutputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveOutputDecodeErrorZ 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_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_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_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_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, @@ -16861,13 +17112,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_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> 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_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() } { @@ -16880,16 +17131,16 @@ impl Drop for CResult_TxRemoveOutputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveOutputDecodeErrorZ { - 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_TxRemoveOutputDecodeErrorZPtr { result } + CResult_ChannelReestablishDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveOutputDecodeErrorZPtr { err } + CResult_ChannelReestablishDecodeErrorZPtr { err } }; Self { contents, @@ -16897,59 +17148,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_ChannelReestablishDecodeErrorZPtr { + 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_ChannelReestablishDecodeErrorZPtr { 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_ChannelReestablishDecodeErrorZ 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_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCompleteDecodeErrorZ -pub union CResult_TxCompleteDecodeErrorZPtr { +/// 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::TxComplete, + 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_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_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_TxCompleteDecodeErrorZ { - /// The contents of this CResult_TxCompleteDecodeErrorZ, 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_TxCompleteDecodeErrorZPtr, - /// Whether this CResult_TxCompleteDecodeErrorZ 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_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_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_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_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, @@ -16957,13 +17208,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_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> 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_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() } { @@ -16976,16 +17227,16 @@ impl Drop for CResult_TxCompleteDecodeErrorZ { } } } -impl From> for CResult_TxCompleteDecodeErrorZ { - 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_TxCompleteDecodeErrorZPtr { result } + CResult_ClosingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCompleteDecodeErrorZPtr { err } + CResult_ClosingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -16993,59 +17244,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_ClosingSignedDecodeErrorZPtr { + 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_ClosingSignedDecodeErrorZPtr { 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_ClosingSignedDecodeErrorZ 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_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxSignaturesDecodeErrorZ -pub union CResult_TxSignaturesDecodeErrorZPtr { +/// 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::TxSignatures, + 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_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_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_TxSignaturesDecodeErrorZ { - /// The contents of this CResult_TxSignaturesDecodeErrorZ, 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_TxSignaturesDecodeErrorZPtr, - /// Whether this CResult_TxSignaturesDecodeErrorZ 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_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_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_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_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, @@ -17053,13 +17304,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_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> 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_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() } { @@ -17072,16 +17323,16 @@ impl Drop for CResult_TxSignaturesDecodeErrorZ { } } } -impl From> for CResult_TxSignaturesDecodeErrorZ { - 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_TxSignaturesDecodeErrorZPtr { result } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxSignaturesDecodeErrorZPtr { err } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } }; Self { contents, @@ -17089,59 +17340,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_ClosingSignedFeeRangeDecodeErrorZPtr { + 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_ClosingSignedFeeRangeDecodeErrorZPtr { 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_ClosingSignedFeeRangeDecodeErrorZ 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_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxInitRbfDecodeErrorZ -pub union CResult_TxInitRbfDecodeErrorZPtr { +/// 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::TxInitRbf, + 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_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_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_TxInitRbfDecodeErrorZ { - /// The contents of this CResult_TxInitRbfDecodeErrorZ, 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_TxInitRbfDecodeErrorZPtr, - /// Whether this CResult_TxInitRbfDecodeErrorZ 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_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_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_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_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, @@ -17149,13 +17400,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_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> 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_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() } { @@ -17168,16 +17419,16 @@ impl Drop for CResult_TxInitRbfDecodeErrorZ { } } } -impl From> for CResult_TxInitRbfDecodeErrorZ { - 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_TxInitRbfDecodeErrorZPtr { result } + CResult_CommitmentSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxInitRbfDecodeErrorZPtr { err } + CResult_CommitmentSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17185,59 +17436,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_CommitmentSignedDecodeErrorZPtr { + 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_CommitmentSignedDecodeErrorZPtr { 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_CommitmentSignedDecodeErrorZ 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_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAckRbfDecodeErrorZ -pub union CResult_TxAckRbfDecodeErrorZPtr { +/// 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::TxAckRbf, + 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_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_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_TxAckRbfDecodeErrorZ { - /// The contents of this CResult_TxAckRbfDecodeErrorZ, 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_TxAckRbfDecodeErrorZPtr, - /// Whether this CResult_TxAckRbfDecodeErrorZ 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_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_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_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_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, @@ -17245,13 +17496,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_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> 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_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() } { @@ -17264,16 +17515,16 @@ impl Drop for CResult_TxAckRbfDecodeErrorZ { } } } -impl From> for CResult_TxAckRbfDecodeErrorZ { - 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_TxAckRbfDecodeErrorZPtr { result } + CResult_FundingCreatedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAckRbfDecodeErrorZPtr { err } + CResult_FundingCreatedDecodeErrorZPtr { err } }; Self { contents, @@ -17281,59 +17532,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_FundingCreatedDecodeErrorZPtr { + 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_FundingCreatedDecodeErrorZPtr { 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_FundingCreatedDecodeErrorZ 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_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAbortDecodeErrorZ -pub union CResult_TxAbortDecodeErrorZPtr { +/// 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::TxAbort, + 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_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_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_TxAbortDecodeErrorZ { - /// The contents of this CResult_TxAbortDecodeErrorZ, 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_TxAbortDecodeErrorZPtr, - /// Whether this CResult_TxAbortDecodeErrorZ 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_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_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_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_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, @@ -17341,13 +17592,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_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> 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_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() } { @@ -17360,16 +17611,16 @@ impl Drop for CResult_TxAbortDecodeErrorZ { } } } -impl From> for CResult_TxAbortDecodeErrorZ { - 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_TxAbortDecodeErrorZPtr { result } + CResult_FundingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAbortDecodeErrorZPtr { err } + CResult_FundingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17377,59 +17628,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_FundingSignedDecodeErrorZPtr { + 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_FundingSignedDecodeErrorZPtr { 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_FundingSignedDecodeErrorZ 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_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AnnouncementSignaturesDecodeErrorZ -pub union CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// 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::AnnouncementSignatures, + 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_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_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_AnnouncementSignaturesDecodeErrorZ { - /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, 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_AnnouncementSignaturesDecodeErrorZPtr, - /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ 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_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_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_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_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, @@ -17437,13 +17688,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_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> 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_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() } { @@ -17456,16 +17707,16 @@ impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { } } } -impl From> for CResult_AnnouncementSignaturesDecodeErrorZ { - 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_AnnouncementSignaturesDecodeErrorZPtr { result } + CResult_ChannelReadyDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AnnouncementSignaturesDecodeErrorZPtr { err } + CResult_ChannelReadyDecodeErrorZPtr { err } }; Self { contents, @@ -17473,59 +17724,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_ChannelReadyDecodeErrorZPtr { + 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_ChannelReadyDecodeErrorZPtr { 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_ChannelReadyDecodeErrorZ 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_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReestablishDecodeErrorZ -pub union CResult_ChannelReestablishDecodeErrorZPtr { +/// 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::ChannelReestablish, + 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_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_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_ChannelReestablishDecodeErrorZ { - /// The contents of this CResult_ChannelReestablishDecodeErrorZ, 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_ChannelReestablishDecodeErrorZPtr, - /// Whether this CResult_ChannelReestablishDecodeErrorZ 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_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_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_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_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, @@ -17533,13 +17784,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_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> 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_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() } { @@ -17552,16 +17803,16 @@ impl Drop for CResult_ChannelReestablishDecodeErrorZ { } } } -impl From> for CResult_ChannelReestablishDecodeErrorZ { - 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_ChannelReestablishDecodeErrorZPtr { result } + CResult_InitDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReestablishDecodeErrorZPtr { err } + CResult_InitDecodeErrorZPtr { err } }; Self { contents, @@ -17569,59 +17820,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_InitDecodeErrorZPtr { + 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_InitDecodeErrorZPtr { 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_InitDecodeErrorZ 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_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedDecodeErrorZ -pub union CResult_ClosingSignedDecodeErrorZPtr { +/// 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::ClosingSigned, + 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_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_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_ClosingSignedDecodeErrorZ { - /// The contents of this CResult_ClosingSignedDecodeErrorZ, 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_ClosingSignedDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedDecodeErrorZ 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_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_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_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_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, @@ -17629,13 +17880,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_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> 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_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() } { @@ -17648,16 +17899,16 @@ impl Drop for CResult_ClosingSignedDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedDecodeErrorZ { - 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_ClosingSignedDecodeErrorZPtr { result } + CResult_OpenChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedDecodeErrorZPtr { err } + CResult_OpenChannelDecodeErrorZPtr { err } }; Self { contents, @@ -17665,59 +17916,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_OpenChannelDecodeErrorZPtr { + 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_OpenChannelDecodeErrorZPtr { 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_OpenChannelDecodeErrorZ 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_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ -pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// 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::ClosingSignedFeeRange, + 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_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_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_ClosingSignedFeeRangeDecodeErrorZ { - /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, 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_ClosingSignedFeeRangeDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ 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_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_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_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_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, @@ -17725,13 +17976,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_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> 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_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() } { @@ -17744,16 +17995,16 @@ impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedFeeRangeDecodeErrorZ { - 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_ClosingSignedFeeRangeDecodeErrorZPtr { result } + CResult_OpenChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } + CResult_OpenChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -17761,59 +18012,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_OpenChannelV2DecodeErrorZPtr { + 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_OpenChannelV2DecodeErrorZPtr { 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_OpenChannelV2DecodeErrorZ 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_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentSignedDecodeErrorZ -pub union CResult_CommitmentSignedDecodeErrorZPtr { +/// 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::CommitmentSigned, + 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_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_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_CommitmentSignedDecodeErrorZ { - /// The contents of this CResult_CommitmentSignedDecodeErrorZ, 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_CommitmentSignedDecodeErrorZPtr, - /// Whether this CResult_CommitmentSignedDecodeErrorZ 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_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_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_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_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, @@ -17821,13 +18072,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_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> 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_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() } { @@ -17840,16 +18091,16 @@ impl Drop for CResult_CommitmentSignedDecodeErrorZ { } } } -impl From> for CResult_CommitmentSignedDecodeErrorZ { - 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_CommitmentSignedDecodeErrorZPtr { result } + CResult_RevokeAndACKDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentSignedDecodeErrorZPtr { err } + CResult_RevokeAndACKDecodeErrorZPtr { err } }; Self { contents, @@ -17857,59 +18108,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_RevokeAndACKDecodeErrorZPtr { + 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_RevokeAndACKDecodeErrorZPtr { 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_RevokeAndACKDecodeErrorZ 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_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingCreatedDecodeErrorZ -pub union CResult_FundingCreatedDecodeErrorZPtr { +/// 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::FundingCreated, + 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_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_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_FundingCreatedDecodeErrorZ { - /// The contents of this CResult_FundingCreatedDecodeErrorZ, 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_FundingCreatedDecodeErrorZPtr, - /// Whether this CResult_FundingCreatedDecodeErrorZ 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_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_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_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_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, @@ -17917,13 +18168,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_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> 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_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() } { @@ -17936,16 +18187,16 @@ impl Drop for CResult_FundingCreatedDecodeErrorZ { } } } -impl From> for CResult_FundingCreatedDecodeErrorZ { - 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_FundingCreatedDecodeErrorZPtr { result } + CResult_ShutdownDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingCreatedDecodeErrorZPtr { err } + CResult_ShutdownDecodeErrorZPtr { err } }; Self { contents, @@ -17953,59 +18204,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_ShutdownDecodeErrorZPtr { + 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_ShutdownDecodeErrorZPtr { 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_ShutdownDecodeErrorZ 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_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingSignedDecodeErrorZ -pub union CResult_FundingSignedDecodeErrorZPtr { +/// 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::FundingSigned, + 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_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_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_FundingSignedDecodeErrorZ { - /// The contents of this CResult_FundingSignedDecodeErrorZ, 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_FundingSignedDecodeErrorZPtr, - /// Whether this CResult_FundingSignedDecodeErrorZ 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_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_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_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_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, @@ -18013,13 +18264,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_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> 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_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() } { @@ -18032,16 +18283,16 @@ impl Drop for CResult_FundingSignedDecodeErrorZ { } } } -impl From> for CResult_FundingSignedDecodeErrorZ { - 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_FundingSignedDecodeErrorZPtr { result } + CResult_UpdateFailHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingSignedDecodeErrorZPtr { err } + CResult_UpdateFailHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18049,59 +18300,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_UpdateFailHTLCDecodeErrorZPtr { + 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_UpdateFailHTLCDecodeErrorZPtr { 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_UpdateFailHTLCDecodeErrorZ 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_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReadyDecodeErrorZ -pub union CResult_ChannelReadyDecodeErrorZPtr { +/// 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::ChannelReady, + 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_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_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_ChannelReadyDecodeErrorZ { - /// The contents of this CResult_ChannelReadyDecodeErrorZ, 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_ChannelReadyDecodeErrorZPtr, - /// Whether this CResult_ChannelReadyDecodeErrorZ 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_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_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_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_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, @@ -18109,13 +18360,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_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> 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_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() } { @@ -18128,16 +18379,16 @@ impl Drop for CResult_ChannelReadyDecodeErrorZ { } } } -impl From> for CResult_ChannelReadyDecodeErrorZ { - 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_ChannelReadyDecodeErrorZPtr { result } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReadyDecodeErrorZPtr { err } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18145,59 +18396,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_UpdateFailMalformedHTLCDecodeErrorZPtr { + 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_UpdateFailMalformedHTLCDecodeErrorZPtr { 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_UpdateFailMalformedHTLCDecodeErrorZ 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) } +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InitDecodeErrorZ -pub union CResult_InitDecodeErrorZPtr { +/// 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::Init, + 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_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_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_InitDecodeErrorZ { - /// The contents of this CResult_InitDecodeErrorZ, 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_InitDecodeErrorZPtr, - /// Whether this CResult_InitDecodeErrorZ 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_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_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_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_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, @@ -18205,13 +18456,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_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> 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_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() } { @@ -18224,16 +18475,16 @@ impl Drop for CResult_InitDecodeErrorZ { } } } -impl From> for CResult_InitDecodeErrorZ { - 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_InitDecodeErrorZPtr { result } + CResult_UpdateFeeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InitDecodeErrorZPtr { err } + CResult_UpdateFeeDecodeErrorZPtr { err } }; Self { contents, @@ -18241,59 +18492,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_UpdateFeeDecodeErrorZPtr { + 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_UpdateFeeDecodeErrorZPtr { 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_UpdateFeeDecodeErrorZ 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_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelDecodeErrorZ -pub union CResult_OpenChannelDecodeErrorZPtr { +/// 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::OpenChannel, + 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_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_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_OpenChannelDecodeErrorZ { - /// The contents of this CResult_OpenChannelDecodeErrorZ, 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_OpenChannelDecodeErrorZPtr, - /// Whether this CResult_OpenChannelDecodeErrorZ 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_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_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_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_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, @@ -18301,13 +18552,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_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> 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_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() } { @@ -18320,16 +18571,16 @@ impl Drop for CResult_OpenChannelDecodeErrorZ { } } } -impl From> for CResult_OpenChannelDecodeErrorZ { - 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_OpenChannelDecodeErrorZPtr { result } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelDecodeErrorZPtr { err } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18337,59 +18588,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_UpdateFulfillHTLCDecodeErrorZPtr { + 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_UpdateFulfillHTLCDecodeErrorZPtr { 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_UpdateFulfillHTLCDecodeErrorZ 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_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelV2DecodeErrorZ -pub union CResult_OpenChannelV2DecodeErrorZPtr { +/// 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::OpenChannelV2, + 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_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_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_OpenChannelV2DecodeErrorZ { - /// The contents of this CResult_OpenChannelV2DecodeErrorZ, 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_OpenChannelV2DecodeErrorZPtr, - /// Whether this CResult_OpenChannelV2DecodeErrorZ 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_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_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_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_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, @@ -18397,13 +18648,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_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> 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_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() } { @@ -18416,16 +18667,16 @@ impl Drop for CResult_OpenChannelV2DecodeErrorZ { } } } -impl From> for CResult_OpenChannelV2DecodeErrorZ { - 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_OpenChannelV2DecodeErrorZPtr { result } + CResult_OnionPacketDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelV2DecodeErrorZPtr { err } + CResult_OnionPacketDecodeErrorZPtr { err } }; Self { contents, @@ -18433,59 +18684,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_OnionPacketDecodeErrorZPtr { + 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_OnionPacketDecodeErrorZPtr { 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_OnionPacketDecodeErrorZ 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_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RevokeAndACKDecodeErrorZ -pub union CResult_RevokeAndACKDecodeErrorZPtr { +/// 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::RevokeAndACK, + 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_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_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_RevokeAndACKDecodeErrorZ { - /// The contents of this CResult_RevokeAndACKDecodeErrorZ, 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_RevokeAndACKDecodeErrorZPtr, - /// Whether this CResult_RevokeAndACKDecodeErrorZ 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_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_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_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_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, @@ -18493,13 +18744,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_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> 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_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() } { @@ -18512,16 +18763,16 @@ impl Drop for CResult_RevokeAndACKDecodeErrorZ { } } } -impl From> for CResult_RevokeAndACKDecodeErrorZ { - 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_RevokeAndACKDecodeErrorZPtr { result } + CResult_UpdateAddHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RevokeAndACKDecodeErrorZPtr { err } + CResult_UpdateAddHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18529,59 +18780,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_UpdateAddHTLCDecodeErrorZPtr { + 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_UpdateAddHTLCDecodeErrorZPtr { 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_UpdateAddHTLCDecodeErrorZ 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_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownDecodeErrorZ -pub union CResult_ShutdownDecodeErrorZPtr { +/// 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::Shutdown, + 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_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_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_ShutdownDecodeErrorZ { - /// The contents of this CResult_ShutdownDecodeErrorZ, 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_ShutdownDecodeErrorZPtr, - /// Whether this CResult_ShutdownDecodeErrorZ 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_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_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_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_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, @@ -18589,13 +18840,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_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> 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_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() } { @@ -18608,16 +18859,16 @@ impl Drop for CResult_ShutdownDecodeErrorZ { } } } -impl From> for CResult_ShutdownDecodeErrorZ { - 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_ShutdownDecodeErrorZPtr { result } + CResult_OnionMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownDecodeErrorZPtr { err } + CResult_OnionMessageDecodeErrorZPtr { err } }; Self { contents, @@ -18625,59 +18876,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_OnionMessageDecodeErrorZPtr { + 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_OnionMessageDecodeErrorZPtr { 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_OnionMessageDecodeErrorZ 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_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailHTLCDecodeErrorZ -pub union CResult_UpdateFailHTLCDecodeErrorZPtr { +/// 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::UpdateFailHTLC, + 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_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_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_UpdateFailHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, 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_UpdateFailHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailHTLCDecodeErrorZ 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_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_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_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_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, @@ -18685,13 +18936,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_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> 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_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() } { @@ -18704,16 +18955,16 @@ impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailHTLCDecodeErrorZ { - 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_UpdateFailHTLCDecodeErrorZPtr { result } + CResult_FinalOnionHopDataDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailHTLCDecodeErrorZPtr { err } + CResult_FinalOnionHopDataDecodeErrorZPtr { err } }; Self { contents, @@ -18721,59 +18972,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_FinalOnionHopDataDecodeErrorZPtr { + 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_FinalOnionHopDataDecodeErrorZPtr { 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_FinalOnionHopDataDecodeErrorZ 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_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ -pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// 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::UpdateFailMalformedHTLC, + 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_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_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_UpdateFailMalformedHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, 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_UpdateFailMalformedHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ 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_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_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_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_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, @@ -18781,13 +19032,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_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> 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_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() } { @@ -18800,16 +19051,16 @@ impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailMalformedHTLCDecodeErrorZ { - 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result } + CResult_PingDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } + CResult_PingDecodeErrorZPtr { err } }; Self { contents, @@ -18817,59 +19068,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_PingDecodeErrorZPtr { + 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_PingDecodeErrorZPtr { 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_PingDecodeErrorZ 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_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFeeDecodeErrorZ -pub union CResult_UpdateFeeDecodeErrorZPtr { +/// 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::UpdateFee, + 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_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_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_UpdateFeeDecodeErrorZ { - /// The contents of this CResult_UpdateFeeDecodeErrorZ, 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_UpdateFeeDecodeErrorZPtr, - /// Whether this CResult_UpdateFeeDecodeErrorZ 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_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_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_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_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, @@ -18877,13 +19128,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_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> 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_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() } { @@ -18896,16 +19147,16 @@ impl Drop for CResult_UpdateFeeDecodeErrorZ { } } } -impl From> for CResult_UpdateFeeDecodeErrorZ { - 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_UpdateFeeDecodeErrorZPtr { result } + CResult_PongDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFeeDecodeErrorZPtr { err } + CResult_PongDecodeErrorZPtr { err } }; Self { contents, @@ -18913,59 +19164,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_PongDecodeErrorZPtr { + 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_PongDecodeErrorZPtr { 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_PongDecodeErrorZ 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_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ -pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// 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::UpdateFulfillHTLC, + 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_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_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_UpdateFulfillHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, 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_UpdateFulfillHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ 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_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_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_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_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, @@ -18973,13 +19224,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_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> 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_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() } { @@ -18992,16 +19243,16 @@ impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFulfillHTLCDecodeErrorZ { - 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_UpdateFulfillHTLCDecodeErrorZPtr { result } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19009,59 +19260,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_UnsignedChannelAnnouncementDecodeErrorZPtr { + 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_UnsignedChannelAnnouncementDecodeErrorZPtr { 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_UnsignedChannelAnnouncementDecodeErrorZ 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_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionPacketDecodeErrorZ -pub union CResult_OnionPacketDecodeErrorZPtr { +/// 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::OnionPacket, + 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_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_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_OnionPacketDecodeErrorZ { - /// The contents of this CResult_OnionPacketDecodeErrorZ, 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_OnionPacketDecodeErrorZPtr, - /// Whether this CResult_OnionPacketDecodeErrorZ 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_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_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_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_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, @@ -19069,13 +19320,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_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> 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_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() } { @@ -19088,16 +19339,16 @@ impl Drop for CResult_OnionPacketDecodeErrorZ { } } } -impl From> for CResult_OnionPacketDecodeErrorZ { - 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_OnionPacketDecodeErrorZPtr { result } + CResult_ChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionPacketDecodeErrorZPtr { err } + CResult_ChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19105,59 +19356,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_ChannelAnnouncementDecodeErrorZPtr { + 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_ChannelAnnouncementDecodeErrorZPtr { 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_ChannelAnnouncementDecodeErrorZ 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_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateAddHTLCDecodeErrorZ -pub union CResult_UpdateAddHTLCDecodeErrorZPtr { +/// 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::UpdateAddHTLC, + 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_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_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_UpdateAddHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, 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_UpdateAddHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateAddHTLCDecodeErrorZ 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_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_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_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_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, @@ -19165,13 +19416,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_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> 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_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() } { @@ -19184,16 +19435,16 @@ impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateAddHTLCDecodeErrorZ { - 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_UpdateAddHTLCDecodeErrorZPtr { result } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateAddHTLCDecodeErrorZPtr { err } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19201,59 +19452,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_UnsignedChannelUpdateDecodeErrorZPtr { + 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_UnsignedChannelUpdateDecodeErrorZPtr { 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_UnsignedChannelUpdateDecodeErrorZ 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_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionMessageDecodeErrorZ -pub union CResult_OnionMessageDecodeErrorZPtr { +/// 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::OnionMessage, + 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_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_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_OnionMessageDecodeErrorZ { - /// The contents of this CResult_OnionMessageDecodeErrorZ, 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_OnionMessageDecodeErrorZPtr, - /// Whether this CResult_OnionMessageDecodeErrorZ 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_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_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_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_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, @@ -19261,13 +19512,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_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> 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_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() } { @@ -19280,16 +19531,16 @@ impl Drop for CResult_OnionMessageDecodeErrorZ { } } } -impl From> for CResult_OnionMessageDecodeErrorZ { - 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_OnionMessageDecodeErrorZPtr { result } + CResult_ChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionMessageDecodeErrorZPtr { err } + CResult_ChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19297,59 +19548,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_ChannelUpdateDecodeErrorZPtr { + 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_ChannelUpdateDecodeErrorZPtr { 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_ChannelUpdateDecodeErrorZ 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_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FinalOnionHopDataDecodeErrorZ -pub union CResult_FinalOnionHopDataDecodeErrorZPtr { +/// 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::FinalOnionHopData, + 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_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_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_FinalOnionHopDataDecodeErrorZ { - /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, 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_FinalOnionHopDataDecodeErrorZPtr, - /// Whether this CResult_FinalOnionHopDataDecodeErrorZ 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_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_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_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_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, @@ -19357,13 +19608,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_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> 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_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() } { @@ -19376,16 +19627,16 @@ impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { } } } -impl From> for CResult_FinalOnionHopDataDecodeErrorZ { - 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_FinalOnionHopDataDecodeErrorZPtr { result } + CResult_ErrorMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FinalOnionHopDataDecodeErrorZPtr { err } + CResult_ErrorMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19393,59 +19644,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_ErrorMessageDecodeErrorZPtr { + 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_ErrorMessageDecodeErrorZPtr { 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_ErrorMessageDecodeErrorZ 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_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PingDecodeErrorZ -pub union CResult_PingDecodeErrorZPtr { +/// 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::Ping, + 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_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_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_PingDecodeErrorZ { - /// The contents of this CResult_PingDecodeErrorZ, 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_PingDecodeErrorZPtr, - /// Whether this CResult_PingDecodeErrorZ 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_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_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_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_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, @@ -19453,13 +19704,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_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> 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_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() } { @@ -19472,16 +19723,16 @@ impl Drop for CResult_PingDecodeErrorZ { } } } -impl From> for CResult_PingDecodeErrorZ { - 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_PingDecodeErrorZPtr { result } + CResult_WarningMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PingDecodeErrorZPtr { err } + CResult_WarningMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19489,59 +19740,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_WarningMessageDecodeErrorZPtr { + 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_WarningMessageDecodeErrorZPtr { 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_WarningMessageDecodeErrorZ 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_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PongDecodeErrorZ -pub union CResult_PongDecodeErrorZPtr { +/// 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::Pong, + 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_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_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_PongDecodeErrorZ { - /// The contents of this CResult_PongDecodeErrorZ, 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_PongDecodeErrorZPtr, - /// Whether this CResult_PongDecodeErrorZ 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_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_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_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_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, @@ -19549,13 +19800,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_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> 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_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() } { @@ -19568,16 +19819,16 @@ impl Drop for CResult_PongDecodeErrorZ { } } } -impl From> for CResult_PongDecodeErrorZ { - 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_PongDecodeErrorZPtr { result } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PongDecodeErrorZPtr { err } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19585,59 +19836,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_UnsignedNodeAnnouncementDecodeErrorZPtr { + 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_UnsignedNodeAnnouncementDecodeErrorZPtr { 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_UnsignedNodeAnnouncementDecodeErrorZ 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_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ -pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// 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::UnsignedChannelAnnouncement, + 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_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_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_UnsignedChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, 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_UnsignedChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ 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_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_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_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_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, @@ -19645,13 +19896,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_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> 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_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() } { @@ -19664,16 +19915,16 @@ impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelAnnouncementDecodeErrorZ { - 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result } + CResult_NodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } + CResult_NodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19681,59 +19932,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_NodeAnnouncementDecodeErrorZPtr { + 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_NodeAnnouncementDecodeErrorZPtr { 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_NodeAnnouncementDecodeErrorZ 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_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelAnnouncementDecodeErrorZ -pub union CResult_ChannelAnnouncementDecodeErrorZPtr { +/// 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::ChannelAnnouncement, + 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_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_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_ChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, 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_ChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_ChannelAnnouncementDecodeErrorZ 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_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_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_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_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, @@ -19741,13 +19992,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_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> 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_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() } { @@ -19760,16 +20011,16 @@ impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_ChannelAnnouncementDecodeErrorZ { - 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_ChannelAnnouncementDecodeErrorZPtr { result } + CResult_QueryShortChannelIdsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelAnnouncementDecodeErrorZPtr { err } + CResult_QueryShortChannelIdsDecodeErrorZPtr { err } }; Self { contents, @@ -19777,59 +20028,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_QueryShortChannelIdsDecodeErrorZPtr { + 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_QueryShortChannelIdsDecodeErrorZPtr { 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_QueryShortChannelIdsDecodeErrorZ 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_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ -pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// 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::UnsignedChannelUpdate, + 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_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_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_UnsignedChannelUpdateDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, 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_UnsignedChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ 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_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_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_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_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, @@ -19837,13 +20088,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_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> 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_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() } { @@ -19856,16 +20107,16 @@ impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelUpdateDecodeErrorZ { - 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_UnsignedChannelUpdateDecodeErrorZPtr { result } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err } }; Self { contents, @@ -19873,59 +20124,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_ReplyShortChannelIdsEndDecodeErrorZPtr { + 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_ReplyShortChannelIdsEndDecodeErrorZPtr { 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_ReplyShortChannelIdsEndDecodeErrorZ 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_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelUpdateDecodeErrorZ -pub union CResult_ChannelUpdateDecodeErrorZPtr { +/// 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::ChannelUpdate, + 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_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_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_ChannelUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelUpdateDecodeErrorZ, 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_ChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelUpdateDecodeErrorZ 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_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_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_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_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, @@ -19933,13 +20184,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_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> 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_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() } { @@ -19952,16 +20203,16 @@ impl Drop for CResult_ChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_ChannelUpdateDecodeErrorZ { - 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_ChannelUpdateDecodeErrorZPtr { result } + CResult_QueryChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelUpdateDecodeErrorZPtr { err } + CResult_QueryChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -19969,59 +20220,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_QueryChannelRangeDecodeErrorZPtr { + 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_QueryChannelRangeDecodeErrorZPtr { 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_QueryChannelRangeDecodeErrorZ 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_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ErrorMessageDecodeErrorZ -pub union CResult_ErrorMessageDecodeErrorZPtr { +/// 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::ErrorMessage, + 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_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_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_ErrorMessageDecodeErrorZ { - /// The contents of this CResult_ErrorMessageDecodeErrorZ, 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_ErrorMessageDecodeErrorZPtr, - /// Whether this CResult_ErrorMessageDecodeErrorZ 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_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_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_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_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, @@ -20029,13 +20280,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_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> 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_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() } { @@ -20048,16 +20299,16 @@ impl Drop for CResult_ErrorMessageDecodeErrorZ { } } } -impl From> for CResult_ErrorMessageDecodeErrorZ { - 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_ErrorMessageDecodeErrorZPtr { result } + CResult_ReplyChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ErrorMessageDecodeErrorZPtr { err } + CResult_ReplyChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -20065,59 +20316,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_ReplyChannelRangeDecodeErrorZPtr { + 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_ReplyChannelRangeDecodeErrorZPtr { 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_ReplyChannelRangeDecodeErrorZ 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_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_WarningMessageDecodeErrorZ -pub union CResult_WarningMessageDecodeErrorZPtr { +/// 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::WarningMessage, + 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_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_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_WarningMessageDecodeErrorZ { - /// The contents of this CResult_WarningMessageDecodeErrorZ, 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_WarningMessageDecodeErrorZPtr, - /// Whether this CResult_WarningMessageDecodeErrorZ 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_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_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_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_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, @@ -20125,13 +20376,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_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> 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_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() } { @@ -20144,16 +20395,16 @@ impl Drop for CResult_WarningMessageDecodeErrorZ { } } } -impl From> for CResult_WarningMessageDecodeErrorZ { - 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_WarningMessageDecodeErrorZPtr { result } + CResult_GossipTimestampFilterDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_WarningMessageDecodeErrorZPtr { err } + CResult_GossipTimestampFilterDecodeErrorZPtr { err } }; Self { contents, @@ -20161,59 +20412,105 @@ 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_GossipTimestampFilterDecodeErrorZPtr { + 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_GossipTimestampFilterDecodeErrorZPtr { 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_GossipTimestampFilterDecodeErrorZ 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_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ -pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_PhantomRouteHintsZ { + /// 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::PhantomRouteHints, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_PhantomRouteHintsZ { + #[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::PhantomRouteHints] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_PhantomRouteHintsZ { + 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_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { } +impl Drop for CVec_PhantomRouteHintsZ { + 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_PhantomRouteHintsZ { + 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_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::ln::msgs::UnsignedNodeAnnouncement, + 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::SignOrCreationError, } #[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_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_UnsignedNodeAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, 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_UnsignedNodeAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ 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_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_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_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_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, @@ -20221,13 +20518,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_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> 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_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() } { @@ -20240,16 +20537,16 @@ impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedNodeAnnouncementDecodeErrorZ { - 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result } + CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } + CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } }; Self { contents, @@ -20257,59 +20554,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_Bolt11InvoiceSignOrCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { - 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_UnsignedNodeAnnouncementDecodeErrorZ 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_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { 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, @@ -20317,13 +20651,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() } { @@ -20336,16 +20670,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, @@ -20353,59 +20687,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, @@ -20413,13 +20747,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() } { @@ -20432,16 +20766,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, @@ -20449,59 +20783,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 }))) + 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_QueryShortChannelIdsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` +/// 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_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ -pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +#[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] +/// 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 COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) } +#[repr(C)] +/// 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, @@ -20509,13 +20880,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() } { @@ -20528,16 +20899,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, @@ -20545,59 +20916,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, @@ -20605,13 +20976,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() } { @@ -20624,16 +20995,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, @@ -20641,59 +21012,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, @@ -20701,13 +21072,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() } { @@ -20720,16 +21091,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, @@ -20737,59 +21108,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, @@ -20797,13 +21168,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() } { @@ -20816,16 +21187,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, @@ -20833,47 +21204,84 @@ 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)] -/// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. +#[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 + None +} +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::ChannelShutdownState { + 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) +} +#[no_mangle] +/// 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::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) } +#[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_PhantomRouteHintsZ { +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::channelmanager::PhantomRouteHints, + pub data: *mut crate::lightning::ln::channel_state::InboundHTLCDetails, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_PhantomRouteHintsZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +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::channelmanager::PhantomRouteHints] { + #[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_PhantomRouteHintsZ { - fn from(v: Vec) -> Self { +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() } } @@ -20881,14 +21289,14 @@ impl From> for CVec } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { } -impl Drop for CVec_PhantomRouteHintsZ { +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_PhantomRouteHintsZ { +impl Clone for CVec_InboundHTLCDetailsZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -20897,41 +21305,87 @@ impl Clone for CVec_PhantomRouteHintsZ { } } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ -pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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::lightning_invoice::Bolt11Invoice, + 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_invoice::SignOrCreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[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. +/// 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_Bolt11InvoiceSignOrCreationErrorZ { - /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, 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_Bolt11InvoiceSignOrCreationErrorZPtr, - /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ 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_Bolt11InvoiceSignOrCreationErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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_Bolt11InvoiceSignOrCreationErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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, @@ -20939,13 +21393,13 @@ pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightn } /// 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 { +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> 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 { +/// 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() } { @@ -20958,16 +21412,16 @@ impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { } } } -impl From> for CResult_Bolt11InvoiceSignOrCreationErrorZ { - 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_Bolt11InvoiceSignOrCreationErrorZPtr { result } + CResult_ChannelDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } + CResult_ChannelDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -20975,23 +21429,119 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - 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_Bolt11InvoiceSignOrCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr { + 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` +/// 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_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// 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::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_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_ChannelShutdownStateDecodeErrorZ { + /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, 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 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 { + 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 { + 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_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> 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 { + 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_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_ChannelShutdownStateDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelShutdownStateDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelShutdownStateDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_ChannelShutdownStateDecodeErrorZPtr { + 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` +/// 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++ diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index 3d14588..858c964 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -144,6 +144,11 @@ pub extern "C" fn OutPoint_hash(o: &OutPoint) -> u64 { core::hash::Hasher::finish(&hasher) } #[no_mangle] +/// Get the string representation of a OutPoint object +pub extern "C" fn OutPoint_to_str(o: &crate::lightning::chain::transaction::OutPoint) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} +#[no_mangle] /// Serialize the OutPoint object into a byte array which can be read by OutPoint_read pub extern "C" fn OutPoint_write(obj: &crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) diff --git a/lightning-c-bindings/src/lightning/events/mod.rs b/lightning-c-bindings/src/lightning/events/mod.rs index f7b57a6..2aa4e51 100644 --- a/lightning-c-bindings/src/lightning/events/mod.rs +++ b/lightning-c-bindings/src/lightning/events/mod.rs @@ -963,6 +963,11 @@ pub extern "C" fn ClosureReason_eq(a: &ClosureReason, b: &ClosureReason) -> bool if &a.to_native() == &b.to_native() { true } else { false } } #[no_mangle] +/// Get the string representation of a ClosureReason object +pub extern "C" fn ClosureReason_to_str(o: &crate::lightning::events::ClosureReason) -> Str { + alloc::format!("{}", &o.to_native()).into() +} +#[no_mangle] /// Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read pub extern "C" fn ClosureReason_write(obj: &crate::lightning::events::ClosureReason) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) diff --git a/lightning-c-bindings/src/lightning/ln/channel_state.rs b/lightning-c-bindings/src/lightning/ln/channel_state.rs new file mode 100644 index 0000000..4ebd697 --- /dev/null +++ b/lightning-c-bindings/src/lightning/ln/channel_state.rs @@ -0,0 +1,1990 @@ +// 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. + +//! Information about the state of a channel. + +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}; + +/// Exposes the state of pending inbound HTLCs. +/// +/// At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes +/// through the following states in the state machine: +/// - Announced for addition by the originating node through the update_add_htlc message. +/// - Added to the commitment transaction of the receiving node and originating node in turn +/// through the exchange of commitment_signed and revoke_and_ack messages. +/// - Announced for resolution (fulfillment or failure) by the receiving node through either one of +/// the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. +/// - Removed from the commitment transaction of the originating node and receiving node in turn +/// through the exchange of commitment_signed and revoke_and_ack messages. +/// +/// This can be used to inspect what next message an HTLC is waiting for to advance its state. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum InboundHTLCStateDetails { + /// We have added this HTLC in our commitment transaction by receiving commitment_signed and + /// returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + /// before this HTLC is included on the remote commitment transaction. + AwaitingRemoteRevokeToAdd, + /// This HTLC has been included in the commitment_signed and revoke_and_ack messages on both sides + /// and is included in both commitment transactions. + /// + /// This HTLC is now safe to either forward or be claimed as a payment by us. The HTLC will + /// remain in this state until the forwarded upstream HTLC has been resolved and we resolve this + /// HTLC correspondingly, or until we claim it as a payment. If it is part of a multipart + /// payment, it will only be claimed together with other required parts. + Committed, + /// We have received the preimage for this HTLC and it is being removed by fulfilling it with + /// update_fulfill_htlc. This HTLC is still on both commitment transactions, but we are awaiting + /// the appropriate revoke_and_ack's from the remote before this HTLC is removed from the remote + /// commitment transaction after update_fulfill_htlc. + AwaitingRemoteRevokeToRemoveFulfill, + /// The HTLC is being removed by failing it with update_fail_htlc or update_fail_malformed_htlc. + /// This HTLC is still on both commitment transactions, but we are awaiting the appropriate + /// revoke_and_ack's from the remote before this HTLC is removed from the remote commitment + /// transaction. + AwaitingRemoteRevokeToRemoveFail, +} +use lightning::ln::channel_state::InboundHTLCStateDetails as InboundHTLCStateDetailsImport; +pub(crate) type nativeInboundHTLCStateDetails = InboundHTLCStateDetailsImport; + +impl InboundHTLCStateDetails { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeInboundHTLCStateDetails { + match self { + InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + InboundHTLCStateDetails::Committed => nativeInboundHTLCStateDetails::Committed, + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill, + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeInboundHTLCStateDetails { + match self { + InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + InboundHTLCStateDetails::Committed => nativeInboundHTLCStateDetails::Committed, + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill, + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail => nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &InboundHTLCStateDetailsImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeInboundHTLCStateDetails) }; + match native { + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + nativeInboundHTLCStateDetails::Committed => InboundHTLCStateDetails::Committed, + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill => InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill, + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail => InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeInboundHTLCStateDetails) -> Self { + match native { + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + nativeInboundHTLCStateDetails::Committed => InboundHTLCStateDetails::Committed, + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill => InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill, + nativeInboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail => InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail, + } + } +} +/// Creates a copy of the InboundHTLCStateDetails +#[no_mangle] +pub extern "C" fn InboundHTLCStateDetails_clone(orig: &InboundHTLCStateDetails) -> InboundHTLCStateDetails { + 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 InboundHTLCStateDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const InboundHTLCStateDetails)).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 InboundHTLCStateDetails_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut InboundHTLCStateDetails) }; +} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant InboundHTLCStateDetails +pub extern "C" fn InboundHTLCStateDetails_awaiting_remote_revoke_to_add() -> InboundHTLCStateDetails { + InboundHTLCStateDetails::AwaitingRemoteRevokeToAdd} +#[no_mangle] +/// Utility method to constructs a new Committed-variant InboundHTLCStateDetails +pub extern "C" fn InboundHTLCStateDetails_committed() -> InboundHTLCStateDetails { + InboundHTLCStateDetails::Committed} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToRemoveFulfill-variant InboundHTLCStateDetails +pub extern "C" fn InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill() -> InboundHTLCStateDetails { + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFulfill} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToRemoveFail-variant InboundHTLCStateDetails +pub extern "C" fn InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail() -> InboundHTLCStateDetails { + InboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFail} +/// Get a string which allows debug introspection of a InboundHTLCStateDetails object +pub extern "C" fn InboundHTLCStateDetails_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::InboundHTLCStateDetails }).into()} +#[no_mangle] +/// Serialize the InboundHTLCStateDetails object into a byte array which can be read by InboundHTLCStateDetails_read +pub extern "C" fn InboundHTLCStateDetails_write(obj: &crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn InboundHTLCStateDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + InboundHTLCStateDetails_write(unsafe { &*(obj as *const InboundHTLCStateDetails) }) +} +#[no_mangle] +/// Read a InboundHTLCStateDetails from a byte array, created by InboundHTLCStateDetails_write +pub extern "C" fn InboundHTLCStateDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + let res: Result, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser); + 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_InboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_InboundHTLCStateDetailsZ::Some( { crate::lightning::ln::channel_state::InboundHTLCStateDetails::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 +} + +use lightning::ln::channel_state::InboundHTLCDetails as nativeInboundHTLCDetailsImport; +pub(crate) type nativeInboundHTLCDetails = nativeInboundHTLCDetailsImport; + +/// Exposes details around pending inbound HTLCs. +#[must_use] +#[repr(C)] +pub struct InboundHTLCDetails { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeInboundHTLCDetails, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for InboundHTLCDetails { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeInboundHTLCDetails>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the InboundHTLCDetails, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_free(this_obj: InboundHTLCDetails) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InboundHTLCDetails_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInboundHTLCDetails) }; +} +#[allow(unused)] +impl InboundHTLCDetails { + pub(crate) fn get_native_ref(&self) -> &'static nativeInboundHTLCDetails { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInboundHTLCDetails { + 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 nativeInboundHTLCDetails { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The HTLC ID. +/// The IDs are incremented by 1 starting from 0 for each offered HTLC. +/// They are unique per channel and inbound/outbound direction, unless an HTLC was only announced +/// and not part of any commitment transaction. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_htlc_id(this_ptr: &InboundHTLCDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; + *inner_val +} +/// The HTLC ID. +/// The IDs are incremented by 1 starting from 0 for each offered HTLC. +/// They are unique per channel and inbound/outbound direction, unless an HTLC was only announced +/// and not part of any commitment transaction. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_set_htlc_id(this_ptr: &mut InboundHTLCDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; +} +/// The amount in msat. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_amount_msat(this_ptr: &InboundHTLCDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + *inner_val +} +/// The amount in msat. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_set_amount_msat(this_ptr: &mut InboundHTLCDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msat = val; +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_cltv_expiry(this_ptr: &InboundHTLCDetails) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + *inner_val +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_set_cltv_expiry(this_ptr: &mut InboundHTLCDetails, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry = val; +} +/// The payment hash. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_payment_hash(this_ptr: &InboundHTLCDetails) -> *const [u8; 32] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + &inner_val.0 +} +/// 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); +} +/// The state of the HTLC in the state machine. +/// +/// Determines on which commitment transactions the HTLC is included and what message the HTLC is +/// waiting for to advance to the next state. +/// +/// See [`InboundHTLCStateDetails`] for information on the specific states. +/// +/// LDK will always fill this field in, but when downgrading to prior versions of LDK, new +/// states may result in `None` here. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_state(this_ptr: &InboundHTLCDetails) -> crate::c_types::derived::COption_InboundHTLCStateDetailsZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().state; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_InboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_InboundHTLCStateDetailsZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::channel_state::InboundHTLCStateDetails::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val +} +/// The state of the HTLC in the state machine. +/// +/// Determines on which commitment transactions the HTLC is included and what message the HTLC is +/// waiting for to advance to the next state. +/// +/// See [`InboundHTLCStateDetails`] for information on the specific states. +/// +/// LDK will always fill this field in, but when downgrading to prior versions of LDK, new +/// states may result in `None` here. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_set_state(this_ptr: &mut InboundHTLCDetails, mut val: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.state = local_val; +} +/// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed +/// from the local commitment transaction and added to the commitment transaction fee. +/// For non-anchor channels, this takes into account the cost of the second-stage HTLC +/// transactions as well. +/// +/// When the local commitment transaction is broadcasted as part of a unilateral closure, +/// the value of this HTLC will therefore not be claimable but instead burned as a transaction +/// fee. +/// +/// Note that dust limits are specific to each party. An HTLC can be dust for the local +/// commitment transaction but not for the counterparty's commitment transaction and vice versa. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_get_is_dust(this_ptr: &InboundHTLCDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_dust; + *inner_val +} +/// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed +/// from the local commitment transaction and added to the commitment transaction fee. +/// For non-anchor channels, this takes into account the cost of the second-stage HTLC +/// transactions as well. +/// +/// When the local commitment transaction is broadcasted as part of a unilateral closure, +/// the value of this HTLC will therefore not be claimable but instead burned as a transaction +/// fee. +/// +/// Note that dust limits are specific to each party. An HTLC can be dust for the local +/// commitment transaction but not for the counterparty's commitment transaction and vice versa. +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_set_is_dust(this_ptr: &mut InboundHTLCDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_dust = val; +} +/// Constructs a new InboundHTLCDetails given each field +#[must_use] +#[no_mangle] +pub extern "C" fn InboundHTLCDetails_new(mut htlc_id_arg: u64, mut amount_msat_arg: u64, mut cltv_expiry_arg: u32, mut payment_hash_arg: crate::c_types::ThirtyTwoBytes, mut state_arg: crate::c_types::derived::COption_InboundHTLCStateDetailsZ, mut is_dust_arg: bool) -> InboundHTLCDetails { + let mut local_state_arg = { /*state_arg*/ let state_arg_opt = state_arg; if state_arg_opt.is_none() { None } else { Some({ { { state_arg_opt.take() }.into_native() }})} }; + InboundHTLCDetails { inner: ObjOps::heap_alloc(nativeInboundHTLCDetails { + 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), + state: local_state_arg, + is_dust: is_dust_arg, + }), is_owned: true } +} +impl Clone for InboundHTLCDetails { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeInboundHTLCDetails>::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 InboundHTLCDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInboundHTLCDetails)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the InboundHTLCDetails +pub extern "C" fn InboundHTLCDetails_clone(orig: &InboundHTLCDetails) -> InboundHTLCDetails { + orig.clone() +} +/// Get a string which allows debug introspection of a InboundHTLCDetails object +pub extern "C" fn InboundHTLCDetails_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::InboundHTLCDetails }).into()} +#[no_mangle] +/// Serialize the InboundHTLCDetails object into a byte array which can be read by InboundHTLCDetails_read +pub extern "C" fn InboundHTLCDetails_write(obj: &crate::lightning::ln::channel_state::InboundHTLCDetails) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn InboundHTLCDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInboundHTLCDetails) }) +} +#[no_mangle] +/// Read a InboundHTLCDetails from a byte array, created by InboundHTLCDetails_write +pub extern "C" fn InboundHTLCDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InboundHTLCDetailsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::InboundHTLCDetails { 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 +} +/// Exposes the state of pending outbound HTLCs. +/// +/// At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes +/// through the following states in the state machine: +/// - Announced for addition by the originating node through the update_add_htlc message. +/// - Added to the commitment transaction of the receiving node and originating node in turn +/// through the exchange of commitment_signed and revoke_and_ack messages. +/// - Announced for resolution (fulfillment or failure) by the receiving node through either one of +/// the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. +/// - Removed from the commitment transaction of the originating node and receiving node in turn +/// through the exchange of commitment_signed and revoke_and_ack messages. +/// +/// This can be used to inspect what next message an HTLC is waiting for to advance its state. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum OutboundHTLCStateDetails { + /// We are awaiting the appropriate revoke_and_ack's from the remote before the HTLC is added + /// on the remote's commitment transaction after update_add_htlc. + AwaitingRemoteRevokeToAdd, + /// The HTLC has been added to the remote's commitment transaction by sending commitment_signed + /// and receiving revoke_and_ack in return. + /// + /// The HTLC will remain in this state until the remote node resolves the HTLC, or until we + /// unilaterally close the channel due to a timeout with an uncooperative remote node. + Committed, + /// The HTLC has been fulfilled successfully by the remote with a preimage in update_fulfill_htlc, + /// and we removed the HTLC from our commitment transaction by receiving commitment_signed and + /// returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + /// for the removal from its commitment transaction. + AwaitingRemoteRevokeToRemoveSuccess, + /// The HTLC has been failed by the remote with update_fail_htlc or update_fail_malformed_htlc, + /// and we removed the HTLC from our commitment transaction by receiving commitment_signed and + /// returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + /// for the removal from its commitment transaction. + AwaitingRemoteRevokeToRemoveFailure, +} +use lightning::ln::channel_state::OutboundHTLCStateDetails as OutboundHTLCStateDetailsImport; +pub(crate) type nativeOutboundHTLCStateDetails = OutboundHTLCStateDetailsImport; + +impl OutboundHTLCStateDetails { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeOutboundHTLCStateDetails { + match self { + OutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + OutboundHTLCStateDetails::Committed => nativeOutboundHTLCStateDetails::Committed, + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess, + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeOutboundHTLCStateDetails { + match self { + OutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + OutboundHTLCStateDetails::Committed => nativeOutboundHTLCStateDetails::Committed, + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess, + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure => nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &OutboundHTLCStateDetailsImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeOutboundHTLCStateDetails) }; + match native { + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => OutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + nativeOutboundHTLCStateDetails::Committed => OutboundHTLCStateDetails::Committed, + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess => OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess, + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure => OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeOutboundHTLCStateDetails) -> Self { + match native { + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd => OutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd, + nativeOutboundHTLCStateDetails::Committed => OutboundHTLCStateDetails::Committed, + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess => OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess, + nativeOutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure => OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure, + } + } +} +/// Creates a copy of the OutboundHTLCStateDetails +#[no_mangle] +pub extern "C" fn OutboundHTLCStateDetails_clone(orig: &OutboundHTLCStateDetails) -> OutboundHTLCStateDetails { + 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 OutboundHTLCStateDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const OutboundHTLCStateDetails)).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 OutboundHTLCStateDetails_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut OutboundHTLCStateDetails) }; +} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant OutboundHTLCStateDetails +pub extern "C" fn OutboundHTLCStateDetails_awaiting_remote_revoke_to_add() -> OutboundHTLCStateDetails { + OutboundHTLCStateDetails::AwaitingRemoteRevokeToAdd} +#[no_mangle] +/// Utility method to constructs a new Committed-variant OutboundHTLCStateDetails +pub extern "C" fn OutboundHTLCStateDetails_committed() -> OutboundHTLCStateDetails { + OutboundHTLCStateDetails::Committed} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToRemoveSuccess-variant OutboundHTLCStateDetails +pub extern "C" fn OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success() -> OutboundHTLCStateDetails { + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveSuccess} +#[no_mangle] +/// Utility method to constructs a new AwaitingRemoteRevokeToRemoveFailure-variant OutboundHTLCStateDetails +pub extern "C" fn OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure() -> OutboundHTLCStateDetails { + OutboundHTLCStateDetails::AwaitingRemoteRevokeToRemoveFailure} +/// Get a string which allows debug introspection of a OutboundHTLCStateDetails object +pub extern "C" fn OutboundHTLCStateDetails_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::OutboundHTLCStateDetails }).into()} +#[no_mangle] +/// Serialize the OutboundHTLCStateDetails object into a byte array which can be read by OutboundHTLCStateDetails_read +pub extern "C" fn OutboundHTLCStateDetails_write(obj: &crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn OutboundHTLCStateDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + OutboundHTLCStateDetails_write(unsafe { &*(obj as *const OutboundHTLCStateDetails) }) +} +#[no_mangle] +/// Read a OutboundHTLCStateDetails from a byte array, created by OutboundHTLCStateDetails_write +pub extern "C" fn OutboundHTLCStateDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + let res: Result, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser); + 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_OutboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_OutboundHTLCStateDetailsZ::Some( { crate::lightning::ln::channel_state::OutboundHTLCStateDetails::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 +} + +use lightning::ln::channel_state::OutboundHTLCDetails as nativeOutboundHTLCDetailsImport; +pub(crate) type nativeOutboundHTLCDetails = nativeOutboundHTLCDetailsImport; + +/// Exposes details around pending outbound HTLCs. +#[must_use] +#[repr(C)] +pub struct OutboundHTLCDetails { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeOutboundHTLCDetails, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for OutboundHTLCDetails { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOutboundHTLCDetails>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OutboundHTLCDetails, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_free(this_obj: OutboundHTLCDetails) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OutboundHTLCDetails_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOutboundHTLCDetails) }; +} +#[allow(unused)] +impl OutboundHTLCDetails { + pub(crate) fn get_native_ref(&self) -> &'static nativeOutboundHTLCDetails { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOutboundHTLCDetails { + 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 nativeOutboundHTLCDetails { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The HTLC ID. +/// The IDs are incremented by 1 starting from 0 for each offered HTLC. +/// They are unique per channel and inbound/outbound direction, unless an HTLC was only announced +/// and not part of any commitment transaction. +/// +/// Not present when we are awaiting a remote revocation and the HTLC is not added yet. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_htlc_id(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; + 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 HTLC ID. +/// The IDs are incremented by 1 starting from 0 for each offered HTLC. +/// They are unique per channel and inbound/outbound direction, unless an HTLC was only announced +/// and not part of any commitment transaction. +/// +/// Not present when we are awaiting a remote revocation and the HTLC is not added yet. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_htlc_id(this_ptr: &mut OutboundHTLCDetails, 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) }.htlc_id = local_val; +} +/// The amount in msat. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_amount_msat(this_ptr: &OutboundHTLCDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + *inner_val +} +/// The amount in msat. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_amount_msat(this_ptr: &mut OutboundHTLCDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msat = val; +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_cltv_expiry(this_ptr: &OutboundHTLCDetails) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + *inner_val +} +/// The block height at which this HTLC expires. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_cltv_expiry(this_ptr: &mut OutboundHTLCDetails, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry = val; +} +/// The payment hash. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_payment_hash(this_ptr: &OutboundHTLCDetails) -> *const [u8; 32] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + &inner_val.0 +} +/// 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); +} +/// The state of the HTLC in the state machine. +/// +/// Determines on which commitment transactions the HTLC is included and what message the HTLC is +/// waiting for to advance to the next state. +/// +/// See [`OutboundHTLCStateDetails`] for information on the specific states. +/// +/// LDK will always fill this field in, but when downgrading to prior versions of LDK, new +/// states may result in `None` here. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_state(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_OutboundHTLCStateDetailsZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().state; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_OutboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_OutboundHTLCStateDetailsZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::channel_state::OutboundHTLCStateDetails::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val +} +/// The state of the HTLC in the state machine. +/// +/// Determines on which commitment transactions the HTLC is included and what message the HTLC is +/// waiting for to advance to the next state. +/// +/// See [`OutboundHTLCStateDetails`] for information on the specific states. +/// +/// LDK will always fill this field in, but when downgrading to prior versions of LDK, new +/// states may result in `None` here. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_state(this_ptr: &mut OutboundHTLCDetails, mut val: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.state = local_val; +} +/// The extra fee being skimmed off the top of this HTLC. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_skimmed_fee_msat(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().skimmed_fee_msat; + 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 extra fee being skimmed off the top of this HTLC. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_skimmed_fee_msat(this_ptr: &mut OutboundHTLCDetails, 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) }.skimmed_fee_msat = local_val; +} +/// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed +/// from the local commitment transaction and added to the commitment transaction fee. +/// For non-anchor channels, this takes into account the cost of the second-stage HTLC +/// transactions as well. +/// +/// When the local commitment transaction is broadcasted as part of a unilateral closure, +/// the value of this HTLC will therefore not be claimable but instead burned as a transaction +/// fee. +/// +/// Note that dust limits are specific to each party. An HTLC can be dust for the local +/// commitment transaction but not for the counterparty's commitment transaction and vice versa. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_get_is_dust(this_ptr: &OutboundHTLCDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_dust; + *inner_val +} +/// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed +/// from the local commitment transaction and added to the commitment transaction fee. +/// For non-anchor channels, this takes into account the cost of the second-stage HTLC +/// transactions as well. +/// +/// When the local commitment transaction is broadcasted as part of a unilateral closure, +/// the value of this HTLC will therefore not be claimable but instead burned as a transaction +/// fee. +/// +/// Note that dust limits are specific to each party. An HTLC can be dust for the local +/// commitment transaction but not for the counterparty's commitment transaction and vice versa. +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_set_is_dust(this_ptr: &mut OutboundHTLCDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_dust = val; +} +/// Constructs a new OutboundHTLCDetails given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OutboundHTLCDetails_new(mut htlc_id_arg: crate::c_types::derived::COption_u64Z, mut amount_msat_arg: u64, mut cltv_expiry_arg: u32, mut payment_hash_arg: crate::c_types::ThirtyTwoBytes, mut state_arg: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, mut skimmed_fee_msat_arg: crate::c_types::derived::COption_u64Z, mut is_dust_arg: bool) -> OutboundHTLCDetails { + let mut local_htlc_id_arg = if htlc_id_arg.is_some() { Some( { htlc_id_arg.take() }) } else { None }; + let mut local_state_arg = { /*state_arg*/ let state_arg_opt = state_arg; if state_arg_opt.is_none() { None } else { Some({ { { state_arg_opt.take() }.into_native() }})} }; + let mut local_skimmed_fee_msat_arg = if skimmed_fee_msat_arg.is_some() { Some( { skimmed_fee_msat_arg.take() }) } else { None }; + OutboundHTLCDetails { inner: ObjOps::heap_alloc(nativeOutboundHTLCDetails { + 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), + state: local_state_arg, + skimmed_fee_msat: local_skimmed_fee_msat_arg, + is_dust: is_dust_arg, + }), is_owned: true } +} +impl Clone for OutboundHTLCDetails { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeOutboundHTLCDetails>::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 OutboundHTLCDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOutboundHTLCDetails)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the OutboundHTLCDetails +pub extern "C" fn OutboundHTLCDetails_clone(orig: &OutboundHTLCDetails) -> OutboundHTLCDetails { + orig.clone() +} +/// Get a string which allows debug introspection of a OutboundHTLCDetails object +pub extern "C" fn OutboundHTLCDetails_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::OutboundHTLCDetails }).into()} +#[no_mangle] +/// Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read +pub extern "C" fn OutboundHTLCDetails_write(obj: &crate::lightning::ln::channel_state::OutboundHTLCDetails) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn OutboundHTLCDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOutboundHTLCDetails) }) +} +#[no_mangle] +/// Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write +pub extern "C" fn OutboundHTLCDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OutboundHTLCDetailsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::OutboundHTLCDetails { 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::ln::channel_state::CounterpartyForwardingInfo as nativeCounterpartyForwardingInfoImport; +pub(crate) type nativeCounterpartyForwardingInfo = nativeCounterpartyForwardingInfoImport; + +/// Information needed for constructing an invoice route hint for this channel. +#[must_use] +#[repr(C)] +pub struct CounterpartyForwardingInfo { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeCounterpartyForwardingInfo, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for CounterpartyForwardingInfo { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCounterpartyForwardingInfo>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_free(this_obj: CounterpartyForwardingInfo) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo) }; +} +#[allow(unused)] +impl CounterpartyForwardingInfo { + pub(crate) fn get_native_ref(&self) -> &'static nativeCounterpartyForwardingInfo { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCounterpartyForwardingInfo { + 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 nativeCounterpartyForwardingInfo { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Base routing fee in millisatoshis. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_get_fee_base_msat(this_ptr: &CounterpartyForwardingInfo) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; + *inner_val +} +/// Base routing fee in millisatoshis. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_set_fee_base_msat(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val; +} +/// Amount in millionths of a satoshi the channel will charge per transferred satoshi. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr: &CounterpartyForwardingInfo) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; + *inner_val +} +/// Amount in millionths of a satoshi the channel will charge per transferred satoshi. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_set_fee_proportional_millionths(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val; +} +/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, +/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s +/// `cltv_expiry_delta` for more details. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr: &CounterpartyForwardingInfo) -> u16 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + *inner_val +} +/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, +/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s +/// `cltv_expiry_delta` for more details. +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_set_cltv_expiry_delta(this_ptr: &mut CounterpartyForwardingInfo, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; +} +/// Constructs a new CounterpartyForwardingInfo given each field +#[must_use] +#[no_mangle] +pub extern "C" fn CounterpartyForwardingInfo_new(mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut cltv_expiry_delta_arg: u16) -> CounterpartyForwardingInfo { + CounterpartyForwardingInfo { inner: ObjOps::heap_alloc(nativeCounterpartyForwardingInfo { + fee_base_msat: fee_base_msat_arg, + fee_proportional_millionths: fee_proportional_millionths_arg, + cltv_expiry_delta: cltv_expiry_delta_arg, + }), is_owned: true } +} +impl Clone for CounterpartyForwardingInfo { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeCounterpartyForwardingInfo>::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 CounterpartyForwardingInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the CounterpartyForwardingInfo +pub extern "C" fn CounterpartyForwardingInfo_clone(orig: &CounterpartyForwardingInfo) -> CounterpartyForwardingInfo { + orig.clone() +} +/// Get a string which allows debug introspection of a CounterpartyForwardingInfo object +pub extern "C" fn CounterpartyForwardingInfo_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::CounterpartyForwardingInfo }).into()} +#[no_mangle] +/// Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read +pub extern "C" fn CounterpartyForwardingInfo_write(obj: &crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn CounterpartyForwardingInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyForwardingInfo) }) +} +#[no_mangle] +/// Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write +pub extern "C" fn CounterpartyForwardingInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyForwardingInfoDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::CounterpartyForwardingInfo { 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::ln::channel_state::ChannelCounterparty as nativeChannelCounterpartyImport; +pub(crate) type nativeChannelCounterparty = nativeChannelCounterpartyImport; + +/// Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] +/// to better separate parameters. +#[must_use] +#[repr(C)] +pub struct ChannelCounterparty { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeChannelCounterparty, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ChannelCounterparty { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelCounterparty>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_free(this_obj: ChannelCounterparty) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelCounterparty) }; +} +#[allow(unused)] +impl ChannelCounterparty { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelCounterparty { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelCounterparty { + 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 nativeChannelCounterparty { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The node_id of our counterparty +#[no_mangle] +pub extern "C" fn ChannelCounterparty_get_node_id(this_ptr: &ChannelCounterparty) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// The node_id of our counterparty +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_node_id(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = val.into_rust(); +} +/// The Features the channel counterparty provided upon last connection. +/// Useful for routing as it is the most up-to-date copy of the counterparty's features and +/// many routing-relevant features are present in the init context. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_get_features(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::features::InitFeatures { + let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false } +} +/// The Features the channel counterparty provided upon last connection. +/// Useful for routing as it is the most up-to-date copy of the counterparty's features and +/// many routing-relevant features are present in the init context. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_features(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::features::InitFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The value, in satoshis, that must always be held in the channel for our counterparty. This +/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by +/// claiming at least this value on chain. +/// +/// This value is not included in [`inbound_capacity_msat`] as it can never be spent. +/// +/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat +#[no_mangle] +pub extern "C" fn ChannelCounterparty_get_unspendable_punishment_reserve(this_ptr: &ChannelCounterparty) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; + *inner_val +} +/// The value, in satoshis, that must always be held in the channel for our counterparty. This +/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by +/// claiming at least this value on chain. +/// +/// This value is not included in [`inbound_capacity_msat`] as it can never be spent. +/// +/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_unspendable_punishment_reserve(this_ptr: &mut ChannelCounterparty, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = val; +} +/// Information on the fees and requirements that the counterparty requires when forwarding +/// payments to us through this channel. +/// +/// 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 ChannelCounterparty_get_forwarding_info(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::channel_state::CounterpartyForwardingInfo { + let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_info; + let mut local_inner_val = crate::lightning::ln::channel_state::CounterpartyForwardingInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::channel_state::CounterpartyForwardingInfo<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// Information on the fees and requirements that the counterparty requires when forwarding +/// payments to us through this channel. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_forwarding_info(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) { + 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) }.forwarding_info = local_val; +} +/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field +/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message +/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_get_outbound_htlc_minimum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_minimum_msat; + 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 smallest value HTLC (in msat) the remote peer will accept, for this channel. This field +/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message +/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_outbound_htlc_minimum_msat(this_ptr: &mut ChannelCounterparty, 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) }.outbound_htlc_minimum_msat = local_val; +} +/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_get_outbound_htlc_maximum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_maximum_msat; + 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 largest value HTLC (in msat) the remote peer currently will accept, for this channel. +#[no_mangle] +pub extern "C" fn ChannelCounterparty_set_outbound_htlc_maximum_msat(this_ptr: &mut ChannelCounterparty, 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) }.outbound_htlc_maximum_msat = local_val; +} +/// Constructs a new ChannelCounterparty given each field +/// +/// Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelCounterparty_new(mut node_id_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InitFeatures, mut unspendable_punishment_reserve_arg: u64, mut forwarding_info_arg: crate::lightning::ln::channel_state::CounterpartyForwardingInfo, mut outbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut outbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> ChannelCounterparty { + let mut local_forwarding_info_arg = if forwarding_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(forwarding_info_arg.take_inner()) } }) }; + let mut local_outbound_htlc_minimum_msat_arg = if outbound_htlc_minimum_msat_arg.is_some() { Some( { outbound_htlc_minimum_msat_arg.take() }) } else { None }; + let mut local_outbound_htlc_maximum_msat_arg = if outbound_htlc_maximum_msat_arg.is_some() { Some( { outbound_htlc_maximum_msat_arg.take() }) } else { None }; + ChannelCounterparty { inner: ObjOps::heap_alloc(nativeChannelCounterparty { + node_id: node_id_arg.into_rust(), + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, + unspendable_punishment_reserve: unspendable_punishment_reserve_arg, + forwarding_info: local_forwarding_info_arg, + outbound_htlc_minimum_msat: local_outbound_htlc_minimum_msat_arg, + outbound_htlc_maximum_msat: local_outbound_htlc_maximum_msat_arg, + }), is_owned: true } +} +impl Clone for ChannelCounterparty { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelCounterparty>::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 ChannelCounterparty_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelCounterparty)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelCounterparty +pub extern "C" fn ChannelCounterparty_clone(orig: &ChannelCounterparty) -> ChannelCounterparty { + orig.clone() +} +/// Get a string which allows debug introspection of a ChannelCounterparty object +pub extern "C" fn ChannelCounterparty_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::ChannelCounterparty }).into()} +#[no_mangle] +/// Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read +pub extern "C" fn ChannelCounterparty_write(obj: &crate::lightning::ln::channel_state::ChannelCounterparty) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelCounterparty_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelCounterparty) }) +} +#[no_mangle] +/// Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write +pub extern "C" fn ChannelCounterparty_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelCounterpartyDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::ChannelCounterparty { 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::ln::channel_state::ChannelDetails as nativeChannelDetailsImport; +pub(crate) type nativeChannelDetails = nativeChannelDetailsImport; + +/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] +/// +/// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels +/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels +#[must_use] +#[repr(C)] +pub struct ChannelDetails { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeChannelDetails, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust functions which take ownership of an object provided via an argument require + /// this to be true and invalidate the object pointed to by inner. + pub is_owned: bool, +} + +impl Drop for ChannelDetails { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelDetails>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelDetails_free(this_obj: ChannelDetails) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDetails) }; +} +#[allow(unused)] +impl ChannelDetails { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelDetails { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelDetails { + 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 nativeChannelDetails { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes, +/// thereafter this is the txid of the funding transaction xor the funding transaction output). +/// Note that this means this value is *not* persistent - it can change once during the +/// lifetime of the channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } +} +/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes, +/// thereafter this is the txid of the funding transaction xor the funding transaction output). +/// Note that this means this value is *not* persistent - it can change once during the +/// lifetime of the channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Parameters which apply to our counterparty. See individual fields for more information. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_counterparty(this_ptr: &ChannelDetails) -> crate::lightning::ln::channel_state::ChannelCounterparty { + let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty; + crate::lightning::ln::channel_state::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_state::ChannelCounterparty<>) as *mut _) }, is_owned: false } +} +/// Parameters which apply to our counterparty. See individual fields for more information. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_counterparty(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::channel_state::ChannelCounterparty) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The Channel's funding transaction output, if we've negotiated the funding transaction with +/// our counterparty already. +/// +/// 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 ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint { + let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txo; + let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// The Channel's funding transaction output, if we've negotiated the funding transaction with +/// our counterparty already. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, mut val: crate::lightning::chain::transaction::OutPoint) { + 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) }.funding_txo = local_val; +} +/// The features which this channel operates with. See individual features for more info. +/// +/// `None` until negotiation completes and the channel type is finalized. +/// +/// 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 ChannelDetails_get_channel_type(this_ptr: &ChannelDetails) -> crate::lightning::ln::features::ChannelTypeFeatures { + let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type; + let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// The features which this channel operates with. See individual features for more info. +/// +/// `None` until negotiation completes and the channel type is finalized. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::features::ChannelTypeFeatures) { + 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) }.channel_type = local_val; +} +/// The position of the funding transaction in the chain. None if the funding transaction has +/// not yet been confirmed and the channel fully opened. +/// +/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound +/// payments instead of this. See [`get_inbound_payment_scid`]. +/// +/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may +/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. +/// +/// [`inbound_scid_alias`]: Self::inbound_scid_alias +/// [`outbound_scid_alias`]: Self::outbound_scid_alias +/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid +/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid +/// [`confirmations_required`]: Self::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + 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 position of the funding transaction in the chain. None if the funding transaction has +/// not yet been confirmed and the channel fully opened. +/// +/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound +/// payments instead of this. See [`get_inbound_payment_scid`]. +/// +/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may +/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. +/// +/// [`inbound_scid_alias`]: Self::inbound_scid_alias +/// [`outbound_scid_alias`]: Self::outbound_scid_alias +/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid +/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid +/// [`confirmations_required`]: Self::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDetails, 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) }.short_channel_id = local_val; +} +/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and +/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when +/// the channel has not yet been confirmed (as long as [`confirmations_required`] is +/// `Some(0)`). +/// +/// This will be `None` as long as the channel is not available for routing outbound payments. +/// +/// [`short_channel_id`]: Self::short_channel_id +/// [`confirmations_required`]: Self::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_scid_alias; + 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 +} +/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and +/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when +/// the channel has not yet been confirmed (as long as [`confirmations_required`] is +/// `Some(0)`). +/// +/// This will be `None` as long as the channel is not available for routing outbound payments. +/// +/// [`short_channel_id`]: Self::short_channel_id +/// [`confirmations_required`]: Self::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_set_outbound_scid_alias(this_ptr: &mut ChannelDetails, 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) }.outbound_scid_alias = local_val; +} +/// An optional [`short_channel_id`] alias for this channel, randomly generated by our +/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our +/// counterparty will recognize the alias provided here in place of the [`short_channel_id`] +/// when they see a payment to be routed to us. +/// +/// Our counterparty may choose to rotate this value at any time, though will always recognize +/// previous values for inbound payment forwarding. +/// +/// [`short_channel_id`]: Self::short_channel_id +#[no_mangle] +pub extern "C" fn ChannelDetails_get_inbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_scid_alias; + 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 +} +/// An optional [`short_channel_id`] alias for this channel, randomly generated by our +/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our +/// counterparty will recognize the alias provided here in place of the [`short_channel_id`] +/// when they see a payment to be routed to us. +/// +/// Our counterparty may choose to rotate this value at any time, though will always recognize +/// previous values for inbound payment forwarding. +/// +/// [`short_channel_id`]: Self::short_channel_id +#[no_mangle] +pub extern "C" fn ChannelDetails_set_inbound_scid_alias(this_ptr: &mut ChannelDetails, 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) }.inbound_scid_alias = local_val; +} +/// The value, in satoshis, of this channel as appears in the funding output +#[no_mangle] +pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis; + *inner_val +} +/// The value, in satoshis, of this channel as appears in the funding output +#[no_mangle] +pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut ChannelDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; +} +/// The value, in satoshis, that must always be held in the channel for us. This value ensures +/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least +/// this value on chain. +/// +/// This value is not included in [`outbound_capacity_msat`] as it can never be spent. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +/// +/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat +#[no_mangle] +pub extern "C" fn ChannelDetails_get_unspendable_punishment_reserve(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; + 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 value, in satoshis, that must always be held in the channel for us. This value ensures +/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least +/// this value on chain. +/// +/// This value is not included in [`outbound_capacity_msat`] as it can never be spent. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +/// +/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat +#[no_mangle] +pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &mut ChannelDetails, 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) }.unspendable_punishment_reserve = local_val; +} +/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound +/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects +/// serialized with LDK versions prior to 0.0.113. +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels +#[no_mangle] +pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::U128 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id; + inner_val.into() +} +/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound +/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if +/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise +/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects +/// serialized with LDK versions prior to 0.0.113. +/// +/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels +#[no_mangle] +pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::U128) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into(); +} +/// The currently negotiated fee rate denominated in satoshi per 1000 weight units, +/// which is applied to commitment and HTLC transactions. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_feerate_sat_per_1000_weight(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight; + 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 currently negotiated fee rate denominated in satoshi per 1000 weight units, +/// which is applied to commitment and HTLC transactions. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_feerate_sat_per_1000_weight(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.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. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_capacity_msat; + *inner_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. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_capacity_msat = val; +} +/// The available outbound capacity for sending a single HTLC to the remote peer. This is +/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by +/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us +/// to use a limit as close as possible to the HTLC limit we can currently send. +/// +/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], +/// [`ChannelDetails::balance_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; + *inner_val +} +/// The available outbound capacity for sending a single HTLC to the remote peer. This is +/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by +/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us +/// to use a limit as close as possible to the HTLC limit we can currently send. +/// +/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], +/// [`ChannelDetails::balance_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; +} +/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of +/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than +/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a +/// route which is valid. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_next_outbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_minimum_msat; + *inner_val +} +/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of +/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than +/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a +/// route which is valid. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_next_outbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_minimum_msat = val; +} +/// The available inbound capacity for the remote peer to send HTLCs to us. This does not +/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not +/// available for inclusion in new inbound HTLCs). +/// Note that there are some corner cases not fully handled here, so the actual available +/// inbound capacity may be slightly higher than this. +/// +/// This value is not exact. Due to various in-flight changes, feerate changes, and our +/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. +/// However, our counterparty should be able to spend nearly this amount. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_capacity_msat; + *inner_val +} +/// The available inbound capacity for the remote peer to send HTLCs to us. This does not +/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not +/// available for inclusion in new inbound HTLCs). +/// Note that there are some corner cases not fully handled here, so the actual available +/// inbound capacity may be slightly higher than this. +/// +/// This value is not exact. Due to various in-flight changes, feerate changes, and our +/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. +/// However, our counterparty should be able to spend nearly this amount. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_inbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_capacity_msat = val; +} +/// The number of required confirmations on the funding transaction before the funding will be +/// considered \"locked\". This number is selected by the channel fundee (i.e. us if +/// [`is_outbound`] is *not* set), and can be selected for inbound channels with +/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with +/// [`ChannelHandshakeLimits::max_minimum_depth`]. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +/// +/// [`is_outbound`]: ChannelDetails::is_outbound +/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth +/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth +#[no_mangle] +pub extern "C" fn ChannelDetails_get_confirmations_required(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations_required; + 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 number of required confirmations on the funding transaction before the funding will be +/// considered \"locked\". This number is selected by the channel fundee (i.e. us if +/// [`is_outbound`] is *not* set), and can be selected for inbound channels with +/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with +/// [`ChannelHandshakeLimits::max_minimum_depth`]. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +/// +/// [`is_outbound`]: ChannelDetails::is_outbound +/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth +/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth +#[no_mangle] +pub extern "C" fn ChannelDetails_set_confirmations_required(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations_required = local_val; +} +/// The current number of confirmations on the funding transaction. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_confirmations(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The current number of confirmations on the funding transaction. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_confirmations(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations = local_val; +} +/// The number of blocks (after our commitment transaction confirms) that we will need to wait +/// until we can claim our funds after we force-close the channel. During this time our +/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty +/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any +/// time to claim our non-HTLC-encumbered funds. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_force_close_spend_delay(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u16Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_spend_delay; + 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 number of blocks (after our commitment transaction confirms) that we will need to wait +/// until we can claim our funds after we force-close the channel. During this time our +/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty +/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any +/// time to claim our non-HTLC-encumbered funds. +/// +/// This value will be `None` for outbound channels until the counterparty accepts the channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_force_close_spend_delay(this_ptr: &mut ChannelDetails, 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) }.force_close_spend_delay = local_val; +} +/// True if the channel was initiated (and thus funded) by us. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_is_outbound(this_ptr: &ChannelDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_outbound; + *inner_val +} +/// True if the channel was initiated (and thus funded) by us. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_outbound = val; +} +/// True if the channel is confirmed, channel_ready messages have been exchanged, and the +/// channel is not currently being shut down. `channel_ready` message exchange implies the +/// required confirmation count has been reached (and we were connected to the peer at some +/// point after the funding transaction received enough confirmations). The required +/// confirmation count is provided in [`confirmations_required`]. +/// +/// [`confirmations_required`]: ChannelDetails::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_get_is_channel_ready(this_ptr: &ChannelDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_channel_ready; + *inner_val +} +/// True if the channel is confirmed, channel_ready messages have been exchanged, and the +/// channel is not currently being shut down. `channel_ready` message exchange implies the +/// required confirmation count has been reached (and we were connected to the peer at some +/// point after the funding transaction received enough confirmations). The required +/// confirmation count is provided in [`confirmations_required`]. +/// +/// [`confirmations_required`]: ChannelDetails::confirmations_required +#[no_mangle] +pub extern "C" fn ChannelDetails_set_is_channel_ready(this_ptr: &mut ChannelDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_channel_ready = val; +} +/// The stage of the channel's shutdown. +/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_channel_shutdown_state(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_ChannelShutdownStateZ { + let mut inner_val = this_ptr.get_native_mut_ref().channel_shutdown_state.clone(); + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ChannelShutdownStateZ::None } else { crate::c_types::derived::COption_ChannelShutdownStateZ::Some( { crate::lightning::ln::channel_state::ChannelShutdownState::native_into(inner_val.unwrap()) }) }; + local_inner_val +} +/// The stage of the channel's shutdown. +/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_channel_shutdown_state(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_ChannelShutdownStateZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_shutdown_state = local_val; +} +/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) +/// the peer is connected, and (c) the channel is not currently negotiating a shutdown. +/// +/// This is a strict superset of `is_channel_ready`. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_usable; + *inner_val +} +/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) +/// the peer is connected, and (c) the channel is not currently negotiating a shutdown. +/// +/// This is a strict superset of `is_channel_ready`. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_usable = val; +} +/// True if this channel is (or will be) publicly-announced. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_is_public(this_ptr: &ChannelDetails) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().is_public; + *inner_val +} +/// True if this channel is (or will be) publicly-announced. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_is_public(this_ptr: &mut ChannelDetails, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_public = val; +} +/// The smallest value HTLC (in msat) we will accept, for this channel. This field +/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 +#[no_mangle] +pub extern "C" fn ChannelDetails_get_inbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_minimum_msat; + 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 smallest value HTLC (in msat) we will accept, for this channel. This field +/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 +#[no_mangle] +pub extern "C" fn ChannelDetails_set_inbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, 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) }.inbound_htlc_minimum_msat = local_val; +} +/// The largest value HTLC (in msat) we currently will accept, for this channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_inbound_htlc_maximum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_maximum_msat; + 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 largest value HTLC (in msat) we currently will accept, for this channel. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_inbound_htlc_maximum_msat(this_ptr: &mut ChannelDetails, 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) }.inbound_htlc_maximum_msat = local_val; +} +/// Set of configurable parameters that affect channel operation. +/// +/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. +/// +/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelDetails_get_config(this_ptr: &ChannelDetails) -> crate::lightning::util::config::ChannelConfig { + let mut inner_val = &mut this_ptr.get_native_mut_ref().config; + let mut local_inner_val = crate::lightning::util::config::ChannelConfig { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelConfig<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// Set of configurable parameters that affect channel operation. +/// +/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut val: crate::lightning::util::config::ChannelConfig) { + 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) }.config = local_val; +} +/// Pending inbound HTLCs. +/// +/// This field is empty for objects serialized with LDK versions prior to 0.0.122. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_pending_inbound_htlcs(this_ptr: &ChannelDetails) -> crate::c_types::derived::CVec_InboundHTLCDetailsZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().pending_inbound_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::InboundHTLCDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::InboundHTLCDetails<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// Pending inbound HTLCs. +/// +/// This field is empty for objects serialized with LDK versions prior to 0.0.122. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_pending_inbound_htlcs(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::CVec_InboundHTLCDetailsZ) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.pending_inbound_htlcs = local_val; +} +/// Pending outbound HTLCs. +/// +/// This field is empty for objects serialized with LDK versions prior to 0.0.122. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_pending_outbound_htlcs(this_ptr: &ChannelDetails) -> crate::c_types::derived::CVec_OutboundHTLCDetailsZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().pending_outbound_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::OutboundHTLCDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::OutboundHTLCDetails<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// Pending outbound HTLCs. +/// +/// This field is empty for objects serialized with LDK versions prior to 0.0.122. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_pending_outbound_htlcs(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::CVec_OutboundHTLCDetailsZ) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.pending_outbound_htlcs = local_val; +} +/// Constructs a new ChannelDetails given each field +/// +/// Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// 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] +#[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::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut outbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: crate::c_types::U128, mut 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_public_arg: bool, mut inbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut inbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut config_arg: crate::lightning::util::config::ChannelConfig, 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 }; + let mut local_outbound_scid_alias_arg = if outbound_scid_alias_arg.is_some() { Some( { outbound_scid_alias_arg.take() }) } else { None }; + let mut local_inbound_scid_alias_arg = if inbound_scid_alias_arg.is_some() { Some( { inbound_scid_alias_arg.take() }) } else { None }; + let mut local_unspendable_punishment_reserve_arg = if unspendable_punishment_reserve_arg.is_some() { Some( { unspendable_punishment_reserve_arg.take() }) } else { None }; + let mut local_feerate_sat_per_1000_weight_arg = if feerate_sat_per_1000_weight_arg.is_some() { Some( { feerate_sat_per_1000_weight_arg.take() }) } else { None }; + let mut local_confirmations_required_arg = if confirmations_required_arg.is_some() { Some( { confirmations_required_arg.take() }) } else { None }; + let mut local_confirmations_arg = if confirmations_arg.is_some() { Some( { confirmations_arg.take() }) } else { None }; + let mut local_force_close_spend_delay_arg = if force_close_spend_delay_arg.is_some() { Some( { force_close_spend_delay_arg.take() }) } else { None }; + let mut local_channel_shutdown_state_arg = { /*channel_shutdown_state_arg*/ let channel_shutdown_state_arg_opt = channel_shutdown_state_arg; if channel_shutdown_state_arg_opt.is_none() { None } else { Some({ { { channel_shutdown_state_arg_opt.take() }.into_native() }})} }; + let mut local_inbound_htlc_minimum_msat_arg = if inbound_htlc_minimum_msat_arg.is_some() { Some( { inbound_htlc_minimum_msat_arg.take() }) } else { None }; + let mut local_inbound_htlc_maximum_msat_arg = if inbound_htlc_maximum_msat_arg.is_some() { Some( { inbound_htlc_maximum_msat_arg.take() }) } else { None }; + let mut local_config_arg = if config_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(config_arg.take_inner()) } }) }; + let mut local_pending_inbound_htlcs_arg = Vec::new(); for mut item in pending_inbound_htlcs_arg.into_rust().drain(..) { local_pending_inbound_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_pending_outbound_htlcs_arg = Vec::new(); for mut item in pending_outbound_htlcs_arg.into_rust().drain(..) { local_pending_outbound_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + ChannelDetails { inner: ObjOps::heap_alloc(nativeChannelDetails { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + counterparty: *unsafe { Box::from_raw(counterparty_arg.take_inner()) }, + funding_txo: local_funding_txo_arg, + channel_type: local_channel_type_arg, + short_channel_id: local_short_channel_id_arg, + outbound_scid_alias: local_outbound_scid_alias_arg, + inbound_scid_alias: local_inbound_scid_alias_arg, + channel_value_satoshis: channel_value_satoshis_arg, + unspendable_punishment_reserve: local_unspendable_punishment_reserve_arg, + user_channel_id: user_channel_id_arg.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, + inbound_capacity_msat: inbound_capacity_msat_arg, + confirmations_required: local_confirmations_required_arg, + confirmations: local_confirmations_arg, + force_close_spend_delay: local_force_close_spend_delay_arg, + is_outbound: is_outbound_arg, + is_channel_ready: is_channel_ready_arg, + channel_shutdown_state: local_channel_shutdown_state_arg, + is_usable: is_usable_arg, + is_public: is_public_arg, + inbound_htlc_minimum_msat: local_inbound_htlc_minimum_msat_arg, + inbound_htlc_maximum_msat: local_inbound_htlc_maximum_msat_arg, + config: local_config_arg, + pending_inbound_htlcs: local_pending_inbound_htlcs_arg, + pending_outbound_htlcs: local_pending_outbound_htlcs_arg, + }), is_owned: true } +} +impl Clone for ChannelDetails { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelDetails>::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 ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDetails)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelDetails +pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails { + orig.clone() +} +/// Get a string which allows debug introspection of a ChannelDetails object +pub extern "C" fn ChannelDetails_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::ChannelDetails }).into()} +/// Gets the current SCID which should be used to identify this channel for inbound payments. +/// This should be used for providing invoice hints or in any other context where our +/// counterparty will forward a payment to us. +/// +/// This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the +/// [`ChannelDetails::short_channel_id`]. See those for more information. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelDetails_get_inbound_payment_scid(this_arg: &crate::lightning::ln::channel_state::ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_inbound_payment_scid(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; + local_ret +} + +/// Gets the current SCID which should be used to identify this channel for outbound payments. +/// This should be used in [`Route`]s to describe the first hop or in other contexts where +/// we're sending or forwarding a payment outbound over this channel. +/// +/// This is either the [`ChannelDetails::short_channel_id`], if set, or the +/// [`ChannelDetails::outbound_scid_alias`]. See those for more information. +/// +/// [`Route`]: crate::routing::router::Route +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lightning::ln::channel_state::ChannelDetails) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outbound_payment_scid(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; + local_ret +} + +#[no_mangle] +/// Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read +pub extern "C" fn ChannelDetails_write(obj: &crate::lightning::ln::channel_state::ChannelDetails) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDetails) }) +} +#[no_mangle] +/// Read a ChannelDetails from a byte array, created by ChannelDetails_write +pub extern "C" fn ChannelDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDetailsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::ChannelDetails { 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 +} +/// Further information on the details of the channel shutdown. +/// Upon channels being forced closed (i.e. commitment transaction confirmation detected +/// by `ChainMonitor`), ChannelShutdownState will be set to `ShutdownComplete` or +/// the channel will be removed shortly. +/// Also note, that in normal operation, peers could disconnect at any of these states +/// and require peer re-connection before making progress onto other states +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum ChannelShutdownState { + /// Channel has not sent or received a shutdown message. + NotShuttingDown, + /// Local node has sent a shutdown message for this channel. + ShutdownInitiated, + /// Shutdown message exchanges have concluded and the channels are in the midst of + /// resolving all existing open HTLCs before closing can continue. + ResolvingHTLCs, + /// All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates. + NegotiatingClosingFee, + /// We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about + /// to drop the channel. + ShutdownComplete, +} +use lightning::ln::channel_state::ChannelShutdownState as ChannelShutdownStateImport; +pub(crate) type nativeChannelShutdownState = ChannelShutdownStateImport; + +impl ChannelShutdownState { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeChannelShutdownState { + match self { + ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown, + ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated, + ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs, + ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee, + ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeChannelShutdownState { + match self { + ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown, + ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated, + ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs, + ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee, + ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &ChannelShutdownStateImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeChannelShutdownState) }; + match native { + nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown, + nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated, + nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs, + nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee, + nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeChannelShutdownState) -> Self { + match native { + nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown, + nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated, + nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs, + nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee, + nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete, + } + } +} +/// Creates a copy of the ChannelShutdownState +#[no_mangle] +pub extern "C" fn ChannelShutdownState_clone(orig: &ChannelShutdownState) -> ChannelShutdownState { + 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 ChannelShutdownState_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelShutdownState)).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 ChannelShutdownState_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelShutdownState) }; +} +#[no_mangle] +/// Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState +pub extern "C" fn ChannelShutdownState_not_shutting_down() -> ChannelShutdownState { + ChannelShutdownState::NotShuttingDown} +#[no_mangle] +/// Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState +pub extern "C" fn ChannelShutdownState_shutdown_initiated() -> ChannelShutdownState { + ChannelShutdownState::ShutdownInitiated} +#[no_mangle] +/// Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState +pub extern "C" fn ChannelShutdownState_resolving_htlcs() -> ChannelShutdownState { + ChannelShutdownState::ResolvingHTLCs} +#[no_mangle] +/// Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState +pub extern "C" fn ChannelShutdownState_negotiating_closing_fee() -> ChannelShutdownState { + ChannelShutdownState::NegotiatingClosingFee} +#[no_mangle] +/// Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState +pub extern "C" fn ChannelShutdownState_shutdown_complete() -> ChannelShutdownState { + ChannelShutdownState::ShutdownComplete} +/// Get a string which allows debug introspection of a ChannelShutdownState object +pub extern "C" fn ChannelShutdownState_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channel_state::ChannelShutdownState }).into()} +/// Checks if two ChannelShutdownStates contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn ChannelShutdownState_eq(a: &ChannelShutdownState, b: &ChannelShutdownState) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +#[no_mangle] +/// Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read +pub extern "C" fn ChannelShutdownState_write(obj: &crate::lightning::ln::channel_state::ChannelShutdownState) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelShutdownState_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + ChannelShutdownState_write(unsafe { &*(obj as *const ChannelShutdownState) }) +} +#[no_mangle] +/// Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write +pub extern "C" fn ChannelShutdownState_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelShutdownStateDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channel_state::ChannelShutdownState::native_into(o) }).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/channelmanager.rs b/lightning-c-bindings/src/lightning/ln/channelmanager.rs index d51a9ec..1a29d9d 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -1824,1109 +1824,6 @@ pub static MIN_CLTV_EXPIRY_DELTA: u16 = lightning::ln::channelmanager::MIN_CLTV_ #[no_mangle] pub static MIN_FINAL_CLTV_EXPIRY_DELTA: u16 = lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; - -use lightning::ln::channelmanager::CounterpartyForwardingInfo as nativeCounterpartyForwardingInfoImport; -pub(crate) type nativeCounterpartyForwardingInfo = nativeCounterpartyForwardingInfoImport; - -/// Information needed for constructing an invoice route hint for this channel. -#[must_use] -#[repr(C)] -pub struct CounterpartyForwardingInfo { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, 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 nativeCounterpartyForwardingInfo, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust functions which take ownership of an object provided via an argument require - /// this to be true and invalidate the object pointed to by inner. - pub is_owned: bool, -} - -impl Drop for CounterpartyForwardingInfo { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeCounterpartyForwardingInfo>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_free(this_obj: CounterpartyForwardingInfo) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo) }; -} -#[allow(unused)] -impl CounterpartyForwardingInfo { - pub(crate) fn get_native_ref(&self) -> &'static nativeCounterpartyForwardingInfo { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCounterpartyForwardingInfo { - 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 nativeCounterpartyForwardingInfo { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// Base routing fee in millisatoshis. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_get_fee_base_msat(this_ptr: &CounterpartyForwardingInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; - *inner_val -} -/// Base routing fee in millisatoshis. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_set_fee_base_msat(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val; -} -/// Amount in millionths of a satoshi the channel will charge per transferred satoshi. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr: &CounterpartyForwardingInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; - *inner_val -} -/// Amount in millionths of a satoshi the channel will charge per transferred satoshi. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_set_fee_proportional_millionths(this_ptr: &mut CounterpartyForwardingInfo, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val; -} -/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, -/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s -/// `cltv_expiry_delta` for more details. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr: &CounterpartyForwardingInfo) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; - *inner_val -} -/// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, -/// such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s -/// `cltv_expiry_delta` for more details. -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_set_cltv_expiry_delta(this_ptr: &mut CounterpartyForwardingInfo, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; -} -/// Constructs a new CounterpartyForwardingInfo given each field -#[must_use] -#[no_mangle] -pub extern "C" fn CounterpartyForwardingInfo_new(mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut cltv_expiry_delta_arg: u16) -> CounterpartyForwardingInfo { - CounterpartyForwardingInfo { inner: ObjOps::heap_alloc(nativeCounterpartyForwardingInfo { - fee_base_msat: fee_base_msat_arg, - fee_proportional_millionths: fee_proportional_millionths_arg, - cltv_expiry_delta: cltv_expiry_delta_arg, - }), is_owned: true } -} -impl Clone for CounterpartyForwardingInfo { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeCounterpartyForwardingInfo>::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 CounterpartyForwardingInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the CounterpartyForwardingInfo -pub extern "C" fn CounterpartyForwardingInfo_clone(orig: &CounterpartyForwardingInfo) -> CounterpartyForwardingInfo { - orig.clone() -} -/// Get a string which allows debug introspection of a CounterpartyForwardingInfo object -pub extern "C" fn CounterpartyForwardingInfo_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::CounterpartyForwardingInfo }).into()} - -use lightning::ln::channelmanager::ChannelCounterparty as nativeChannelCounterpartyImport; -pub(crate) type nativeChannelCounterparty = nativeChannelCounterpartyImport; - -/// Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] -/// to better separate parameters. -#[must_use] -#[repr(C)] -pub struct ChannelCounterparty { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, 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 nativeChannelCounterparty, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust functions which take ownership of an object provided via an argument require - /// this to be true and invalidate the object pointed to by inner. - pub is_owned: bool, -} - -impl Drop for ChannelCounterparty { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeChannelCounterparty>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_free(this_obj: ChannelCounterparty) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelCounterparty) }; -} -#[allow(unused)] -impl ChannelCounterparty { - pub(crate) fn get_native_ref(&self) -> &'static nativeChannelCounterparty { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelCounterparty { - 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 nativeChannelCounterparty { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// The node_id of our counterparty -#[no_mangle] -pub extern "C" fn ChannelCounterparty_get_node_id(this_ptr: &ChannelCounterparty) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; - crate::c_types::PublicKey::from_rust(&inner_val) -} -/// The node_id of our counterparty -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_node_id(this_ptr: &mut ChannelCounterparty, mut val: crate::c_types::PublicKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = val.into_rust(); -} -/// The Features the channel counterparty provided upon last connection. -/// Useful for routing as it is the most up-to-date copy of the counterparty's features and -/// many routing-relevant features are present in the init context. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_get_features(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::features::InitFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; - crate::lightning::ln::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::features::InitFeatures<>) as *mut _) }, is_owned: false } -} -/// The Features the channel counterparty provided upon last connection. -/// Useful for routing as it is the most up-to-date copy of the counterparty's features and -/// many routing-relevant features are present in the init context. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_features(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::features::InitFeatures) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The value, in satoshis, that must always be held in the channel for our counterparty. This -/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by -/// claiming at least this value on chain. -/// -/// This value is not included in [`inbound_capacity_msat`] as it can never be spent. -/// -/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat -#[no_mangle] -pub extern "C" fn ChannelCounterparty_get_unspendable_punishment_reserve(this_ptr: &ChannelCounterparty) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; - *inner_val -} -/// The value, in satoshis, that must always be held in the channel for our counterparty. This -/// value ensures that if our counterparty broadcasts a revoked state, we can punish them by -/// claiming at least this value on chain. -/// -/// This value is not included in [`inbound_capacity_msat`] as it can never be spent. -/// -/// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_unspendable_punishment_reserve(this_ptr: &mut ChannelCounterparty, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = val; -} -/// Information on the fees and requirements that the counterparty requires when forwarding -/// payments to us through this channel. -/// -/// 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 ChannelCounterparty_get_forwarding_info(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_info; - let mut local_inner_val = crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::channelmanager::CounterpartyForwardingInfo<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// Information on the fees and requirements that the counterparty requires when forwarding -/// payments to us through this channel. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_forwarding_info(this_ptr: &mut ChannelCounterparty, mut val: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) { - 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) }.forwarding_info = local_val; -} -/// The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field -/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message -/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_get_outbound_htlc_minimum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_minimum_msat; - 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 smallest value HTLC (in msat) the remote peer will accept, for this channel. This field -/// is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message -/// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_outbound_htlc_minimum_msat(this_ptr: &mut ChannelCounterparty, 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) }.outbound_htlc_minimum_msat = local_val; -} -/// The largest value HTLC (in msat) the remote peer currently will accept, for this channel. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_get_outbound_htlc_maximum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_maximum_msat; - 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 largest value HTLC (in msat) the remote peer currently will accept, for this channel. -#[no_mangle] -pub extern "C" fn ChannelCounterparty_set_outbound_htlc_maximum_msat(this_ptr: &mut ChannelCounterparty, 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) }.outbound_htlc_maximum_msat = local_val; -} -/// Constructs a new ChannelCounterparty given each field -/// -/// Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None -#[must_use] -#[no_mangle] -pub extern "C" fn ChannelCounterparty_new(mut node_id_arg: crate::c_types::PublicKey, mut features_arg: crate::lightning::ln::features::InitFeatures, mut unspendable_punishment_reserve_arg: u64, mut forwarding_info_arg: crate::lightning::ln::channelmanager::CounterpartyForwardingInfo, mut outbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut outbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z) -> ChannelCounterparty { - let mut local_forwarding_info_arg = if forwarding_info_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(forwarding_info_arg.take_inner()) } }) }; - let mut local_outbound_htlc_minimum_msat_arg = if outbound_htlc_minimum_msat_arg.is_some() { Some( { outbound_htlc_minimum_msat_arg.take() }) } else { None }; - let mut local_outbound_htlc_maximum_msat_arg = if outbound_htlc_maximum_msat_arg.is_some() { Some( { outbound_htlc_maximum_msat_arg.take() }) } else { None }; - ChannelCounterparty { inner: ObjOps::heap_alloc(nativeChannelCounterparty { - node_id: node_id_arg.into_rust(), - features: *unsafe { Box::from_raw(features_arg.take_inner()) }, - unspendable_punishment_reserve: unspendable_punishment_reserve_arg, - forwarding_info: local_forwarding_info_arg, - outbound_htlc_minimum_msat: local_outbound_htlc_minimum_msat_arg, - outbound_htlc_maximum_msat: local_outbound_htlc_maximum_msat_arg, - }), is_owned: true } -} -impl Clone for ChannelCounterparty { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeChannelCounterparty>::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 ChannelCounterparty_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelCounterparty)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the ChannelCounterparty -pub extern "C" fn ChannelCounterparty_clone(orig: &ChannelCounterparty) -> ChannelCounterparty { - orig.clone() -} -/// Get a string which allows debug introspection of a ChannelCounterparty object -pub extern "C" fn ChannelCounterparty_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelCounterparty }).into()} - -use lightning::ln::channelmanager::ChannelDetails as nativeChannelDetailsImport; -pub(crate) type nativeChannelDetails = nativeChannelDetailsImport; - -/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] -#[must_use] -#[repr(C)] -pub struct ChannelDetails { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, 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 nativeChannelDetails, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust functions which take ownership of an object provided via an argument require - /// this to be true and invalidate the object pointed to by inner. - pub is_owned: bool, -} - -impl Drop for ChannelDetails { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeChannelDetails>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn ChannelDetails_free(this_obj: ChannelDetails) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDetails) }; -} -#[allow(unused)] -impl ChannelDetails { - pub(crate) fn get_native_ref(&self) -> &'static nativeChannelDetails { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelDetails { - 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 nativeChannelDetails { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes, -/// thereafter this is the txid of the funding transaction xor the funding transaction output). -/// Note that this means this value is *not* persistent - it can change once during the -/// lifetime of the channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } -} -/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes, -/// thereafter this is the txid of the funding transaction xor the funding transaction output). -/// Note that this means this value is *not* persistent - it can change once during the -/// lifetime of the channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::types::ChannelId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Parameters which apply to our counterparty. See individual fields for more information. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_counterparty(this_ptr: &ChannelDetails) -> crate::lightning::ln::channelmanager::ChannelCounterparty { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty; - crate::lightning::ln::channelmanager::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channelmanager::ChannelCounterparty<>) as *mut _) }, is_owned: false } -} -/// Parameters which apply to our counterparty. See individual fields for more information. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_counterparty(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::channelmanager::ChannelCounterparty) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The Channel's funding transaction output, if we've negotiated the funding transaction with -/// our counterparty already. -/// -/// 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 ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txo; - let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// The Channel's funding transaction output, if we've negotiated the funding transaction with -/// our counterparty already. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, mut val: crate::lightning::chain::transaction::OutPoint) { - 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) }.funding_txo = local_val; -} -/// The features which this channel operates with. See individual features for more info. -/// -/// `None` until negotiation completes and the channel type is finalized. -/// -/// 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 ChannelDetails_get_channel_type(this_ptr: &ChannelDetails) -> crate::lightning::ln::features::ChannelTypeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type; - let mut local_inner_val = crate::lightning::ln::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::ln::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// The features which this channel operates with. See individual features for more info. -/// -/// `None` until negotiation completes and the channel type is finalized. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, mut val: crate::lightning::ln::features::ChannelTypeFeatures) { - 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) }.channel_type = local_val; -} -/// The position of the funding transaction in the chain. None if the funding transaction has -/// not yet been confirmed and the channel fully opened. -/// -/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound -/// payments instead of this. See [`get_inbound_payment_scid`]. -/// -/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may -/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. -/// -/// [`inbound_scid_alias`]: Self::inbound_scid_alias -/// [`outbound_scid_alias`]: Self::outbound_scid_alias -/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid -/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid -/// [`confirmations_required`]: Self::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; - 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 position of the funding transaction in the chain. None if the funding transaction has -/// not yet been confirmed and the channel fully opened. -/// -/// Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound -/// payments instead of this. See [`get_inbound_payment_scid`]. -/// -/// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may -/// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. -/// -/// [`inbound_scid_alias`]: Self::inbound_scid_alias -/// [`outbound_scid_alias`]: Self::outbound_scid_alias -/// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid -/// [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid -/// [`confirmations_required`]: Self::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDetails, 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) }.short_channel_id = local_val; -} -/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and -/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when -/// the channel has not yet been confirmed (as long as [`confirmations_required`] is -/// `Some(0)`). -/// -/// This will be `None` as long as the channel is not available for routing outbound payments. -/// -/// [`short_channel_id`]: Self::short_channel_id -/// [`confirmations_required`]: Self::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_scid_alias; - 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 -} -/// An optional [`short_channel_id`] alias for this channel, randomly generated by us and -/// usable in place of [`short_channel_id`] to reference the channel in outbound routes when -/// the channel has not yet been confirmed (as long as [`confirmations_required`] is -/// `Some(0)`). -/// -/// This will be `None` as long as the channel is not available for routing outbound payments. -/// -/// [`short_channel_id`]: Self::short_channel_id -/// [`confirmations_required`]: Self::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_set_outbound_scid_alias(this_ptr: &mut ChannelDetails, 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) }.outbound_scid_alias = local_val; -} -/// An optional [`short_channel_id`] alias for this channel, randomly generated by our -/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our -/// counterparty will recognize the alias provided here in place of the [`short_channel_id`] -/// when they see a payment to be routed to us. -/// -/// Our counterparty may choose to rotate this value at any time, though will always recognize -/// previous values for inbound payment forwarding. -/// -/// [`short_channel_id`]: Self::short_channel_id -#[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_scid_alias; - 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 -} -/// An optional [`short_channel_id`] alias for this channel, randomly generated by our -/// counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our -/// counterparty will recognize the alias provided here in place of the [`short_channel_id`] -/// when they see a payment to be routed to us. -/// -/// Our counterparty may choose to rotate this value at any time, though will always recognize -/// previous values for inbound payment forwarding. -/// -/// [`short_channel_id`]: Self::short_channel_id -#[no_mangle] -pub extern "C" fn ChannelDetails_set_inbound_scid_alias(this_ptr: &mut ChannelDetails, 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) }.inbound_scid_alias = local_val; -} -/// The value, in satoshis, of this channel as appears in the funding output -#[no_mangle] -pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis; - *inner_val -} -/// The value, in satoshis, of this channel as appears in the funding output -#[no_mangle] -pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; -} -/// The value, in satoshis, that must always be held in the channel for us. This value ensures -/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least -/// this value on chain. -/// -/// This value is not included in [`outbound_capacity_msat`] as it can never be spent. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -/// -/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat -#[no_mangle] -pub extern "C" fn ChannelDetails_get_unspendable_punishment_reserve(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; - 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 value, in satoshis, that must always be held in the channel for us. This value ensures -/// that if we broadcast a revoked state, our counterparty can punish us by claiming at least -/// this value on chain. -/// -/// This value is not included in [`outbound_capacity_msat`] as it can never be spent. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -/// -/// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat -#[no_mangle] -pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &mut ChannelDetails, 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) }.unspendable_punishment_reserve = local_val; -} -/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound -/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if -/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise -/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects -/// serialized with LDK versions prior to 0.0.113. -/// -/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel -/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel -/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels -#[no_mangle] -pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::U128 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id; - inner_val.into() -} -/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound -/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if -/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise -/// `user_channel_id` will be randomized for an inbound channel. This may be zero for objects -/// serialized with LDK versions prior to 0.0.113. -/// -/// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel -/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel -/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels -#[no_mangle] -pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::U128) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into(); -} -/// The currently negotiated fee rate denominated in satoshi per 1000 weight units, -/// which is applied to commitment and HTLC transactions. -/// -/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_feerate_sat_per_1000_weight(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight; - 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 currently negotiated fee rate denominated in satoshi per 1000 weight units, -/// which is applied to commitment and HTLC transactions. -/// -/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_feerate_sat_per_1000_weight(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { - let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.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. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_capacity_msat; - *inner_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. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outbound_capacity_msat = val; -} -/// The available outbound capacity for sending a single HTLC to the remote peer. This is -/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by -/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us -/// to use a limit as close as possible to the HTLC limit we can currently send. -/// -/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], -/// [`ChannelDetails::balance_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; - *inner_val -} -/// The available outbound capacity for sending a single HTLC to the remote peer. This is -/// similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by -/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us -/// to use a limit as close as possible to the HTLC limit we can currently send. -/// -/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], -/// [`ChannelDetails::balance_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; -} -/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of -/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than -/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a -/// route which is valid. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_next_outbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_minimum_msat; - *inner_val -} -/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of -/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than -/// an upper-bound. This is intended for use when routing, allowing us to ensure we pick a -/// route which is valid. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_next_outbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_minimum_msat = val; -} -/// The available inbound capacity for the remote peer to send HTLCs to us. This does not -/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not -/// available for inclusion in new inbound HTLCs). -/// Note that there are some corner cases not fully handled here, so the actual available -/// inbound capacity may be slightly higher than this. -/// -/// This value is not exact. Due to various in-flight changes, feerate changes, and our -/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. -/// However, our counterparty should be able to spend nearly this amount. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_capacity_msat; - *inner_val -} -/// The available inbound capacity for the remote peer to send HTLCs to us. This does not -/// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not -/// available for inclusion in new inbound HTLCs). -/// Note that there are some corner cases not fully handled here, so the actual available -/// inbound capacity may be slightly higher than this. -/// -/// This value is not exact. Due to various in-flight changes, feerate changes, and our -/// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. -/// However, our counterparty should be able to spend nearly this amount. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_inbound_capacity_msat(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_capacity_msat = val; -} -/// The number of required confirmations on the funding transaction before the funding will be -/// considered \"locked\". This number is selected by the channel fundee (i.e. us if -/// [`is_outbound`] is *not* set), and can be selected for inbound channels with -/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with -/// [`ChannelHandshakeLimits::max_minimum_depth`]. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -/// -/// [`is_outbound`]: ChannelDetails::is_outbound -/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth -/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth -#[no_mangle] -pub extern "C" fn ChannelDetails_get_confirmations_required(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations_required; - 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 number of required confirmations on the funding transaction before the funding will be -/// considered \"locked\". This number is selected by the channel fundee (i.e. us if -/// [`is_outbound`] is *not* set), and can be selected for inbound channels with -/// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with -/// [`ChannelHandshakeLimits::max_minimum_depth`]. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -/// -/// [`is_outbound`]: ChannelDetails::is_outbound -/// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth -/// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth -#[no_mangle] -pub extern "C" fn ChannelDetails_set_confirmations_required(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { - let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations_required = local_val; -} -/// The current number of confirmations on the funding transaction. -/// -/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_confirmations(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; - local_inner_val -} -/// The current number of confirmations on the funding transaction. -/// -/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_confirmations(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { - let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations = local_val; -} -/// The number of blocks (after our commitment transaction confirms) that we will need to wait -/// until we can claim our funds after we force-close the channel. During this time our -/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty -/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any -/// time to claim our non-HTLC-encumbered funds. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_force_close_spend_delay(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u16Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_spend_delay; - 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 number of blocks (after our commitment transaction confirms) that we will need to wait -/// until we can claim our funds after we force-close the channel. During this time our -/// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty -/// force-closes the channel and broadcasts a commitment transaction we do not have to wait any -/// time to claim our non-HTLC-encumbered funds. -/// -/// This value will be `None` for outbound channels until the counterparty accepts the channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_force_close_spend_delay(this_ptr: &mut ChannelDetails, 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) }.force_close_spend_delay = local_val; -} -/// True if the channel was initiated (and thus funded) by us. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_is_outbound(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_outbound; - *inner_val -} -/// True if the channel was initiated (and thus funded) by us. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_outbound = val; -} -/// True if the channel is confirmed, channel_ready messages have been exchanged, and the -/// channel is not currently being shut down. `channel_ready` message exchange implies the -/// required confirmation count has been reached (and we were connected to the peer at some -/// point after the funding transaction received enough confirmations). The required -/// confirmation count is provided in [`confirmations_required`]. -/// -/// [`confirmations_required`]: ChannelDetails::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_get_is_channel_ready(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_channel_ready; - *inner_val -} -/// True if the channel is confirmed, channel_ready messages have been exchanged, and the -/// channel is not currently being shut down. `channel_ready` message exchange implies the -/// required confirmation count has been reached (and we were connected to the peer at some -/// point after the funding transaction received enough confirmations). The required -/// confirmation count is provided in [`confirmations_required`]. -/// -/// [`confirmations_required`]: ChannelDetails::confirmations_required -#[no_mangle] -pub extern "C" fn ChannelDetails_set_is_channel_ready(this_ptr: &mut ChannelDetails, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_channel_ready = val; -} -/// The stage of the channel's shutdown. -/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. -/// -/// Returns a copy of the field. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_channel_shutdown_state(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_ChannelShutdownStateZ { - let mut inner_val = this_ptr.get_native_mut_ref().channel_shutdown_state.clone(); - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ChannelShutdownStateZ::None } else { crate::c_types::derived::COption_ChannelShutdownStateZ::Some( { crate::lightning::ln::channelmanager::ChannelShutdownState::native_into(inner_val.unwrap()) }) }; - local_inner_val -} -/// The stage of the channel's shutdown. -/// `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_channel_shutdown_state(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_ChannelShutdownStateZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_native() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_shutdown_state = local_val; -} -/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) -/// the peer is connected, and (c) the channel is not currently negotiating a shutdown. -/// -/// This is a strict superset of `is_channel_ready`. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_usable; - *inner_val -} -/// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) -/// the peer is connected, and (c) the channel is not currently negotiating a shutdown. -/// -/// This is a strict superset of `is_channel_ready`. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_usable = val; -} -/// True if this channel is (or will be) publicly-announced. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_is_public(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_public; - *inner_val -} -/// True if this channel is (or will be) publicly-announced. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_is_public(this_ptr: &mut ChannelDetails, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.is_public = val; -} -/// The smallest value HTLC (in msat) we will accept, for this channel. This field -/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 -#[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_minimum_msat; - 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 smallest value HTLC (in msat) we will accept, for this channel. This field -/// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 -#[no_mangle] -pub extern "C" fn ChannelDetails_set_inbound_htlc_minimum_msat(this_ptr: &mut ChannelDetails, 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) }.inbound_htlc_minimum_msat = local_val; -} -/// The largest value HTLC (in msat) we currently will accept, for this channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_htlc_maximum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_maximum_msat; - 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 largest value HTLC (in msat) we currently will accept, for this channel. -#[no_mangle] -pub extern "C" fn ChannelDetails_set_inbound_htlc_maximum_msat(this_ptr: &mut ChannelDetails, 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) }.inbound_htlc_maximum_msat = local_val; -} -/// Set of configurable parameters that affect channel operation. -/// -/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. -/// -/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn ChannelDetails_get_config(this_ptr: &ChannelDetails) -> crate::lightning::util::config::ChannelConfig { - let mut inner_val = &mut this_ptr.get_native_mut_ref().config; - let mut local_inner_val = crate::lightning::util::config::ChannelConfig { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelConfig<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// Set of configurable parameters that affect channel operation. -/// -/// This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut val: crate::lightning::util::config::ChannelConfig) { - 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) }.config = local_val; -} -impl Clone for ChannelDetails { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeChannelDetails>::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 ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDetails)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the ChannelDetails -pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails { - orig.clone() -} -/// Get a string which allows debug introspection of a ChannelDetails object -pub extern "C" fn ChannelDetails_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelDetails }).into()} -/// Gets the current SCID which should be used to identify this channel for inbound payments. -/// This should be used for providing invoice hints or in any other context where our -/// counterparty will forward a payment to us. -/// -/// This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the -/// [`ChannelDetails::short_channel_id`]. See those for more information. -#[must_use] -#[no_mangle] -pub extern "C" fn ChannelDetails_get_inbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_inbound_payment_scid(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; - local_ret -} - -/// Gets the current SCID which should be used to identify this channel for outbound payments. -/// This should be used in [`Route`]s to describe the first hop or in other contexts where -/// we're sending or forwarding a payment outbound over this channel. -/// -/// This is either the [`ChannelDetails::short_channel_id`], if set, or the -/// [`ChannelDetails::outbound_scid_alias`]. See those for more information. -#[must_use] -#[no_mangle] -pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_outbound_payment_scid(); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; - local_ret -} - -/// Further information on the details of the channel shutdown. -/// Upon channels being forced closed (i.e. commitment transaction confirmation detected -/// by `ChainMonitor`), ChannelShutdownState will be set to `ShutdownComplete` or -/// the channel will be removed shortly. -/// Also note, that in normal operation, peers could disconnect at any of these states -/// and require peer re-connection before making progress onto other states -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum ChannelShutdownState { - /// Channel has not sent or received a shutdown message. - NotShuttingDown, - /// Local node has sent a shutdown message for this channel. - ShutdownInitiated, - /// Shutdown message exchanges have concluded and the channels are in the midst of - /// resolving all existing open HTLCs before closing can continue. - ResolvingHTLCs, - /// All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates. - NegotiatingClosingFee, - /// We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about - /// to drop the channel. - ShutdownComplete, -} -use lightning::ln::channelmanager::ChannelShutdownState as ChannelShutdownStateImport; -pub(crate) type nativeChannelShutdownState = ChannelShutdownStateImport; - -impl ChannelShutdownState { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeChannelShutdownState { - match self { - ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown, - ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated, - ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs, - ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee, - ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeChannelShutdownState { - match self { - ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown, - ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated, - ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs, - ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee, - ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &ChannelShutdownStateImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeChannelShutdownState) }; - match native { - nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown, - nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated, - nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs, - nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee, - nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeChannelShutdownState) -> Self { - match native { - nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown, - nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated, - nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs, - nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee, - nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete, - } - } -} -/// Creates a copy of the ChannelShutdownState -#[no_mangle] -pub extern "C" fn ChannelShutdownState_clone(orig: &ChannelShutdownState) -> ChannelShutdownState { - 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 ChannelShutdownState_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelShutdownState)).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 ChannelShutdownState_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelShutdownState) }; -} -#[no_mangle] -/// Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState -pub extern "C" fn ChannelShutdownState_not_shutting_down() -> ChannelShutdownState { - ChannelShutdownState::NotShuttingDown} -#[no_mangle] -/// Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState -pub extern "C" fn ChannelShutdownState_shutdown_initiated() -> ChannelShutdownState { - ChannelShutdownState::ShutdownInitiated} -#[no_mangle] -/// Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState -pub extern "C" fn ChannelShutdownState_resolving_htlcs() -> ChannelShutdownState { - ChannelShutdownState::ResolvingHTLCs} -#[no_mangle] -/// Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState -pub extern "C" fn ChannelShutdownState_negotiating_closing_fee() -> ChannelShutdownState { - ChannelShutdownState::NegotiatingClosingFee} -#[no_mangle] -/// Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState -pub extern "C" fn ChannelShutdownState_shutdown_complete() -> ChannelShutdownState { - ChannelShutdownState::ShutdownComplete} -/// Get a string which allows debug introspection of a ChannelShutdownState object -pub extern "C" fn ChannelShutdownState_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::channelmanager::ChannelShutdownState }).into()} -/// Checks if two ChannelShutdownStates contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn ChannelShutdownState_eq(a: &ChannelShutdownState, b: &ChannelShutdownState) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} /// Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments. /// These include payments that have yet to find a successful path, or have unresolved HTLCs. #[derive(Clone)] @@ -3225,7 +2122,7 @@ impl PhantomRouteHints { #[no_mangle] pub extern "C" fn PhantomRouteHints_get_channels(this_ptr: &PhantomRouteHints) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut inner_val = &mut this_ptr.get_native_mut_ref().channels; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } /// The list of channels to be included in the invoice route hints. @@ -3371,7 +2268,7 @@ pub extern "C" fn ChannelManager_create_channel(this_arg: &crate::lightning::ln: #[no_mangle] pub extern "C" fn ChannelManager_list_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_channels(); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() } @@ -3385,7 +2282,7 @@ pub extern "C" fn ChannelManager_list_channels(this_arg: &crate::lightning::ln:: #[no_mangle] pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_usable_channels(); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() } @@ -3394,7 +2291,7 @@ pub extern "C" fn ChannelManager_list_usable_channels(this_arg: &crate::lightnin #[no_mangle] pub extern "C" fn ChannelManager_list_channels_with_counterparty(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_ChannelDetailsZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_channels_with_counterparty(&counterparty_node_id.into_rust()); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() } @@ -4821,54 +3718,6 @@ pub extern "C" fn provided_init_features(config: &crate::lightning::util::config crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } -#[no_mangle] -/// Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read -pub extern "C" fn CounterpartyForwardingInfo_write(obj: &crate::lightning::ln::channelmanager::CounterpartyForwardingInfo) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn CounterpartyForwardingInfo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeCounterpartyForwardingInfo) }) -} -#[no_mangle] -/// Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write -pub extern "C" fn CounterpartyForwardingInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyForwardingInfoDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::CounterpartyForwardingInfo { 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 ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read -pub extern "C" fn ChannelCounterparty_write(obj: &crate::lightning::ln::channelmanager::ChannelCounterparty) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn ChannelCounterparty_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelCounterparty) }) -} -#[no_mangle] -/// Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write -pub extern "C" fn ChannelCounterparty_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelCounterpartyDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelCounterparty { 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 ChannelDetails object into a byte array which can be read by ChannelDetails_read -pub extern "C" fn ChannelDetails_write(obj: &crate::lightning::ln::channelmanager::ChannelDetails) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn ChannelDetails_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelDetails) }) -} -#[no_mangle] -/// Read a ChannelDetails from a byte array, created by ChannelDetails_write -pub extern "C" fn ChannelDetails_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelDetailsDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelDetails { 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 PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read pub extern "C" fn PhantomRouteHints_write(obj: &crate::lightning::ln::channelmanager::PhantomRouteHints) -> crate::c_types::derived::CVec_u8Z { @@ -4958,22 +3807,6 @@ pub extern "C" fn ChannelManager_write(obj: &crate::lightning::ln::channelmanage pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelManager) }) } -#[no_mangle] -/// Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read -pub extern "C" fn ChannelShutdownState_write(obj: &crate::lightning::ln::channelmanager::ChannelShutdownState) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) -} -#[allow(unused)] -pub(crate) extern "C" fn ChannelShutdownState_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - ChannelShutdownState_write(unsafe { &*(obj as *const ChannelShutdownState) }) -} -#[no_mangle] -/// Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write -pub extern "C" fn ChannelShutdownState_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelShutdownStateDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::ChannelShutdownState::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::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, >; diff --git a/lightning-c-bindings/src/lightning/ln/mod.rs b/lightning-c-bindings/src/lightning/ln/mod.rs index 376e490..8b65861 100644 --- a/lightning-c-bindings/src/lightning/ln/mod.rs +++ b/lightning-c-bindings/src/lightning/ln/mod.rs @@ -20,6 +20,7 @@ use alloc::{vec::Vec, boxed::Box}; pub mod onion_payment; pub mod channelmanager; pub mod channel_keys; +pub mod channel_state; pub mod inbound_payment; pub mod msgs; pub mod peer_handler; diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index 279dcdf..47dbcaa 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -6614,6 +6614,11 @@ pub extern "C" fn SocketAddressParseError_hash(o: &SocketAddressParseError) -> u pub extern "C" fn SocketAddressParseError_eq(a: &SocketAddressParseError, b: &SocketAddressParseError) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } +#[no_mangle] +/// Get the string representation of a SocketAddressParseError object +pub extern "C" fn SocketAddressParseError_to_str(o: &crate::lightning::ln::msgs::SocketAddressParseError) -> Str { + alloc::format!("{}", &o.to_native()).into() +} /// Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. /// /// The host part must end with \".onion\". @@ -10211,6 +10216,11 @@ pub(crate) extern "C" fn TrampolineOnionPacket_write_void(obj: *const c_void) -> pub extern "C" fn TrampolineOnionPacket_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TrampolineOnionPacket }).into()} #[no_mangle] +/// Get the string representation of a DecodeError object +pub extern "C" fn DecodeError_to_str(o: &crate::lightning::ln::msgs::DecodeError) -> Str { + alloc::format!("{}", &o.to_native()).into() +} +#[no_mangle] /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read pub extern "C" fn AcceptChannel_write(obj: &crate::lightning::ln::msgs::AcceptChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index 5d6a6d9..63f443e 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -1307,6 +1307,11 @@ pub extern "C" fn PeerHandleError_clone(orig: &PeerHandleError) -> PeerHandleErr /// Get a string which allows debug introspection of a PeerHandleError object pub extern "C" fn PeerHandleError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::peer_handler::PeerHandleError }).into()} +#[no_mangle] +/// Get the string representation of a PeerHandleError object +pub extern "C" fn PeerHandleError_to_str(o: &crate::lightning::ln::peer_handler::PeerHandleError) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} use lightning::ln::peer_handler::PeerManager as nativePeerManagerImport; pub(crate) type nativePeerManager = nativePeerManagerImport; diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index 9be5498..3806636 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -271,3 +271,8 @@ pub extern "C" fn ShutdownScript_is_compatible(this_arg: &crate::lightning::ln:: ret } +#[no_mangle] +/// Get the string representation of a ShutdownScript object +pub extern "C" fn ShutdownScript_to_str(o: &crate::lightning::ln::script::ShutdownScript) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} diff --git a/lightning-c-bindings/src/lightning/ln/types.rs b/lightning-c-bindings/src/lightning/ln/types.rs index 145eaa7..7d07ff0 100644 --- a/lightning-c-bindings/src/lightning/ln/types.rs +++ b/lightning-c-bindings/src/lightning/ln/types.rs @@ -217,3 +217,8 @@ 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/offers/invoice_error.rs b/lightning-c-bindings/src/lightning/offers/invoice_error.rs index 68a64cb..11b392d 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_error.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_error.rs @@ -259,6 +259,11 @@ pub extern "C" fn InvoiceError_from_string(mut s: crate::c_types::Str) -> crate: crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc(ret), is_owned: true } } +#[no_mangle] +/// Get the string representation of a InvoiceError object +pub extern "C" fn InvoiceError_to_str(o: &crate::lightning::offers::invoice_error::InvoiceError) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read pub extern "C" fn InvoiceError_write(obj: &crate::lightning::offers::invoice_error::InvoiceError) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/offers/offer.rs b/lightning-c-bindings/src/lightning/offers/offer.rs index 9ff5def..3fd90e2 100644 --- a/lightning-c-bindings/src/lightning/offers/offer.rs +++ b/lightning-c-bindings/src/lightning/offers/offer.rs @@ -1138,3 +1138,8 @@ pub extern "C" fn Offer_from_str(s: crate::c_types::Str) -> crate::c_types::deri }, }.into() } +#[no_mangle] +/// Get the string representation of a Offer object +pub extern "C" fn Offer_to_str(o: &crate::lightning::offers::offer::Offer) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} diff --git a/lightning-c-bindings/src/lightning/offers/refund.rs b/lightning-c-bindings/src/lightning/offers/refund.rs index 5b6e336..6d7d390 100644 --- a/lightning-c-bindings/src/lightning/offers/refund.rs +++ b/lightning-c-bindings/src/lightning/offers/refund.rs @@ -538,3 +538,8 @@ pub extern "C" fn Refund_from_str(s: crate::c_types::Str) -> crate::c_types::der }, }.into() } +#[no_mangle] +/// Get the string representation of a Refund object +pub extern "C" fn Refund_to_str(o: &crate::lightning::offers::refund::Refund) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} diff --git a/lightning-c-bindings/src/lightning/routing/gossip.rs b/lightning-c-bindings/src/lightning/routing/gossip.rs index 373ac4f..f199905 100644 --- a/lightning-c-bindings/src/lightning/routing/gossip.rs +++ b/lightning-c-bindings/src/lightning/routing/gossip.rs @@ -133,6 +133,11 @@ pub extern "C" fn NodeId_as_pubkey(this_arg: &crate::lightning::routing::gossip: /// Get a string which allows debug introspection of a NodeId object pub extern "C" fn NodeId_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::gossip::NodeId }).into()} +#[no_mangle] +/// Get the string representation of a NodeId object +pub extern "C" fn NodeId_to_str(o: &crate::lightning::routing::gossip::NodeId) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} /// Generates a non-cryptographic 64-bit hash of the NodeId. #[no_mangle] pub extern "C" fn NodeId_hash(o: &NodeId) -> u64 { @@ -912,6 +917,11 @@ pub extern "C" fn ChannelUpdateInfo_eq(a: &ChannelUpdateInfo, b: &ChannelUpdateI if a.get_native_ref() == b.get_native_ref() { true } else { false } } #[no_mangle] +/// Get the string representation of a ChannelUpdateInfo object +pub extern "C" fn ChannelUpdateInfo_to_str(o: &crate::lightning::routing::gossip::ChannelUpdateInfo) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} +#[no_mangle] /// Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read pub extern "C" fn ChannelUpdateInfo_write(obj: &crate::lightning::routing::gossip::ChannelUpdateInfo) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) @@ -1124,6 +1134,11 @@ pub extern "C" fn ChannelInfo_get_directional_info(this_arg: &crate::lightning:: local_ret } +#[no_mangle] +/// Get the string representation of a ChannelInfo object +pub extern "C" fn ChannelInfo_to_str(o: &crate::lightning::routing::gossip::ChannelInfo) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read pub extern "C" fn ChannelInfo_write(obj: &crate::lightning::routing::gossip::ChannelInfo) -> crate::c_types::derived::CVec_u8Z { @@ -1941,6 +1956,11 @@ pub extern "C" fn NodeAlias_eq(a: &NodeAlias, b: &NodeAlias) -> bool { if a.get_native_ref() == b.get_native_ref() { true } else { false } } #[no_mangle] +/// Get the string representation of a NodeAlias object +pub extern "C" fn NodeAlias_to_str(o: &crate::lightning::routing::gossip::NodeAlias) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} +#[no_mangle] /// Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read pub extern "C" fn NodeAlias_write(obj: &crate::lightning::routing::gossip::NodeAlias) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) @@ -2095,6 +2115,11 @@ pub extern "C" fn NodeInfo_is_tor_only(this_arg: &crate::lightning::routing::gos ret } +#[no_mangle] +/// Get the string representation of a NodeInfo object +pub extern "C" fn NodeInfo_to_str(o: &crate::lightning::routing::gossip::NodeInfo) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read pub extern "C" fn NodeInfo_write(obj: &crate::lightning::routing::gossip::NodeInfo) -> crate::c_types::derived::CVec_u8Z { @@ -2128,6 +2153,11 @@ pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice, arg: crate::li let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NetworkGraph { 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 NetworkGraph object +pub extern "C" fn NetworkGraph_to_str(o: &crate::lightning::routing::gossip::NetworkGraph) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} /// Creates a new, empty, network graph. #[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 a3fe963..aa6acd8 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -227,20 +227,20 @@ impl lightning::onion_message::messenger::MessageRouter for Router { use lightning::routing::router::Router as rustRouter; impl rustRouter for Router { - fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { - let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; + fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { + let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }); let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning::ln::types::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { - let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; + fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning::ln::types::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { + let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.find_route_with_id)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: _payment_hash.0 }, crate::c_types::ThirtyTwoBytes { data: _payment_id.0 }); let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_first_hops = Vec::new(); for mut item in first_hops.drain(..) { local_first_hops.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { + let mut local_first_hops = Vec::new(); for mut item in first_hops.drain(..) { local_first_hops.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; let mut ret = (self.create_blinded_payment_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), local_first_hops.into(), crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(tlvs), is_owned: true }, amount_msats); 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) = item.to_rust(); let mut local_ret_0_0 = (*unsafe { Box::from_raw(orig_ret_0_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_0_1.take_inner()) }); local_ret_0_0 }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret @@ -1232,6 +1232,11 @@ pub extern "C" fn Route_get_total_amount(this_arg: &crate::lightning::routing::r ret } +#[no_mangle] +/// Get the string representation of a Route object +pub extern "C" fn Route_to_str(o: &crate::lightning::routing::router::Route) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the Route object into a byte array which can be read by Route_read pub extern "C" fn Route_write(obj: &crate::lightning::routing::router::Route) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index ad32191..af9ceef 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -147,6 +147,11 @@ pub extern "C" fn Level_hash(o: &Level) -> u64 { core::hash::Hash::hash(&o.to_native(), &mut hasher); core::hash::Hasher::finish(&hasher) } +#[no_mangle] +/// Get the string representation of a Level object +pub extern "C" fn Level_to_str(o: &crate::lightning::util::logger::Level) -> Str { + alloc::format!("{}", &o.to_native()).into() +} /// Returns the most verbose logging level. #[must_use] #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index 9cfaca4..1235f5c 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -262,6 +262,11 @@ pub extern "C" fn Hostname_len(this_arg: &crate::lightning::util::ser::Hostname) ret } +#[no_mangle] +/// Get the string representation of a Hostname object +pub extern "C" fn Hostname_to_str(o: &crate::lightning::util::ser::Hostname) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} #[no_mangle] /// Serialize the Hostname object into a byte array which can be read by Hostname_read pub extern "C" fn Hostname_write(obj: &crate::lightning::util::ser::Hostname) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/util/string.rs b/lightning-c-bindings/src/lightning/util/string.rs index b22a8a4..c858a07 100644 --- a/lightning-c-bindings/src/lightning/util/string.rs +++ b/lightning-c-bindings/src/lightning/util/string.rs @@ -142,6 +142,11 @@ pub extern "C" fn UntrustedString_read(ser: crate::c_types::u8slice) -> crate::c let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::string::UntrustedString { 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 UntrustedString object +pub extern "C" fn UntrustedString_to_str(o: &crate::lightning::util::string::UntrustedString) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} use lightning::util::string::PrintableString as nativePrintableStringImport; pub(crate) type nativePrintableString = nativePrintableStringImport<'static, >; @@ -214,3 +219,8 @@ pub extern "C" fn PrintableString_new(mut a_arg: crate::c_types::Str) -> Printab /// Get a string which allows debug introspection of a PrintableString object pub extern "C" fn PrintableString_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::string::PrintableString }).into()} +#[no_mangle] +/// Get the string representation of a PrintableString object +pub extern "C" fn PrintableString_to_str(o: &crate::lightning::util::string::PrintableString) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} -- 2.30.2