From: Matt Corallo Date: Fri, 19 Nov 2021 20:12:13 +0000 (+0000) Subject: Update auto-generated bindings X-Git-Tag: v0.0.103.1^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a945b11d9f16864753054a47128d71a96de29f73;p=ldk-c-bindings Update auto-generated bindings --- diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index a68b1dd..bbd06e6 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -241,6 +241,8 @@ struct nativeCommitmentUpdateOpaque; typedef struct nativeCommitmentUpdateOpaque LDKnativeCommitmentUpdate; struct nativeDefaultRouterOpaque; typedef struct nativeDefaultRouterOpaque LDKnativeDefaultRouter; +struct nativeRecordOpaque; +typedef struct nativeRecordOpaque LDKnativeRecord; struct nativeMonitorUpdateIdOpaque; typedef struct nativeMonitorUpdateIdOpaque LDKnativeMonitorUpdateId; struct nativeLockedChannelMonitorOpaque; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index a1b91e7..090c0ee 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,7 +1,7 @@ #ifndef LDK_C_BINDINGS_H #define LDK_C_BINDINGS_H -/* Generated with cbindgen:0.19.0 */ +/* Generated with cbindgen:0.20.0 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -2171,6 +2171,143 @@ typedef struct LDKCOption_C2Tuple_usizeTransactionZZ { }; } LDKCOption_C2Tuple_usizeTransactionZZ; +/** + * The reason the channel was closed. See individual variants more details. + */ +typedef enum LDKClosureReason_Tag { + /** + * Closure generated from receiving a peer error message. + * + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. + */ + LDKClosureReason_CounterpartyForceClosed, + /** + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + */ + LDKClosureReason_HolderForceClosed, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. Note the shutdown may have been initiated by us. + */ + LDKClosureReason_CooperativeClosure, + /** + * A commitment transaction was confirmed on chain, closing the channel. Most likely this + * commitment transaction came from our counterparty, but it may also have come from + * a copy of our own `ChannelMonitor`. + */ + LDKClosureReason_CommitmentTxConfirmed, + /** + * Closure generated from processing an event, likely a HTLC forward/relay/reception. + */ + LDKClosureReason_ProcessingError, + /** + * The `PeerManager` informed us that we've disconnected from the peer. We close channels + * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the + * peer again in the future or if the peer disconnected before we finished negotiating + * the channel open. The first case may be caused by incompatible features which our + * counterparty, or we, require. + */ + LDKClosureReason_DisconnectedPeer, + /** + * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than + * the ChannelManager deserialized. + */ + LDKClosureReason_OutdatedChannelManager, + /** + * Must be last for serialization purposes + */ + LDKClosureReason_Sentinel, +} LDKClosureReason_Tag; + +typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { + /** + * The error which the peer sent us. + * + * The string should be sanitized before it is used (e.g emitted to logs + * or printed to stdout). Otherwise, a well crafted error message may exploit + * a security vulnerability in the terminal emulator or the logging subsystem. + */ + struct LDKStr peer_msg; +} LDKClosureReason_LDKCounterpartyForceClosed_Body; + +typedef struct LDKClosureReason_LDKProcessingError_Body { + /** + * A developer-readable error message which we generated. + */ + struct LDKStr err; +} LDKClosureReason_LDKProcessingError_Body; + +typedef struct MUST_USE_STRUCT LDKClosureReason { + LDKClosureReason_Tag tag; + union { + LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; + LDKClosureReason_LDKProcessingError_Body processing_error; + }; +} LDKClosureReason; + +/** + * An enum which can either contain a crate::lightning::util::events::ClosureReason or not + */ +typedef enum LDKCOption_ClosureReasonZ_Tag { + /** + * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason + */ + LDKCOption_ClosureReasonZ_Some, + /** + * When we're in this state, this COption_ClosureReasonZ contains nothing + */ + LDKCOption_ClosureReasonZ_None, + /** + * Must be last for serialization purposes + */ + 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 { + /** + * 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; + /** + * 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; + +/** + * 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 contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + /** @@ -2431,722 +2568,1151 @@ typedef struct LDKCVec_SpendableOutputDescriptorZ { uintptr_t datalen; } LDKCVec_SpendableOutputDescriptorZ; - - /** - * An accept_channel message to be sent or received from a peer + * Some information provided on receipt of payment depends on whether the payment received is a + * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. */ -typedef struct MUST_USE_STRUCT LDKAcceptChannel { +typedef enum LDKPaymentPurpose_Tag { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Information for receiving a payment that we generated an invoice for. */ - LDKnativeAcceptChannel *inner; + LDKPaymentPurpose_InvoicePayment, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Because this is a spontaneous payment, the payer generated their own preimage rather than us + * (the payee) providing a preimage. */ - bool is_owned; -} LDKAcceptChannel; - - - -/** - * An open_channel message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKOpenChannel { + LDKPaymentPurpose_SpontaneousPayment, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Must be last for serialization purposes */ - LDKnativeOpenChannel *inner; + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; + +typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The preimage to the payment_hash, if the payment hash (and secret) were fetched via + * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to + * [`ChannelManager::claim_funds`]. + * + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - bool is_owned; -} LDKOpenChannel; - - - -/** - * A funding_created message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingCreated { + struct LDKThirtyTwoBytes payment_preimage; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * 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 */ - LDKnativeFundingCreated *inner; + struct LDKThirtyTwoBytes payment_secret; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * This is the `user_payment_id` which was provided to + * [`ChannelManager::create_inbound_payment_for_hash`] or + * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is + * simply copied here. It may be used to correlate PaymentReceived events with invoice + * metadata stored elsewhere. + * + * [`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 */ - bool is_owned; -} LDKFundingCreated; - + uint64_t user_payment_id; +} LDKPaymentPurpose_LDKInvoicePayment_Body; +typedef struct MUST_USE_STRUCT LDKPaymentPurpose { + LDKPaymentPurpose_Tag tag; + union { + LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; + struct { + struct LDKThirtyTwoBytes spontaneous_payment; + }; + }; +} LDKPaymentPurpose; /** - * A funding_signed message to be sent or received from a peer + * 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 struct MUST_USE_STRUCT LDKFundingSigned { +typedef enum LDKEvent_Tag { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that the client should generate a funding transaction with the given + * parameters and then call ChannelManager::funding_transaction_generated. + * Generated in ChannelManager message handling. + * Note that *all inputs* in the funding transaction must spend SegWit outputs or your + * counterparty can steal your funds! */ - LDKnativeFundingSigned *inner; + LDKEvent_FundingGenerationReady, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Indicates we've received money! Just gotta dig out that payment preimage and feed it to + * [`ChannelManager::claim_funds`] to get it.... + * Note that if the preimage is not known, you should call + * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid + * network congestion. + * If you fail to call either [`ChannelManager::claim_funds`] or + * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be + * automatically failed. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards */ - bool is_owned; -} LDKFundingSigned; - - - -/** - * A funding_locked message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingLocked { + LDKEvent_PaymentReceived, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * 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. */ - LDKnativeFundingLocked *inner; + LDKEvent_PaymentSent, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Indicates an outbound payment we made failed. Probably some intermediary node dropped + * something. You may wish to retry with a different route. */ - bool is_owned; -} LDKFundingLocked; - - - -/** - * An announcement_signatures message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { + LDKEvent_PaymentPathFailed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a + * time in the future. */ - LDKnativeAnnouncementSignatures *inner; + LDKEvent_PendingHTLCsForwardable, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to indicate that an output which you should know how to spend was confirmed on chain + * and is now spendable. + * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your + * counterparty spending them due to some kind of timeout. Thus, you need to store them + * somewhere and spend them when you create on-chain transactions. */ - bool is_owned; -} LDKAnnouncementSignatures; - - - -/** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment - * transaction updates if they were pending. - */ -typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { + LDKEvent_SpendableOutputs, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * This event is generated when a payment has been successfully forwarded through us and a + * forwarding fee earned. */ - LDKnativeCommitmentUpdate *inner; + LDKEvent_PaymentForwarded, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to indicate that a channel with the given `channel_id` is in the process of closure. */ - bool is_owned; -} LDKCommitmentUpdate; - - - -/** - * A revoke_and_ack message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKRevokeAndACK { + LDKEvent_ChannelClosed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate to the user that they can abandon the funding transaction and recycle the + * inputs for another purpose. */ - LDKnativeRevokeAndACK *inner; + LDKEvent_DiscardFunding, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Must be last for serialization purposes */ - bool is_owned; -} LDKRevokeAndACK; - - + LDKEvent_Sentinel, +} LDKEvent_Tag; -/** - * A closing_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKClosingSigned { +typedef struct LDKEvent_LDKFundingGenerationReady_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The random channel_id we picked which you'll need to pass into + * ChannelManager::funding_transaction_generated. */ - LDKnativeClosingSigned *inner; + struct LDKThirtyTwoBytes temporary_channel_id; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The value, in satoshis, that the output should have. */ - bool is_owned; -} LDKClosingSigned; - - - -/** - * A shutdown message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKShutdown { + uint64_t channel_value_satoshis; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 script which should be used in the transaction output. */ - LDKnativeShutdown *inner; + struct LDKCVec_u8Z output_script; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for + * an inbound channel. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel */ - bool is_owned; -} LDKShutdown; - - + uint64_t user_channel_id; +} LDKEvent_LDKFundingGenerationReady_Body; -/** - * A channel_reestablish message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelReestablish { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelReestablish *inner; +typedef struct LDKEvent_LDKPaymentReceived_Body { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The hash for which the preimage should be handed to the ChannelManager. */ - bool is_owned; -} LDKChannelReestablish; - - - -/** - * A channel_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { + struct LDKThirtyTwoBytes payment_hash; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The value, in thousandths of a satoshi, that this payment is for. */ - LDKnativeChannelAnnouncement *inner; + uint64_t amt; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Information for claiming this received payment, based on whether the purpose of the + * payment is to pay an invoice or to send a spontaneous payment. */ - bool is_owned; -} LDKChannelAnnouncement; - - + struct LDKPaymentPurpose purpose; +} LDKEvent_LDKPaymentReceived_Body; -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { +typedef struct LDKEvent_LDKPaymentSent_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKnativeNodeAnnouncement *inner; + struct LDKThirtyTwoBytes payment_id; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The 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! */ - bool is_owned; -} LDKNodeAnnouncement; - - - -/** - * An error message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKErrorMessage { + struct LDKThirtyTwoBytes payment_preimage; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The hash which was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKnativeErrorMessage *inner; + struct LDKThirtyTwoBytes payment_hash; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 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 */ - bool is_owned; -} LDKErrorMessage; + struct LDKCOption_u64Z fee_paid_msat; +} LDKEvent_LDKPaymentSent_Body; -/** - * Used to put an error message in a LightningError - */ -typedef enum LDKErrorAction_Tag { +typedef struct LDKEvent_LDKPaymentPathFailed_Body { /** - * The peer took some action which made us think they were useless. Disconnect them. + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKErrorAction_DisconnectPeer, + struct LDKThirtyTwoBytes payment_id; /** - * The peer did something harmless that we weren't able to process, just log and ignore + * The hash which was given to ChannelManager::send_payment. */ - LDKErrorAction_IgnoreError, + struct LDKThirtyTwoBytes payment_hash; /** - * The peer did something harmless that we weren't able to meaningfully process. - * If the error is logged, log it at the given level. + * Indicates the payment was rejected for some reason by the recipient. This implies that + * the payment has failed, not just the route in question. If this is not set, you may + * retry the payment via a different route. */ - LDKErrorAction_IgnoreAndLog, + bool rejected_by_dest; /** - * The peer did something incorrect. Tell them. + * Any failure information conveyed via the Onion return packet by a node along the failed + * payment route. + * + * Should be applied to the [`NetworkGraph`] so that routing decisions can take into + * account the update. [`NetGraphMsgHandler`] is capable of doing this. + * + * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph + * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler */ - LDKErrorAction_SendErrorMessage, + struct LDKCOption_NetworkUpdateZ network_update; /** - * Must be last for serialization purposes + * For both single-path and multi-path payments, this is set if all paths of the payment have + * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the + * larger MPP payment were still in flight when this event was generated. */ - LDKErrorAction_Sentinel, -} LDKErrorAction_Tag; - -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { + bool all_paths_failed; /** - * An error message which we should make an effort to send before we disconnect. + * The payment path that failed. + */ + struct LDKCVec_RouteHopZ path; + /** + * The channel responsible for the failed payment path. + * + * 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; + /** + * Parameters needed to compute a new [`Route`] when retrying the failed payment path. + * + * See [`find_route`] for details. + * + * [`Route`]: crate::routing::router::Route + * [`find_route`]: crate::routing::router::find_route * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; + struct LDKRouteParameters retry; +} LDKEvent_LDKPaymentPathFailed_Body; -typedef struct LDKErrorAction_LDKSendErrorMessage_Body { +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { /** - * The message to send. + * The minimum amount of time that should be waited prior to calling + * process_pending_htlc_forwards. To increase the effort required to correlate payments, + * you should wait a random amount of time in roughly the range (now + time_forwardable, + * now + 5*time_forwardable). */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; -typedef struct MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag tag; +typedef struct LDKEvent_LDKSpendableOutputs_Body { + /** + * The outputs which you should store as spendable by you. + */ + struct LDKCVec_SpendableOutputDescriptorZ outputs; +} LDKEvent_LDKSpendableOutputs_Body; + +typedef struct LDKEvent_LDKPaymentForwarded_Body { + /** + * The fee, in milli-satoshis, which was earned as a result of the payment. + * + * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC + * was pending, the amount the next hop claimed will have been rounded down to the nearest + * whole satoshi. Thus, the fee calculated here may be higher than expected as we still + * claimed the full value in millisatoshis from the source. In this case, + * `claim_from_onchain_tx` will be set. + * + * If the channel which sent us the payment has been force-closed, we will claim the funds + * via an on-chain transaction. In that case we do not yet know the on-chain transaction + * fees which we will spend and will instead set this to `None`. It is possible duplicate + * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is + * `None`. + */ + struct LDKCOption_u64Z fee_earned_msat; + /** + * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain + * transaction. + */ + bool claim_from_onchain_tx; +} LDKEvent_LDKPaymentForwarded_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 LDKThirtyTwoBytes channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for + * an inbound channel. This will always be zero for objects serialized with LDK versions + * prior to 0.0.102. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + */ + uint64_t user_channel_id; + /** + * The reason the channel was closed. + */ + struct LDKClosureReason reason; +} LDKEvent_LDKChannelClosed_Body; + +typedef struct LDKEvent_LDKDiscardFunding_Body { + /** + * The channel_id of the channel which has been closed. + */ + struct LDKThirtyTwoBytes channel_id; + /** + * The full transaction received from the user + */ + struct LDKTransaction transaction; +} LDKEvent_LDKDiscardFunding_Body; + +typedef struct MUST_USE_STRUCT LDKEvent { + LDKEvent_Tag tag; + union { + LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; + LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentSent_Body payment_sent; + LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; + LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; + LDKEvent_LDKSpendableOutputs_Body spendable_outputs; + LDKEvent_LDKPaymentForwarded_Body payment_forwarded; + LDKEvent_LDKChannelClosed_Body channel_closed; + LDKEvent_LDKDiscardFunding_Body discard_funding; + }; +} LDKEvent; + +/** + * An enum which can either contain a crate::lightning::util::events::Event or not + */ +typedef enum LDKCOption_EventZ_Tag { + /** + * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event + */ + LDKCOption_EventZ_Some, + /** + * When we're in this state, this COption_EventZ contains nothing + */ + LDKCOption_EventZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_EventZ_Sentinel, +} LDKCOption_EventZ_Tag; + +typedef struct LDKCOption_EventZ { + LDKCOption_EventZ_Tag tag; union { - LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; struct { - enum LDKLevel ignore_and_log; + struct LDKEvent some; }; - LDKErrorAction_LDKSendErrorMessage_Body send_error_message; }; -} LDKErrorAction; +} LDKCOption_EventZ; + +/** + * The contents of CResult_COption_EventZDecodeErrorZ + */ +typedef union LDKCResult_COption_EventZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_EventZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_COption_EventZDecodeErrorZPtr; + +/** + * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_EventZDecodeErrorZ { + /** + * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_EventZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_EventZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_EventZDecodeErrorZ; /** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. + * An accept_channel message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { +typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryChannelRange *inner; + LDKnativeAcceptChannel *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; -} LDKQueryChannelRange; +} LDKAcceptChannel; /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * An open_channel message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { +typedef struct MUST_USE_STRUCT LDKOpenChannel { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryShortChannelIds *inner; + LDKnativeOpenChannel *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; -} LDKQueryShortChannelIds; +} LDKOpenChannel; /** - * A reply_channel_range message is a reply to a query_channel_range - * message. Multiple reply_channel_range messages can be sent in reply - * to a single query_channel_range message. The query recipient makes a - * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * A funding_created message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKReplyChannelRange { +typedef struct MUST_USE_STRUCT LDKFundingCreated { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeReplyChannelRange *inner; + LDKnativeFundingCreated *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; -} LDKReplyChannelRange; +} LDKFundingCreated; + + /** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. + * A funding_signed message to be sent or received from a peer */ -typedef enum LDKMessageSendEvent_Tag { - /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. - */ - LDKMessageSendEvent_SendAcceptChannel, +typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * Used to indicate that we've initiated a channel open and should send the open_channel - * message provided to the given peer. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendOpenChannel, + LDKnativeFundingSigned *inner; /** - * Used to indicate that a funding_created message should be sent to the peer with the given node_id. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendFundingCreated, + bool is_owned; +} LDKFundingSigned; + + + +/** + * A funding_locked message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKFundingLocked { /** - * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendFundingSigned, + LDKnativeFundingLocked *inner; /** - * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendFundingLocked, - /** - * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendAnnouncementSignatures, - /** - * Used to indicate that a series of HTLC update messages, as well as a commitment_signed - * message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_UpdateHTLCs, - /** - * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendRevokeAndACK, + bool is_owned; +} LDKFundingLocked; + + + +/** + * An announcement_signatures message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** - * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendClosingSigned, + LDKnativeAnnouncementSignatures *inner; /** - * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendShutdown, + bool is_owned; +} LDKAnnouncementSignatures; + + + +/** + * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * transaction updates if they were pending. + */ +typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { /** - * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendChannelReestablish, + LDKnativeCommitmentUpdate *inner; /** - * Used to indicate that a channel_announcement and channel_update should be broadcast to all - * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). - * - * Note that after doing so, you very likely (unless you did so very recently) want to call - * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - * This ensures that any nodes which see our channel_announcement also have a relevant - * node_announcement, including relevant feature flags which may be important for routing - * through or to us. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_BroadcastChannelAnnouncement, + bool is_owned; +} LDKCommitmentUpdate; + + + +/** + * A revoke_and_ack message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** - * Used to indicate that a node_announcement should be broadcast to all peers. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_BroadcastNodeAnnouncement, + LDKnativeRevokeAndACK *inner; /** - * Used to indicate that a channel_update should be broadcast to all peers. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_BroadcastChannelUpdate, + bool is_owned; +} LDKRevokeAndACK; + + + +/** + * A closing_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * Used to indicate that a channel_update should be sent to a single peer. - * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a - * private channel and we shouldn't be informing all of our peers of channel parameters. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendChannelUpdate, + LDKnativeClosingSigned *inner; /** - * Broadcast an error downstream to be handled + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_HandleError, + bool is_owned; +} LDKClosingSigned; + + + +/** + * A shutdown message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKShutdown { /** - * Query a peer for channels with funding transaction UTXOs in a block range. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendChannelRangeQuery, + LDKnativeShutdown *inner; /** - * Request routing gossip messages from a peer for a list of channels identified by - * their short_channel_ids. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendShortIdsQuery, + bool is_owned; +} LDKShutdown; + + + +/** + * A channel_reestablish message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events - * emitted during processing of the query. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendReplyChannelRange, + LDKnativeChannelReestablish *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. */ - LDKMessageSendEvent_Sentinel, -} LDKMessageSendEvent_Tag; + bool is_owned; +} LDKChannelReestablish; -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { + + +/** + * A channel_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeChannelAnnouncement *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKAcceptChannel msg; -} LDKMessageSendEvent_LDKSendAcceptChannel_Body; + bool is_owned; +} LDKChannelAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { + + +/** + * A node_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeNodeAnnouncement *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKOpenChannel msg; -} LDKMessageSendEvent_LDKSendOpenChannel_Body; + bool is_owned; +} LDKNodeAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { + + +/** + * An error message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKErrorMessage { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeErrorMessage *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKFundingCreated msg; -} LDKMessageSendEvent_LDKSendFundingCreated_Body; + bool is_owned; +} LDKErrorMessage; -typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { +/** + * Used to put an error message in a LightningError + */ +typedef enum LDKErrorAction_Tag { /** - * The node_id of the node which should receive this message + * The peer took some action which made us think they were useless. Disconnect them. */ - struct LDKPublicKey node_id; + LDKErrorAction_DisconnectPeer, /** - * The message which should be sent. + * The peer did something harmless that we weren't able to process, just log and ignore */ - struct LDKFundingSigned msg; -} LDKMessageSendEvent_LDKSendFundingSigned_Body; - -typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { + LDKErrorAction_IgnoreError, /** - * The node_id of the node which should receive these message(s) + * The peer did something harmless that we weren't able to meaningfully process. + * If the error is logged, log it at the given level. */ - struct LDKPublicKey node_id; + LDKErrorAction_IgnoreAndLog, /** - * The funding_locked message which should be sent. + * The peer did something incorrect. Tell them. */ - struct LDKFundingLocked msg; -} LDKMessageSendEvent_LDKSendFundingLocked_Body; - -typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + LDKErrorAction_SendErrorMessage, /** - * The node_id of the node which should receive these message(s) + * Must be last for serialization purposes */ - struct LDKPublicKey node_id; + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; + +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { /** - * The announcement_signatures message which should be sent. + * An error message which we should make an effort to send before we disconnect. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKAnnouncementSignatures msg; -} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; -typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { /** - * The node_id of the node which should receive these message(s) + * The message to send. */ - struct LDKPublicKey node_id; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; + +typedef struct MUST_USE_STRUCT LDKErrorAction { + LDKErrorAction_Tag tag; + union { + LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; + struct { + enum LDKLevel ignore_and_log; + }; + LDKErrorAction_LDKSendErrorMessage_Body send_error_message; + }; +} LDKErrorAction; + + + +/** + * A query_channel_range message is used to query a peer for channel + * UTXOs in a range of blocks. The recipient of a query makes a best + * effort to reply to the query using one or more reply_channel_range + * messages. + */ +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** - * The update messages which should be sent. ALL messages in the struct should be sent! + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 LDKCommitmentUpdate updates; -} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + LDKnativeQueryChannelRange *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKQueryChannelRange; -typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { + + +/** + * A query_short_channel_ids message is used to query a peer for + * routing gossip messages related to one or more short_channel_ids. + * The query recipient will reply with the latest, if available, + * channel_announcement, channel_update and node_announcement messages + * it maintains for the requested short_channel_ids followed by a + * reply_short_channel_ids_end message. The short_channel_ids sent in + * this query are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. + */ +typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeQueryShortChannelIds *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKRevokeAndACK msg; -} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; + bool is_owned; +} LDKQueryShortChannelIds; -typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { + + +/** + * A reply_channel_range message is a reply to a query_channel_range + * message. Multiple reply_channel_range messages can be sent in reply + * to a single query_channel_range message. The query recipient makes a + * best effort to respond based on their local network view which may + * not be a perfect view of the network. The short_channel_ids in the + * reply are encoded. We only support encoding_type=0 uncompressed + * serialization and do not support encoding_type=1 zlib serialization. + */ +typedef struct MUST_USE_STRUCT LDKReplyChannelRange { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeReplyChannelRange *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKClosingSigned msg; -} LDKMessageSendEvent_LDKSendClosingSigned_Body; + bool is_owned; +} LDKReplyChannelRange; -typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { +/** + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. + */ +typedef enum LDKMessageSendEvent_Tag { /** - * The node_id of the node which should receive this message + * Used to indicate that we've accepted a channel open and should send the accept_channel + * message provided to the given peer. */ - struct LDKPublicKey node_id; + LDKMessageSendEvent_SendAcceptChannel, /** - * The message which should be sent. + * Used to indicate that we've initiated a channel open and should send the open_channel + * message provided to the given peer. */ - struct LDKShutdown msg; -} LDKMessageSendEvent_LDKSendShutdown_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { + LDKMessageSendEvent_SendOpenChannel, /** - * The node_id of the node which should receive this message + * Used to indicate that a funding_created message should be sent to the peer with the given node_id. */ - struct LDKPublicKey node_id; + LDKMessageSendEvent_SendFundingCreated, /** - * The message which should be sent. + * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ - struct LDKChannelReestablish msg; -} LDKMessageSendEvent_LDKSendChannelReestablish_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + LDKMessageSendEvent_SendFundingSigned, /** - * The channel_announcement which should be sent. + * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. */ - struct LDKChannelAnnouncement msg; + LDKMessageSendEvent_SendFundingLocked, /** - * The followup channel_update which should be sent. + * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. */ - struct LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { + LDKMessageSendEvent_SendAnnouncementSignatures, /** - * The node_announcement which should be sent. + * Used to indicate that a series of HTLC update messages, as well as a commitment_signed + * message should be sent to the peer with the given node_id. */ - struct LDKNodeAnnouncement msg; -} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { + LDKMessageSendEvent_UpdateHTLCs, /** - * The channel_update which should be sent. + * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; + LDKMessageSendEvent_SendRevokeAndACK, + /** + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendClosingSigned, + /** + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendShutdown, + /** + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendChannelReestablish, + /** + * Used to indicate that a channel_announcement and channel_update should be broadcast to all + * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * + * Note that after doing so, you very likely (unless you did so very recently) want to call + * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. + * This ensures that any nodes which see our channel_announcement also have a relevant + * node_announcement, including relevant feature flags which may be important for routing + * through or to us. + */ + LDKMessageSendEvent_BroadcastChannelAnnouncement, + /** + * Used to indicate that a node_announcement should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastNodeAnnouncement, + /** + * Used to indicate that a channel_update should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastChannelUpdate, + /** + * Used to indicate that a channel_update should be sent to a single peer. + * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a + * private channel and we shouldn't be informing all of our peers of channel parameters. + */ + LDKMessageSendEvent_SendChannelUpdate, + /** + * Broadcast an error downstream to be handled + */ + LDKMessageSendEvent_HandleError, + /** + * Query a peer for channels with funding transaction UTXOs in a block range. + */ + LDKMessageSendEvent_SendChannelRangeQuery, + /** + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. + */ + LDKMessageSendEvent_SendShortIdsQuery, + /** + * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events + * emitted during processing of the query. + */ + LDKMessageSendEvent_SendReplyChannelRange, + /** + * Must be last for serialization purposes + */ + LDKMessageSendEvent_Sentinel, +} LDKMessageSendEvent_Tag; -typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { /** * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The channel_update which should be sent. + * The message which should be sent. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKSendChannelUpdate_Body; + struct LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; -typedef struct LDKMessageSendEvent_LDKHandleError_Body { +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { /** * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The action which should be taken. + * The message which should be sent. */ - struct LDKErrorAction action; -} LDKMessageSendEvent_LDKHandleError_Body; + struct LDKOpenChannel msg; +} LDKMessageSendEvent_LDKSendOpenChannel_Body; -typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The query_channel_range which should be sent. + * The message which should be sent. */ - struct LDKQueryChannelRange msg; -} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; + struct LDKFundingCreated msg; +} LDKMessageSendEvent_LDKSendFundingCreated_Body; -typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The query_short_channel_ids which should be sent. + * The message which should be sent. */ - struct LDKQueryShortChannelIds msg; -} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; + struct LDKFundingSigned msg; +} LDKMessageSendEvent_LDKSendFundingSigned_Body; -typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive these message(s) */ struct LDKPublicKey node_id; /** - * The reply_channel_range which should be sent. + * The funding_locked message which should be sent. */ - struct LDKReplyChannelRange msg; -} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + struct LDKFundingLocked msg; +} LDKMessageSendEvent_LDKSendFundingLocked_Body; -typedef struct MUST_USE_STRUCT LDKMessageSendEvent { - LDKMessageSendEvent_Tag tag; +typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + /** + * The node_id of the node which should receive these message(s) + */ + struct LDKPublicKey node_id; + /** + * The announcement_signatures message which should be sent. + */ + struct LDKAnnouncementSignatures msg; +} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + +typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { + /** + * The node_id of the node which should receive these message(s) + */ + struct LDKPublicKey node_id; + /** + * The update messages which should be sent. ALL messages in the struct should be sent! + */ + struct LDKCommitmentUpdate updates; +} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + +typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKRevokeAndACK msg; +} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; + +typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKClosingSigned msg; +} LDKMessageSendEvent_LDKSendClosingSigned_Body; + +typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKShutdown msg; +} LDKMessageSendEvent_LDKSendShutdown_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKChannelReestablish msg; +} LDKMessageSendEvent_LDKSendChannelReestablish_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + /** + * The channel_announcement which should be sent. + */ + struct LDKChannelAnnouncement msg; + /** + * The followup channel_update which should be sent. + */ + struct LDKChannelUpdate update_msg; +} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { + /** + * The node_announcement which should be sent. + */ + struct LDKNodeAnnouncement msg; +} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { + /** + * The channel_update which should be sent. + */ + struct LDKChannelUpdate msg; +} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The channel_update which should be sent. + */ + struct LDKChannelUpdate msg; +} LDKMessageSendEvent_LDKSendChannelUpdate_Body; + +typedef struct LDKMessageSendEvent_LDKHandleError_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The action which should be taken. + */ + struct LDKErrorAction action; +} LDKMessageSendEvent_LDKHandleError_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The query_channel_range which should be sent. + */ + struct LDKQueryChannelRange msg; +} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; + +typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The query_short_channel_ids which should be sent. + */ + struct LDKQueryShortChannelIds msg; +} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; + +typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The reply_channel_range which should be sent. + */ + struct LDKReplyChannelRange msg; +} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + +typedef struct MUST_USE_STRUCT LDKMessageSendEvent { + LDKMessageSendEvent_Tag tag; union { LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel; LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; @@ -3974,905 +4540,287 @@ typedef struct LDKSign { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); - /** - * Called, if set, after this Sign has been cloned into a duplicate object. - * The new Sign is provided, and should be mutated as needed to perform a - * deep copy of the object pointed to by this_arg or avoid any double-freeing. - */ - void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKSign; - -/** - * The contents of CResult_SignDecodeErrorZ - */ -typedef union LDKCResult_SignDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKSign *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_SignDecodeErrorZPtr; - -/** - * A CResult_SignDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SignDecodeErrorZ { - /** - * The contents of this CResult_SignDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SignDecodeErrorZPtr contents; - /** - * Whether this CResult_SignDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_SignDecodeErrorZ; - -/** - * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which - * allows recovering the exact public key which created the signature given the message. - */ -typedef struct LDKRecoverableSignature { - /** - * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for - * recovery. - */ - uint8_t serialized_form[68]; -} LDKRecoverableSignature; - -/** - * The contents of CResult_RecoverableSignatureNoneZ - */ -typedef union LDKCResult_RecoverableSignatureNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRecoverableSignature *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_RecoverableSignatureNoneZPtr; - -/** - * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::RecoverableSignature on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_RecoverableSignatureNoneZ { - /** - * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RecoverableSignatureNoneZPtr contents; - /** - * Whether this CResult_RecoverableSignatureNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_RecoverableSignatureNoneZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_CVec_u8ZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCVec_u8Z *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_CVec_u8ZZ; - -/** - * The contents of CResult_CVec_CVec_u8ZZNoneZ - */ -typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_CVec_u8ZZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_CVec_CVec_u8ZZNoneZPtr; - -/** - * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { - /** - * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; - /** - * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_CVec_u8ZZNoneZ; - - - -/** - * A simple implementation of Sign that just keeps the private keys in memory. - * - * This implementation performs no policy checks and is insufficient by itself as - * a secure external signer. - */ -typedef struct MUST_USE_STRUCT LDKInMemorySigner { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInMemorySigner *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInMemorySigner; - -/** - * The contents of CResult_InMemorySignerDecodeErrorZ - */ -typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInMemorySigner *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_InMemorySignerDecodeErrorZPtr; - -/** - * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InMemorySignerDecodeErrorZ { - /** - * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InMemorySignerDecodeErrorZPtr contents; - /** - * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InMemorySignerDecodeErrorZ; - -/** - * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_TxOutZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKTxOut *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_TxOutZ; - -/** - * The contents of CResult_TransactionNoneZ - */ -typedef union LDKCResult_TransactionNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTransaction *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_TransactionNoneZPtr; - -/** - * A CResult_TransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Transaction on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_TransactionNoneZ { - /** - * The contents of this CResult_TransactionNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TransactionNoneZPtr contents; - /** - * Whether this CResult_TransactionNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_TransactionNoneZ; - - - -/** - * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates - * on-chain transactions to ensure no loss of funds occurs. - * - * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date - * information and are actively monitoring the chain. - * - * Pending Events or updated HTLCs which have not yet been read out by - * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and - * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events - * gotten are fully handled before re-serializing the new state. - * - * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the - * returned block hash and the the current chain and then reconnecting blocks to get to the - * best chain) upon deserializing the object! - */ -typedef struct MUST_USE_STRUCT LDKChannelMonitor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelMonitor *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKChannelMonitor; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { - /** - * The element at position 0 - */ - struct LDKThirtyTwoBytes a; - /** - * The element at position 1 - */ - struct LDKChannelMonitor b; -} LDKC2Tuple_BlockHashChannelMonitorZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; - -/** - * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ - */ -typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKIOError *err; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; - -/** - * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - /** - * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; - /** - * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; - -/** - * An enum which can either contain a u16 or not - */ -typedef enum LDKCOption_u16Z_Tag { - /** - * When we're in this state, this COption_u16Z contains a u16 - */ - LDKCOption_u16Z_Some, - /** - * When we're in this state, this COption_u16Z contains nothing - */ - LDKCOption_u16Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u16Z_Sentinel, -} LDKCOption_u16Z_Tag; - -typedef struct LDKCOption_u16Z { - LDKCOption_u16Z_Tag tag; - union { - struct { - uint16_t some; - }; - }; -} LDKCOption_u16Z; - -/** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) - */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_RouteError, - /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the - * attempted action to fail. - */ - LDKAPIError_MonitorUpdateFailed, - /** - * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible - * with the channel counterparty as negotiated in [`InitFeatures`]. - * - * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open - * a channel or cooperatively close one with this peer (and will have to force-close instead). - * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey - * [`InitFeatures`]: crate::ln::features::InitFeatures - */ - LDKAPIError_IncompatibleShutdownScript, - /** - * Must be last for serialization purposes - */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKAPIMisuseError_Body; - -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - /** - * A human-readable error message - */ - struct LDKStr err; - /** - * The feerate which was too high. - */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKRouteError_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; - -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { - /** - * The incompatible shutdown script. - */ - struct LDKShutdownScript script; -} LDKAPIError_LDKIncompatibleShutdownScript_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; - }; -} LDKAPIError; - -/** - * The contents of CResult_NoneAPIErrorZ - */ -typedef union LDKCResult_NoneAPIErrorZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult_NoneAPIErrorZPtr; - -/** - * A CResult_NoneAPIErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NoneAPIErrorZ { - /** - * The contents of this CResult_NoneAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NoneAPIErrorZPtr contents; - /** - * Whether this CResult_NoneAPIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_NoneAPIErrorZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_CResult_NoneAPIErrorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCResult_NoneAPIErrorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_CResult_NoneAPIErrorZZ; - -/** - * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_APIErrorZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKAPIError *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_APIErrorZ; - -/** - * The contents of CResult__u832APIErrorZ - */ -typedef union LDKCResult__u832APIErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKThirtyTwoBytes *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; - -/** - * A CResult__u832APIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult__u832APIErrorZ { - /** - * The contents of this CResult__u832APIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult__u832APIErrorZPtr contents; - /** - * Whether this CResult__u832APIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult__u832APIErrorZ; - -/** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. - */ -typedef enum LDKPaymentSendFailure_Tag { - /** - * A parameter which was passed to send_payment was invalid, preventing us from attempting to - * send the payment at all. No channel state has been changed or messages sent to peers, and - * once you've changed the parameter at error, you can freely retry the payment in full. - */ - LDKPaymentSendFailure_ParameterError, - /** - * A parameter in a single path which was passed to send_payment was invalid, preventing us - * from attempting to send the payment at all. No channel state has been changed or messages - * sent to peers, and once you've changed the parameter at error, you can freely retry the - * payment in full. - * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment. - */ - LDKPaymentSendFailure_PathParameterError, - /** - * All paths which were attempted failed to send, with no channel state change taking place. - * You can freely retry the payment in full (though you probably want to do so over different - * paths than the ones selected). - */ - LDKPaymentSendFailure_AllFailedRetrySafe, - /** - * Some paths which were attempted failed to send, though possibly not all. At least some - * paths have irrevocably committed to the HTLC and retrying the payment in full would result - * in over-/re-payment. - * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely - * retried (though there is currently no API with which to do so). - * - * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried - * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the - * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel - * with the latest update_id. - */ - LDKPaymentSendFailure_PartialFailure, - /** - * Must be last for serialization purposes - */ - LDKPaymentSendFailure_Sentinel, -} LDKPaymentSendFailure_Tag; - -typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { - /** - * The errors themselves, in the same order as the route hops. - */ - struct LDKCVec_CResult_NoneAPIErrorZZ results; - /** - * If some paths failed without irrevocably committing to the new HTLC(s), this will - * contain a [`RouteParameters`] object which can be used to calculate a new route that - * will pay all remaining unpaid balance. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKRouteParameters failed_paths_retry; - /** - * The payment id for the payment, which is now at least partially pending. - */ - struct LDKThirtyTwoBytes payment_id; -} LDKPaymentSendFailure_LDKPartialFailure_Body; - -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { - LDKPaymentSendFailure_Tag tag; - union { - struct { - struct LDKAPIError parameter_error; - }; - struct { - struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; - }; - struct { - struct LDKCVec_APIErrorZ all_failed_retry_safe; - }; - LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; - }; -} LDKPaymentSendFailure; + /** + * Called, if set, after this Sign has been cloned into a duplicate object. + * The new Sign is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKSign; /** - * The contents of CResult_PaymentIdPaymentSendFailureZ + * The contents of CResult_SignDecodeErrorZ */ -typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { +typedef union LDKCResult_SignDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKSign *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentIdPaymentSendFailureZPtr; + struct LDKDecodeError *err; +} LDKCResult_SignDecodeErrorZPtr; /** - * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_SignDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentIdPaymentSendFailureZ { +typedef struct LDKCResult_SignDecodeErrorZ { /** - * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * The contents of this CResult_SignDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; + union LDKCResult_SignDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. + * Whether this CResult_SignDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentSendFailureZ; +} LDKCResult_SignDecodeErrorZ; /** - * The contents of CResult_NonePaymentSendFailureZ + * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which + * allows recovering the exact public key which created the signature given the message. */ -typedef union LDKCResult_NonePaymentSendFailureZPtr { +typedef struct LDKRecoverableSignature { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for + * recovery. */ - void *result; + uint8_t serialized_form[68]; +} LDKRecoverableSignature; + +/** + * The contents of CResult_RecoverableSignatureNoneZ + */ +typedef union LDKCResult_RecoverableSignatureNoneZPtr { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPaymentSendFailure *err; -} LDKCResult_NonePaymentSendFailureZPtr; + struct LDKRecoverableSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_RecoverableSignatureNoneZPtr; /** - * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::RecoverableSignature on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NonePaymentSendFailureZ { +typedef struct LDKCResult_RecoverableSignatureNoneZ { /** - * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentSendFailureZPtr contents; + union LDKCResult_RecoverableSignatureNoneZPtr contents; /** - * Whether this CResult_NonePaymentSendFailureZ represents a success state. + * Whether this CResult_RecoverableSignatureNoneZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_RecoverableSignatureNoneZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { +typedef struct LDKCVec_CVec_u8ZZ { /** - * The element at position 0 + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes a; + struct LDKCVec_u8Z *data; /** - * The element at position 1 + * The number of elements pointed to by `data`. */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentIdZ; + uintptr_t datalen; +} LDKCVec_CVec_u8ZZ; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ + * The contents of CResult_CVec_CVec_u8ZZNoneZ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PaymentHashPaymentIdZ *result; + struct LDKCVec_CVec_u8ZZ *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 LDKPaymentSendFailure *err; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; + void *err; +} LDKCResult_CVec_CVec_u8ZZNoneZPtr; /** - * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either + * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; + union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. + * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +} LDKCResult_CVec_CVec_u8ZZNoneZ; + -/** - * A 4-byte byte array. - */ -typedef struct LDKFourBytes { - /** - * The four bytes - */ - uint8_t data[4]; -} LDKFourBytes; /** - * A 16-byte byte array. + * A simple implementation of Sign that just keeps the private keys in memory. + * + * This implementation performs no policy checks and is insufficient by itself as + * a secure external signer. */ -typedef struct LDKSixteenBytes { +typedef struct MUST_USE_STRUCT LDKInMemorySigner { /** - * The sixteen bytes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - uint8_t data[16]; -} LDKSixteenBytes; - -/** - * A 10-byte byte array. - */ -typedef struct LDKTenBytes { + LDKnativeInMemorySigner *inner; /** - * The ten bytes + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uint8_t data[10]; -} LDKTenBytes; + bool is_owned; +} LDKInMemorySigner; /** - * An address which can be used to connect to a remote peer + * The contents of CResult_InMemorySignerDecodeErrorZ */ -typedef enum LDKNetAddress_Tag { - /** - * An IPv4 address/port on which the peer is listening. - */ - LDKNetAddress_IPv4, - /** - * An IPv6 address/port on which the peer is listening. - */ - LDKNetAddress_IPv6, - /** - * An old-style Tor onion address/port on which the peer is listening. - */ - LDKNetAddress_OnionV2, +typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { /** - * A new-style Tor onion address/port on which the peer is listening. - * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, - * wrap as base32 and append \".onion\". + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKNetAddress_OnionV3, + struct LDKInMemorySigner *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; + struct LDKDecodeError *err; +} LDKCResult_InMemorySignerDecodeErrorZPtr; -typedef struct LDKNetAddress_LDKIPv4_Body { +/** + * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InMemorySignerDecodeErrorZ { /** - * The 4-byte IPv4 address + * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKFourBytes addr; + union LDKCResult_InMemorySignerDecodeErrorZPtr contents; /** - * The port on which the node is listening + * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. */ - uint16_t port; -} LDKNetAddress_LDKIPv4_Body; + bool result_ok; +} LDKCResult_InMemorySignerDecodeErrorZ; -typedef struct LDKNetAddress_LDKIPv6_Body { +/** + * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_TxOutZ { /** - * The 16-byte IPv6 address + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKSixteenBytes addr; + struct LDKTxOut *data; /** - * The port on which the node is listening + * The number of elements pointed to by `data`. */ - uint16_t port; -} LDKNetAddress_LDKIPv6_Body; + uintptr_t datalen; +} LDKCVec_TxOutZ; -typedef struct LDKNetAddress_LDKOnionV2_Body { +/** + * The contents of CResult_TransactionNoneZ + */ +typedef union LDKCResult_TransactionNoneZPtr { /** - * The bytes (usually encoded in base32 with \".onion\" appended) + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTenBytes addr; + struct LDKTransaction *result; /** - * The port on which the node is listening + * Note that this value is always NULL, as there are no contents in the Err variant */ - uint16_t port; -} LDKNetAddress_LDKOnionV2_Body; + void *err; +} LDKCResult_TransactionNoneZPtr; -typedef struct LDKNetAddress_LDKOnionV3_Body { - /** - * The ed25519 long-term public key of the peer - */ - struct LDKThirtyTwoBytes ed25519_pubkey; - /** - * The checksum of the pubkey and version, as included in the onion address - */ - uint16_t checksum; +/** + * A CResult_TransactionNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Transaction on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_TransactionNoneZ { /** - * The version byte, as defined by the Tor Onion v3 spec. + * The contents of this CResult_TransactionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint8_t version; + union LDKCResult_TransactionNoneZPtr contents; /** - * The port on which the node is listening + * Whether this CResult_TransactionNoneZ represents a success state. */ - uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; + bool result_ok; +} LDKCResult_TransactionNoneZ; + -typedef struct MUST_USE_STRUCT LDKNetAddress { - LDKNetAddress_Tag tag; - union { - LDKNetAddress_LDKIPv4_Body i_pv4; - LDKNetAddress_LDKIPv6_Body i_pv6; - LDKNetAddress_LDKOnionV2_Body onion_v2; - LDKNetAddress_LDKOnionV3_Body onion_v3; - }; -} LDKNetAddress; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. - * This corresponds to std::vector in C++ + * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates + * on-chain transactions to ensure no loss of funds occurs. + * + * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date + * information and are actively monitoring the chain. + * + * Pending Events or updated HTLCs which have not yet been read out by + * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and + * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events + * gotten are fully handled before re-serializing the new state. + * + * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the + * returned block hash and the the current chain and then reconnecting blocks to get to the + * best chain) upon deserializing the object! */ -typedef struct LDKCVec_NetAddressZ { +typedef struct MUST_USE_STRUCT LDKChannelMonitor { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKNetAddress *data; + LDKnativeChannelMonitor *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_NetAddressZ; + bool is_owned; +} LDKChannelMonitor; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { +typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { /** * The element at position 0 */ @@ -4880,361 +4828,434 @@ typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { /** * The element at position 1 */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentSecretZ; + struct LDKChannelMonitor b; +} LDKC2Tuple_BlockHashChannelMonitorZ; /** - * The contents of CResult_PaymentSecretAPIErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_PaymentSecretAPIErrorZPtr { +typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_BlockHashChannelMonitorZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; + +/** + * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ + */ +typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKAPIError *err; -} LDKCResult_PaymentSecretAPIErrorZPtr; + enum LDKIOError *err; +} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; /** - * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentSecretAPIErrorZ { +typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { /** - * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either + * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentSecretAPIErrorZPtr contents; + union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; /** - * Whether this CResult_PaymentSecretAPIErrorZ represents a success state. + * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentSecretAPIErrorZ; +} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a u16 or not */ -typedef struct LDKCVec_ChannelMonitorZ { +typedef enum LDKCOption_u16Z_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * When we're in this state, this COption_u16Z contains a u16 */ - struct LDKChannelMonitor *data; + LDKCOption_u16Z_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_u16Z contains nothing */ - uintptr_t datalen; -} LDKCVec_ChannelMonitorZ; - + LDKCOption_u16Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u16Z_Sentinel, +} LDKCOption_u16Z_Tag; +typedef struct LDKCOption_u16Z { + LDKCOption_u16Z_Tag tag; + union { + struct { + uint16_t some; + }; + }; +} LDKCOption_u16Z; /** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef enum LDKAPIError_Tag { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. */ - LDKnativeChannelMonitorUpdate *inner; + LDKAPIError_APIMisuseError, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. */ - bool is_owned; -} LDKChannelMonitorUpdate; + LDKAPIError_FeeRateTooHigh, + /** + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). + */ + LDKAPIError_RouteError, + /** + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the + * attempted action to fail. + */ + LDKAPIError_MonitorUpdateFailed, + /** + * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * with the channel counterparty as negotiated in [`InitFeatures`]. + * + * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open + * a channel or cooperatively close one with this peer (and will have to force-close instead). + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`InitFeatures`]: crate::ln::features::InitFeatures + */ + LDKAPIError_IncompatibleShutdownScript, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + /** + * A human-readable error message + */ + struct LDKStr err; + /** + * The feerate which was too high. + */ + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKRouteError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKRouteError_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + /** + * The incompatible shutdown script. + */ + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKRouteError_Body route_error; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + }; +} LDKAPIError; /** - * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as - * blocks are connected and disconnected. - * - * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. - * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle - * multiple instances. - * - * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure + * The contents of CResult_NoneAPIErrorZ */ -typedef struct LDKWatch { +typedef union LDKCResult_NoneAPIErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *this_arg; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; + +/** + * A CResult_NoneAPIErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneAPIErrorZ { /** - * Watches a channel identified by `funding_txo` using `monitor`. - * - * Implementations are responsible for watching the chain for the funding transaction along - * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. - * - * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if - * the given `funding_txo` has previously been registered via `watch_channel`. - * - * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch - * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected - * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected + * The contents of this CResult_NoneAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + union LDKCResult_NoneAPIErrorZPtr contents; /** - * Updates a channel identified by `funding_txo` by applying `update` to its monitor. - * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateErr`] for invariants around returning an error. - * - * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * Whether this CResult_NoneAPIErrorZ represents a success state. */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); + bool result_ok; +} LDKCResult_NoneAPIErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { /** - * Returns any monitor events since the last call. Subsequent calls must only return new - * events. - * - * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no - * further events may be returned here until the [`ChannelMonitor`] has been fully persisted - * to disk. - * - * For details on asynchronous [`ChannelMonitor`] updating and returning - * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + struct LDKCResult_NoneAPIErrorZ *data; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * The number of elements pointed to by `data`. */ - void (*free)(void *this_arg); -} LDKWatch; + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; /** - * An interface to send a transaction to the Bitcoin network. + * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKBroadcasterInterface { +typedef struct LDKCVec_APIErrorZ { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void *this_arg; + struct LDKAPIError *data; /** - * Sends a transaction out to (hopefully) be mined. + * The number of elements pointed to by `data`. */ - void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); + uintptr_t datalen; +} LDKCVec_APIErrorZ; + +/** + * The contents of CResult__u832APIErrorZ + */ +typedef union LDKCResult__u832APIErrorZPtr { /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*free)(void *this_arg); -} LDKBroadcasterInterface; + struct LDKThirtyTwoBytes *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKAPIError *err; +} LDKCResult__u832APIErrorZPtr; /** - * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not - * own the memory pointed to by data. + * A CResult__u832APIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKu8slice { +typedef struct LDKCResult__u832APIErrorZ { /** - * A pointer to the byte buffer + * The contents of this CResult__u832APIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - const uint8_t *data; + union LDKCResult__u832APIErrorZPtr contents; /** - * The number of bytes pointed to by `data`. + * Whether this CResult__u832APIErrorZ represents a success state. */ - uintptr_t datalen; -} LDKu8slice; + bool result_ok; +} LDKCResult__u832APIErrorZ; /** - * A trait to describe an object which can get user secrets and key material. + * If a payment fails to send, it can be in one of several states. This enum is returned as the + * Err() type describing which state the payment is in, see the description of individual enum + * states for more. */ -typedef struct LDKKeysInterface { +typedef enum LDKPaymentSendFailure_Tag { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A parameter which was passed to send_payment was invalid, preventing us from attempting to + * send the payment at all. No channel state has been changed or messages sent to peers, and + * once you've changed the parameter at error, you can freely retry the payment in full. */ - void *this_arg; + LDKPaymentSendFailure_ParameterError, /** - * Get node secret key (aka node_id or network_key). + * A parameter in a single path which was passed to send_payment was invalid, preventing us + * from attempting to send the payment at all. No channel state has been changed or messages + * sent to peers, and once you've changed the parameter at error, you can freely retry the + * payment in full. * - * This method must return the same value each time it is called. + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment. */ - struct LDKSecretKey (*get_node_secret)(const void *this_arg); + LDKPaymentSendFailure_PathParameterError, /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * All paths which were attempted failed to send, with no channel state change taking place. + * You can freely retry the payment in full (though you probably want to do so over different + * paths than the ones selected). */ - struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + LDKPaymentSendFailure_AllFailedRetrySafe, /** - * Get a script pubkey which we will send funds to when closing a channel. + * Some paths which were attempted failed to send, though possibly not all. At least some + * paths have irrevocably committed to the HTLC and retrying the payment in full would result + * in over-/re-payment. * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. - */ - struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); - /** - * Get a new set of Sign for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely + * retried (though there is currently no API with which to do so). * - * This method must return a different value each time it is called. + * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried + * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the + * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel + * with the latest update_id. */ - struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + LDKPaymentSendFailure_PartialFailure, /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - * - * This method must return a different value each time it is called. + * Must be last for serialization purposes */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); + LDKPaymentSendFailure_Sentinel, +} LDKPaymentSendFailure_Tag; + +typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { /** - * Reads a `Signer` for this `KeysInterface` from the given input stream. - * This is only called during deserialization of other objects which contain - * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. + * The errors themselves, in the same order as the route hops. */ - struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + struct LDKCVec_CResult_NoneAPIErrorZZ results; /** - * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's - * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of - * this trait to parse the invoice and make sure they're signing what they expect, rather than - * blindly signing the hash. + * If some paths failed without irrevocably committing to the new HTLC(s), this will + * contain a [`RouteParameters`] object which can be used to calculate a new route that + * will pay all remaining unpaid balance. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage); + struct LDKRouteParameters failed_paths_retry; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * The payment id for the payment, which is now at least partially pending. */ - void (*free)(void *this_arg); -} LDKKeysInterface; + struct LDKThirtyTwoBytes payment_id; +} LDKPaymentSendFailure_LDKPartialFailure_Body; + +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { + LDKPaymentSendFailure_Tag tag; + union { + struct { + struct LDKAPIError parameter_error; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; + }; + struct { + struct LDKCVec_APIErrorZ all_failed_retry_safe; + }; + LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; + }; +} LDKPaymentSendFailure; /** - * A trait which should be implemented to provide feerate information on a number of time - * horizons. - * - * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're - * called from inside the library in response to chain events, P2P events, or timer events). + * The contents of CResult_PaymentIdPaymentSendFailureZ */ -typedef struct LDKFeeEstimator { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { /** - * Gets estimated satoshis of fee required per 1000 Weight-Units. - * - * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - * don't put us below 1 satoshi-per-byte). - * - * This translates to: - * * satoshis-per-byte * 250 - * * ceil(satoshis-per-kbyte / 4) + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + struct LDKThirtyTwoBytes *result; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*free)(void *this_arg); -} LDKFeeEstimator; + struct LDKPaymentSendFailure *err; +} LDKCResult_PaymentIdPaymentSendFailureZPtr; /** - * A trait encapsulating the operations required of a logger + * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKLogger { +typedef struct LDKCResult_PaymentIdPaymentSendFailureZ { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void *this_arg; + union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; /** - * Logs the `Record` + * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. */ - void (*log)(const void *this_arg, const char *record); + bool result_ok; +} LDKCResult_PaymentIdPaymentSendFailureZ; + +/** + * The contents of CResult_NonePaymentSendFailureZ + */ +typedef union LDKCResult_NonePaymentSendFailureZPtr { /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * Note that this value is always NULL, as there are no contents in the OK variant */ - void (*free)(void *this_arg); -} LDKLogger; - - + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKPaymentSendFailure *err; +} LDKCResult_NonePaymentSendFailureZPtr; /** - * Manager which keeps track of a number of channels and sends messages to the appropriate - * channel, also tracking HTLC preimages and forwarding onion packets appropriately. - * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through - * to individual Channels. - * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for - * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). - * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). - * - * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! - * - * Note that ChannelManager is responsible for tracking liveness of its channels and generating - * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid - * spam due to quick disconnection/reconnection, updates are not sent until the channel has been - * offline for a full minute. In order to track this, you must call - * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. - * - * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager - * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefChannelManager, and use a - * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when - * you're using lightning-net-tokio. + * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKChannelManager { +typedef struct LDKCResult_NonePaymentSendFailureZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeChannelManager *inner; + union LDKCResult_NonePaymentSendFailureZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_NonePaymentSendFailureZ represents a success state. */ - bool is_owned; -} LDKChannelManager; + bool result_ok; +} LDKCResult_NonePaymentSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BlockHashChannelManagerZ { +typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { /** * The element at position 0 */ @@ -5242,1534 +5263,1714 @@ typedef struct LDKC2Tuple_BlockHashChannelManagerZ { /** * The element at position 1 */ - struct LDKChannelManager b; -} LDKC2Tuple_BlockHashChannelManagerZ; + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_PaymentHashPaymentIdZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ + * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelManagerZ *result; + struct LDKC2Tuple_PaymentHashPaymentIdZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; + struct LDKPaymentSendFailure *err; +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; /** - * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; + +/** + * A 4-byte byte array. + */ +typedef struct LDKFourBytes { + /** + * The four bytes + */ + uint8_t data[4]; +} LDKFourBytes; + +/** + * A 16-byte byte array. + */ +typedef struct LDKSixteenBytes { + /** + * The sixteen bytes + */ + uint8_t data[16]; +} LDKSixteenBytes; + +/** + * A 10-byte byte array. + */ +typedef struct LDKTenBytes { + /** + * The ten bytes + */ + uint8_t data[10]; +} LDKTenBytes; + +/** + * An address which can be used to connect to a remote peer + */ +typedef enum LDKNetAddress_Tag { + /** + * An IPv4 address/port on which the peer is listening. + */ + LDKNetAddress_IPv4, + /** + * An IPv6 address/port on which the peer is listening. + */ + LDKNetAddress_IPv6, + /** + * An old-style Tor onion address/port on which the peer is listening. + */ + LDKNetAddress_OnionV2, + /** + * A new-style Tor onion address/port on which the peer is listening. + * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, + * wrap as base32 and append \".onion\". + */ + LDKNetAddress_OnionV3, + /** + * Must be last for serialization purposes + */ + LDKNetAddress_Sentinel, +} LDKNetAddress_Tag; + +typedef struct LDKNetAddress_LDKIPv4_Body { + /** + * The 4-byte IPv4 address + */ + struct LDKFourBytes addr; + /** + * The port on which the node is listening + */ + uint16_t port; +} LDKNetAddress_LDKIPv4_Body; + +typedef struct LDKNetAddress_LDKIPv6_Body { + /** + * The 16-byte IPv6 address + */ + struct LDKSixteenBytes addr; + /** + * The port on which the node is listening + */ + uint16_t port; +} LDKNetAddress_LDKIPv6_Body; + +typedef struct LDKNetAddress_LDKOnionV2_Body { + /** + * The bytes (usually encoded in base32 with \".onion\" appended) + */ + struct LDKTenBytes addr; + /** + * The port on which the node is listening + */ + uint16_t port; +} LDKNetAddress_LDKOnionV2_Body; + +typedef struct LDKNetAddress_LDKOnionV3_Body { + /** + * The ed25519 long-term public key of the peer + */ + struct LDKThirtyTwoBytes ed25519_pubkey; + /** + * The checksum of the pubkey and version, as included in the onion address + */ + uint16_t checksum; + /** + * The version byte, as defined by the Tor Onion v3 spec. + */ + uint8_t version; + /** + * The port on which the node is listening + */ + uint16_t port; +} LDKNetAddress_LDKOnionV3_Body; +typedef struct MUST_USE_STRUCT LDKNetAddress { + LDKNetAddress_Tag tag; + union { + LDKNetAddress_LDKIPv4_Body i_pv4; + LDKNetAddress_LDKIPv6_Body i_pv6; + LDKNetAddress_LDKOnionV2_Body onion_v2; + LDKNetAddress_LDKOnionV3_Body onion_v3; + }; +} LDKNetAddress; +/** + * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_NetAddressZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKNetAddress *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_NetAddressZ; /** - * Options which apply on a per-channel basis and may change at runtime or based on negotiation - * with our counterparty. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKChannelConfig { +typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativeChannelConfig *inner; + struct LDKThirtyTwoBytes a; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The element at position 1 */ - bool is_owned; -} LDKChannelConfig; + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_PaymentHashPaymentSecretZ; /** - * The contents of CResult_ChannelConfigDecodeErrorZ + * The contents of CResult_PaymentSecretAPIErrorZ */ -typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { +typedef union LDKCResult_PaymentSecretAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelConfig *result; + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelConfigDecodeErrorZPtr; + struct LDKAPIError *err; +} LDKCResult_PaymentSecretAPIErrorZPtr; /** - * 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_PaymentSecretAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelConfigDecodeErrorZ { +typedef struct LDKCResult_PaymentSecretAPIErrorZ { /** - * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either + * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelConfigDecodeErrorZPtr contents; + union LDKCResult_PaymentSecretAPIErrorZPtr contents; /** - * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. + * Whether this CResult_PaymentSecretAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelConfigDecodeErrorZ; +} LDKCResult_PaymentSecretAPIErrorZ; /** - * The contents of CResult_OutPointDecodeErrorZ + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_OutPointDecodeErrorZPtr { +typedef struct LDKCVec_ChannelMonitorZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKOutPoint *result; + struct LDKChannelMonitor *data; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The number of elements pointed to by `data`. */ - struct LDKDecodeError *err; -} LDKCResult_OutPointDecodeErrorZPtr; + uintptr_t datalen; +} LDKCVec_ChannelMonitorZ; + + /** - * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An update generated by the underlying Channel itself which contains some new information the + * ChannelMonitor should be made aware of. */ -typedef struct LDKCResult_OutPointDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { /** - * The contents of this CResult_OutPointDecodeErrorZ, 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_OutPointDecodeErrorZPtr contents; + LDKnativeChannelMonitorUpdate *inner; /** - * Whether this CResult_OutPointDecodeErrorZ 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_OutPointDecodeErrorZ; + bool is_owned; +} LDKChannelMonitorUpdate; /** - * Defines a type identifier for sending messages over the wire. + * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as + * blocks are connected and disconnected. * - * Messages implementing this trait specify a type and must be [`Writeable`]. + * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are + * responsible for maintaining a set of monitors such that they can be updated accordingly as + * channel state changes and HTLCs are resolved. See method documentation for specific + * requirements. + * + * Implementations **must** ensure that updates are successfully applied and persisted upon method + * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down + * without taking any further action such as persisting the current state. + * + * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing + * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it + * could result in a revoked transaction being broadcast, allowing the counterparty to claim all + * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle + * multiple instances. + * + * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure */ -typedef struct LDKType { +typedef struct LDKWatch { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Returns the type identifying the message payload. + * Watches a channel identified by `funding_txo` using `monitor`. + * + * Implementations are responsible for watching the chain for the funding transaction along + * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means + * calling [`block_connected`] and [`block_disconnected`] on the monitor. + * + * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if + * the given `funding_txo` has previously been registered via `watch_channel`. + * + * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch + * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected + * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ - uint16_t (*type_id)(const void *this_arg); + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); /** - * Return a human-readable "debug" string describing this object + * Updates a channel identified by `funding_txo` by applying `update` to its monitor. + * + * Implementations must call [`update_monitor`] with the given update. See + * [`ChannelMonitorUpdateErr`] for invariants around returning an error. + * + * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor */ - struct LDKStr (*debug_str)(const void *this_arg); + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); /** - * Serialize the object into a byte array + * Returns any monitor events since the last call. Subsequent calls must only return new + * events. + * + * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no + * further events may be returned here until the [`ChannelMonitor`] has been fully persisted + * to disk. + * + * For details on asynchronous [`ChannelMonitor`] updating and returning + * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKType; +} LDKWatch; /** - * An enum which can either contain a crate::lightning::ln::wire::Type or not + * An interface to send a transaction to the Bitcoin network. */ -typedef enum LDKCOption_TypeZ_Tag { - /** - * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type - */ - LDKCOption_TypeZ_Some, - /** - * When we're in this state, this COption_TypeZ contains nothing - */ - LDKCOption_TypeZ_None, +typedef struct LDKBroadcasterInterface { /** - * Must be last for serialization purposes + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKCOption_TypeZ_Sentinel, -} LDKCOption_TypeZ_Tag; - -typedef struct LDKCOption_TypeZ { - LDKCOption_TypeZ_Tag tag; - union { - struct { - struct LDKType some; - }; - }; -} LDKCOption_TypeZ; - -/** - * The contents of CResult_COption_TypeZDecodeErrorZ - */ -typedef union LDKCResult_COption_TypeZDecodeErrorZPtr { + void *this_arg; /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Sends a transaction out to (hopefully) be mined. */ - struct LDKCOption_TypeZ *result; + void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ - struct LDKDecodeError *err; -} LDKCResult_COption_TypeZDecodeErrorZPtr; + void (*free)(void *this_arg); +} LDKBroadcasterInterface; /** - * 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`. + * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not + * own the memory pointed to by data. */ -typedef struct LDKCResult_COption_TypeZDecodeErrorZ { +typedef struct LDKu8slice { /** - * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the byte buffer */ - union LDKCResult_COption_TypeZDecodeErrorZPtr contents; + const uint8_t *data; /** - * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + * The number of bytes pointed to by `data`. */ - bool result_ok; -} LDKCResult_COption_TypeZDecodeErrorZ; + uintptr_t datalen; +} LDKu8slice; /** - * An error that may occur when making a payment. + * A trait to describe an object which can get user secrets and key material. */ -typedef enum LDKPaymentError_Tag { - /** - * An error resulting from the provided [`Invoice`] or payment hash. - */ - LDKPaymentError_Invoice, - /** - * An error occurring when finding a route. - */ - LDKPaymentError_Routing, +typedef struct LDKKeysInterface { /** - * An error occurring when sending a payment. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKPaymentError_Sending, + void *this_arg; /** - * Must be last for serialization purposes + * Get node secret key (aka node_id or network_key). + * + * This method must return the same value each time it is called. */ - LDKPaymentError_Sentinel, -} LDKPaymentError_Tag; - -typedef struct MUST_USE_STRUCT LDKPaymentError { - LDKPaymentError_Tag tag; - union { - struct { - struct LDKStr invoice; - }; - struct { - struct LDKLightningError routing; - }; - struct { - struct LDKPaymentSendFailure sending; - }; - }; -} LDKPaymentError; - -/** - * The contents of CResult_PaymentIdPaymentErrorZ - */ -typedef union LDKCResult_PaymentIdPaymentErrorZPtr { + struct LDKSecretKey (*get_node_secret)(const void *this_arg); /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. */ - struct LDKThirtyTwoBytes *result; + struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Get a script pubkey which we will send funds to when closing a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. */ - struct LDKPaymentError *err; -} LDKCResult_PaymentIdPaymentErrorZPtr; - -/** - * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PaymentIdPaymentErrorZ { + struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); /** - * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Get a new set of Sign for per-channel secrets. These MUST be unique even if you + * restarted with some stale data! + * + * This method must return a different value each time it is called. */ - union LDKCResult_PaymentIdPaymentErrorZPtr contents; + struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); /** - * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting + * onion packets and for temporary channel IDs. There is no requirement that these be + * persisted anywhere, though they must be unique across restarts. + * + * This method must return a different value each time it is called. */ - bool result_ok; -} LDKCResult_PaymentIdPaymentErrorZ; - -/** - * The contents of CResult_SiPrefixNoneZ - */ -typedef union LDKCResult_SiPrefixNoneZPtr { + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Reads a `Signer` for this `KeysInterface` from the given input stream. + * This is only called during deserialization of other objects which contain + * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. */ - enum LDKSiPrefix *result; + struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's + * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of + * this trait to parse the invoice and make sure they're signing what they expect, rather than + * blindly signing the hash. */ - void *err; -} LDKCResult_SiPrefixNoneZPtr; + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKKeysInterface; /** - * A CResult_SiPrefixNoneZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SiPrefix on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A trait which should be implemented to provide feerate information on a number of time + * horizons. + * + * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're + * called from inside the library in response to chain events, P2P events, or timer events). */ -typedef struct LDKCResult_SiPrefixNoneZ { +typedef struct LDKFeeEstimator { /** - * The contents of this CResult_SiPrefixNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - union LDKCResult_SiPrefixNoneZPtr contents; + void *this_arg; /** - * Whether this CResult_SiPrefixNoneZ represents a success state. + * Gets estimated satoshis of fee required per 1000 Weight-Units. + * + * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs + * don't put us below 1 satoshi-per-byte). + * + * This translates to: + * * satoshis-per-byte * 250 + * * ceil(satoshis-per-kbyte / 4) */ - bool result_ok; -} LDKCResult_SiPrefixNoneZ; + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKFeeEstimator; /** - * Represents a syntactically and semantically correct lightning BOLT11 invoice. - * - * There are three ways to construct an `Invoice`: - * 1. using `InvoiceBuilder` - * 2. using `Invoice::from_signed(SignedRawInvoice)` - * 3. using `str::parse::(&str)` + * A Record, unit of logging output with Metadata to enable filtering + * Module_path, file, line to inform on log's source */ -typedef struct MUST_USE_STRUCT LDKInvoice { +typedef struct MUST_USE_STRUCT LDKRecord { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoice *inner; + LDKnativeRecord *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvoice; +} LDKRecord; /** - * The contents of CResult_InvoiceNoneZ + * A trait encapsulating the operations required of a logger */ -typedef union LDKCResult_InvoiceNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoice *result; +typedef struct LDKLogger { /** - * Note that this value is always NULL, as there are no contents in the Err variant + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - void *err; -} LDKCResult_InvoiceNoneZPtr; - -/** - * A CResult_InvoiceNoneZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceNoneZ { + void *this_arg; /** - * The contents of this CResult_InvoiceNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Logs the `Record` */ - union LDKCResult_InvoiceNoneZPtr contents; + void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); /** - * Whether this CResult_InvoiceNoneZ represents a success state. + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ - bool result_ok; -} LDKCResult_InvoiceNoneZ; + void (*free)(void *this_arg); +} LDKLogger; /** - * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be - * invalid. + * Manager which keeps track of a number of channels and sends messages to the appropriate + * channel, also tracking HTLC preimages and forwarding onion packets appropriately. * - * # Invariants - * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. + * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * to individual Channels. + * + * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * all peers during write/read (though does not modify this instance, only the instance being + * serialized). This will result in any channels which have not yet exchanged funding_created (ie + * called funding_transaction_generated for outbound channels). + * + * Note that you can be a bit lazier about writing out ChannelManager than you can be with + * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before + * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * the serialization process). If the deserialized version is out-of-date compared to the + * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the + * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * + * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call + * block_connected() to step towards your best block) upon deserialization before using the + * object! + * + * Note that ChannelManager is responsible for tracking liveness of its channels and generating + * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid + * spam due to quick disconnection/reconnection, updates are not sent until the channel has been + * offline for a full minute. In order to track this, you must call + * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. + * + * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager + * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but + * essentially you should default to using a SimpleRefChannelManager, and use a + * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when + * you're using lightning-net-tokio. */ -typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { +typedef struct MUST_USE_STRUCT LDKChannelManager { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeSignedRawInvoice *inner; + LDKnativeChannelManager *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKSignedRawInvoice; +} LDKChannelManager; /** - * The contents of CResult_SignedRawInvoiceNoneZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_SignedRawInvoiceNoneZPtr { +typedef struct LDKC2Tuple_BlockHashChannelManagerZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The element at position 0 */ - struct LDKSignedRawInvoice *result; + struct LDKThirtyTwoBytes a; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * The element at position 1 */ - void *err; -} LDKCResult_SignedRawInvoiceNoneZPtr; + struct LDKChannelManager b; +} LDKC2Tuple_BlockHashChannelManagerZ; /** - * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ */ -typedef struct LDKCResult_SignedRawInvoiceNoneZ { +typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { /** - * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - union LDKCResult_SignedRawInvoiceNoneZPtr contents; + struct LDKC2Tuple_BlockHashChannelManagerZ *result; /** - * Whether this CResult_SignedRawInvoiceNoneZ represents a success state. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool result_ok; -} LDKCResult_SignedRawInvoiceNoneZ; - - + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; /** - * Represents an syntactically correct Invoice for a payment on the lightning network, - * but without the signature information. - * De- and encoding should not lead to information loss but may lead to different hashes. - * - * For methods without docs see the corresponding methods in `Invoice`. + * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKRawInvoice { +typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeRawInvoice *inner; + union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKRawInvoice; + bool result_ok; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; /** - * Recoverable signature + * Options which apply on a per-channel basis and may change at runtime or based on negotiation + * with our counterparty. */ -typedef struct MUST_USE_STRUCT LDKInvoiceSignature { +typedef struct MUST_USE_STRUCT LDKChannelConfig { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoiceSignature *inner; + LDKnativeChannelConfig *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvoiceSignature; +} LDKChannelConfig; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * The contents of CResult_ChannelConfigDecodeErrorZ */ -typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { - /** - * The element at position 0 - */ - struct LDKRawInvoice a; +typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { /** - * The element at position 1 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes b; + struct LDKChannelConfig *result; /** - * The element at position 2 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKInvoiceSignature c; -} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; - - + struct LDKDecodeError *err; +} LDKCResult_ChannelConfigDecodeErrorZPtr; /** - * Payee public key + * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKPayeePubKey { +typedef struct LDKCResult_ChannelConfigDecodeErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativePayeePubKey *inner; + union LDKCResult_ChannelConfigDecodeErrorZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKPayeePubKey; + bool result_ok; +} LDKCResult_ChannelConfigDecodeErrorZ; /** - * The contents of CResult_PayeePubKeyErrorZ + * The contents of CResult_OutPointDecodeErrorZ */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { +typedef union LDKCResult_OutPointDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPayeePubKey *result; + struct LDKOutPoint *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKSecp256k1Error *err; -} LDKCResult_PayeePubKeyErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_OutPointDecodeErrorZPtr; /** - * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. + * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PayeePubKeyErrorZ { +typedef struct LDKCResult_OutPointDecodeErrorZ { /** - * The contents of this CResult_PayeePubKeyErrorZ, accessible via either + * The contents of this CResult_OutPointDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PayeePubKeyErrorZPtr contents; + union LDKCResult_OutPointDecodeErrorZPtr contents; /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * Whether this CResult_OutPointDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; - - +} LDKCResult_OutPointDecodeErrorZ; /** - * Private routing information - * - * # Invariants - * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * Defines a type identifier for sending messages over the wire. * + * Messages implementing this trait specify a type and must be [`Writeable`]. */ -typedef struct MUST_USE_STRUCT LDKPrivateRoute { +typedef struct LDKType { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativePrivateRoute *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Returns the type identifying the message payload. */ - bool is_owned; -} LDKPrivateRoute; - -/** - * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PrivateRouteZ { + uint16_t (*type_id)(const void *this_arg); /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Return a human-readable "debug" string describing this object */ - struct LDKPrivateRoute *data; + struct LDKStr (*debug_str)(const void *this_arg); /** - * The number of elements pointed to by `data`. + * Serialize the object into a byte array */ - uintptr_t datalen; -} LDKCVec_PrivateRouteZ; - - + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKType; /** - * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX - * timestamp is positive. - * - * # Invariants - * The UNIX timestamp representing the stored time has to be positive and small enough so that - * a `EpiryTime` can be added to it without an overflow. + * An enum which can either contain a crate::lightning::ln::wire::Type or not */ -typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { +typedef enum LDKCOption_TypeZ_Tag { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type */ - LDKnativePositiveTimestamp *inner; + LDKCOption_TypeZ_Some, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * When we're in this state, this COption_TypeZ contains nothing */ - bool is_owned; -} LDKPositiveTimestamp; + LDKCOption_TypeZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_TypeZ_Sentinel, +} LDKCOption_TypeZ_Tag; + +typedef struct LDKCOption_TypeZ { + LDKCOption_TypeZ_Tag tag; + union { + struct { + struct LDKType some; + }; + }; +} LDKCOption_TypeZ; /** - * The contents of CResult_PositiveTimestampCreationErrorZ + * The contents of CResult_COption_TypeZDecodeErrorZ */ -typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { +typedef union LDKCResult_COption_TypeZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPositiveTimestamp *result; + struct LDKCOption_TypeZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKCreationError *err; -} LDKCResult_PositiveTimestampCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_TypeZDecodeErrorZPtr; /** - * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PositiveTimestampCreationErrorZ { +typedef struct LDKCResult_COption_TypeZDecodeErrorZ { /** - * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either + * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PositiveTimestampCreationErrorZPtr contents; + union LDKCResult_COption_TypeZDecodeErrorZPtr contents; /** - * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. + * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PositiveTimestampCreationErrorZ; +} LDKCResult_COption_TypeZDecodeErrorZ; /** - * The contents of CResult_NoneSemanticErrorZ + * An error that may occur when making a payment. */ -typedef union LDKCResult_NoneSemanticErrorZPtr { +typedef enum LDKPaymentError_Tag { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * An error resulting from the provided [`Invoice`] or payment hash. */ - void *result; + LDKPaymentError_Invoice, + /** + * An error occurring when finding a route. + */ + LDKPaymentError_Routing, + /** + * An error occurring when sending a payment. + */ + LDKPaymentError_Sending, + /** + * Must be last for serialization purposes + */ + LDKPaymentError_Sentinel, +} LDKPaymentError_Tag; + +typedef struct MUST_USE_STRUCT LDKPaymentError { + LDKPaymentError_Tag tag; + union { + struct { + struct LDKStr invoice; + }; + struct { + struct LDKLightningError routing; + }; + struct { + struct LDKPaymentSendFailure sending; + }; + }; +} LDKPaymentError; + +/** + * The contents of CResult_PaymentIdPaymentErrorZ + */ +typedef union LDKCResult_PaymentIdPaymentErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKSemanticError *err; -} LDKCResult_NoneSemanticErrorZPtr; + struct LDKPaymentError *err; +} LDKCResult_PaymentIdPaymentErrorZPtr; /** - * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::SemanticError on failure. + * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneSemanticErrorZ { +typedef struct LDKCResult_PaymentIdPaymentErrorZ { /** - * The contents of this CResult_NoneSemanticErrorZ, accessible via either + * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneSemanticErrorZPtr contents; + union LDKCResult_PaymentIdPaymentErrorZPtr contents; /** - * Whether this CResult_NoneSemanticErrorZ represents a success state. + * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneSemanticErrorZ; +} LDKCResult_PaymentIdPaymentErrorZ; /** - * The contents of CResult_InvoiceSemanticErrorZ + * The contents of CResult_SiPrefixNoneZ */ -typedef union LDKCResult_InvoiceSemanticErrorZPtr { +typedef union LDKCResult_SiPrefixNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoice *result; + enum LDKSiPrefix *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - enum LDKSemanticError *err; -} LDKCResult_InvoiceSemanticErrorZPtr; + void *err; +} LDKCResult_SiPrefixNoneZPtr; /** - * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. + * A CResult_SiPrefixNoneZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SiPrefix on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InvoiceSemanticErrorZ { +typedef struct LDKCResult_SiPrefixNoneZ { /** - * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either + * The contents of this CResult_SiPrefixNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceSemanticErrorZPtr contents; + union LDKCResult_SiPrefixNoneZPtr contents; /** - * Whether this CResult_InvoiceSemanticErrorZ represents a success state. + * Whether this CResult_SiPrefixNoneZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceSemanticErrorZ; +} LDKCResult_SiPrefixNoneZ; /** - * Description string + * Represents a syntactically and semantically correct lightning BOLT11 invoice. * - * # Invariants - * The description can be at most 639 __bytes__ long + * There are three ways to construct an `Invoice`: + * 1. using `InvoiceBuilder` + * 2. using `Invoice::from_signed(SignedRawInvoice)` + * 3. using `str::parse::(&str)` */ -typedef struct MUST_USE_STRUCT LDKDescription { +typedef struct MUST_USE_STRUCT LDKInvoice { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDescription *inner; + LDKnativeInvoice *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKDescription; +} LDKInvoice; /** - * The contents of CResult_DescriptionCreationErrorZ + * The contents of CResult_InvoiceNoneZ */ -typedef union LDKCResult_DescriptionCreationErrorZPtr { +typedef union LDKCResult_InvoiceNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKDescription *result; + struct LDKInvoice *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - enum LDKCreationError *err; -} LDKCResult_DescriptionCreationErrorZPtr; + void *err; +} LDKCResult_InvoiceNoneZPtr; /** - * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_InvoiceNoneZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_DescriptionCreationErrorZ { +typedef struct LDKCResult_InvoiceNoneZ { /** - * The contents of this CResult_DescriptionCreationErrorZ, accessible via either + * The contents of this CResult_InvoiceNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_DescriptionCreationErrorZPtr contents; + union LDKCResult_InvoiceNoneZPtr contents; /** - * Whether this CResult_DescriptionCreationErrorZ represents a success state. + * Whether this CResult_InvoiceNoneZ represents a success state. */ bool result_ok; -} LDKCResult_DescriptionCreationErrorZ; +} LDKCResult_InvoiceNoneZ; /** - * Positive duration that defines when (relatively to the timestamp) in the future the invoice - * expires + * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be + * invalid. * * # Invariants - * The number of seconds this expiry time represents has to be in the range - * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a - * timestamp + * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. */ -typedef struct MUST_USE_STRUCT LDKExpiryTime { +typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeExpiryTime *inner; + LDKnativeSignedRawInvoice *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKExpiryTime; +} LDKSignedRawInvoice; /** - * The contents of CResult_ExpiryTimeCreationErrorZ + * The contents of CResult_SignedRawInvoiceNoneZ */ -typedef union LDKCResult_ExpiryTimeCreationErrorZPtr { +typedef union LDKCResult_SignedRawInvoiceNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKExpiryTime *result; + struct LDKSignedRawInvoice *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - enum LDKCreationError *err; -} LDKCResult_ExpiryTimeCreationErrorZPtr; + void *err; +} LDKCResult_SignedRawInvoiceNoneZPtr; /** - * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ExpiryTimeCreationErrorZ { +typedef struct LDKCResult_SignedRawInvoiceNoneZ { /** - * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either + * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ExpiryTimeCreationErrorZPtr contents; + union LDKCResult_SignedRawInvoiceNoneZPtr contents; /** - * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state. + * Whether this CResult_SignedRawInvoiceNoneZ represents a success state. */ bool result_ok; -} LDKCResult_ExpiryTimeCreationErrorZ; +} LDKCResult_SignedRawInvoiceNoneZ; + + /** - * The contents of CResult_PrivateRouteCreationErrorZ + * Represents an syntactically correct Invoice for a payment on the lightning network, + * but without the signature information. + * De- and encoding should not lead to information loss but may lead to different hashes. + * + * For methods without docs see the corresponding methods in `Invoice`. */ -typedef union LDKCResult_PrivateRouteCreationErrorZPtr { +typedef struct MUST_USE_STRUCT LDKRawInvoice { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPrivateRoute *result; + LDKnativeRawInvoice *inner; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - enum LDKCreationError *err; -} LDKCResult_PrivateRouteCreationErrorZPtr; + bool is_owned; +} LDKRawInvoice; + + /** - * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Recoverable signature */ -typedef struct LDKCResult_PrivateRouteCreationErrorZ { +typedef struct MUST_USE_STRUCT LDKInvoiceSignature { /** - * The contents of this CResult_PrivateRouteCreationErrorZ, 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_PrivateRouteCreationErrorZPtr contents; + LDKnativeInvoiceSignature *inner; /** - * Whether this CResult_PrivateRouteCreationErrorZ 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_PrivateRouteCreationErrorZ; + bool is_owned; +} LDKInvoiceSignature; /** - * The contents of CResult_StringErrorZ + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_StringErrorZPtr { +typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The element at position 0 */ - struct LDKStr *result; + struct LDKRawInvoice a; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The element at position 1 */ - enum LDKSecp256k1Error *err; -} LDKCResult_StringErrorZPtr; + struct LDKThirtyTwoBytes b; + /** + * The element at position 2 + */ + struct LDKInvoiceSignature c; +} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; + + /** - * A CResult_StringErrorZ represents the result of a fallible operation, - * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Payee public key */ -typedef struct LDKCResult_StringErrorZ { +typedef struct MUST_USE_STRUCT LDKPayeePubKey { /** - * The contents of this CResult_StringErrorZ, 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_StringErrorZPtr contents; + LDKnativePayeePubKey *inner; /** - * Whether this CResult_StringErrorZ 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_StringErrorZ; + bool is_owned; +} LDKPayeePubKey; /** - * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ + * The contents of CResult_PayeePubKeyErrorZ */ -typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { +typedef union LDKCResult_PayeePubKeyErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelMonitorUpdate *result; + struct LDKPayeePubKey *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_PayeePubKeyErrorZPtr; /** - * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { +typedef struct LDKCResult_PayeePubKeyErrorZ { /** - * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_PayeePubKeyErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; + union LDKCResult_PayeePubKeyErrorZPtr contents; /** - * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + * Whether this CResult_PayeePubKeyErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; +} LDKCResult_PayeePubKeyErrorZ; + + /** - * The contents of CResult_HTLCUpdateDecodeErrorZ + * Private routing information + * + * # Invariants + * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * */ -typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKPrivateRoute { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKHTLCUpdate *result; + LDKnativePrivateRoute *inner; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKDecodeError *err; -} LDKCResult_HTLCUpdateDecodeErrorZPtr; + bool is_owned; +} LDKPrivateRoute; /** - * 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`. + * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { +typedef struct LDKCVec_PrivateRouteZ { /** - * The contents of this CResult_HTLCUpdateDecodeErrorZ, 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_HTLCUpdateDecodeErrorZPtr contents; + struct LDKPrivateRoute *data; /** - * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_HTLCUpdateDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_PrivateRouteZ; /** - * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is - * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this - * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was - * corrupted. - * Contains a developer-readable error message. + * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX + * timestamp is positive. + * + * # Invariants + * The UNIX timestamp representing the stored time has to be positive and small enough so that + * a `EpiryTime` can be added to it without an overflow. */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateError { +typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMonitorUpdateError *inner; + LDKnativePositiveTimestamp *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMonitorUpdateError; +} LDKPositiveTimestamp; /** - * The contents of CResult_NoneMonitorUpdateErrorZ + * The contents of CResult_PositiveTimestampCreationErrorZ */ -typedef union LDKCResult_NoneMonitorUpdateErrorZPtr { +typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKPositiveTimestamp *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKMonitorUpdateError *err; -} LDKCResult_NoneMonitorUpdateErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_PositiveTimestampCreationErrorZPtr; /** - * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure. + * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneMonitorUpdateErrorZ { +typedef struct LDKCResult_PositiveTimestampCreationErrorZ { /** - * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either + * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneMonitorUpdateErrorZPtr contents; + union LDKCResult_PositiveTimestampCreationErrorZPtr contents; /** - * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state. + * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneMonitorUpdateErrorZ; +} LDKCResult_PositiveTimestampCreationErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_NoneSemanticErrorZ */ -typedef struct LDKC2Tuple_OutPointScriptZ { +typedef union LDKCResult_NoneSemanticErrorZPtr { /** - * The element at position 0 + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKOutPoint a; + void *result; /** - * The element at position 1 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointScriptZ; + enum LDKSemanticError *err; +} LDKCResult_NoneSemanticErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning_invoice::SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_u32ScriptZ { +typedef struct LDKCResult_NoneSemanticErrorZ { /** - * The element at position 0 + * The contents of this CResult_NoneSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint32_t a; + union LDKCResult_NoneSemanticErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_NoneSemanticErrorZ represents a success state. */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; + bool result_ok; +} LDKCResult_NoneSemanticErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_InvoiceSemanticErrorZ */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef union LDKCResult_InvoiceSemanticErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_u32ScriptZ *data; + struct LDKInvoice *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_u32ScriptZZ; + enum LDKSemanticError *err; +} LDKCResult_InvoiceSemanticErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +typedef struct LDKCResult_InvoiceSemanticErrorZ { /** - * The element at position 0 + * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes a; + union LDKCResult_InvoiceSemanticErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_InvoiceSemanticErrorZ represents a success state. */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; + bool result_ok; +} LDKCResult_InvoiceSemanticErrorZ; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * Description string + * + * # Invariants + * The description can be at most 639 __bytes__ long */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +typedef struct MUST_USE_STRUCT LDKDescription { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; + LDKnativeDescription *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; + bool is_owned; +} LDKDescription; /** - * 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_DescriptionCreationErrorZ */ -typedef enum LDKPaymentPurpose_Tag { - /** - * Information for receiving a payment that we generated an invoice for. - */ - LDKPaymentPurpose_InvoicePayment, +typedef union LDKCResult_DescriptionCreationErrorZPtr { /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKPaymentPurpose_SpontaneousPayment, + struct LDKDescription *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKPaymentPurpose_Sentinel, -} LDKPaymentPurpose_Tag; + enum LDKCreationError *err; +} LDKCResult_DescriptionCreationErrorZPtr; -typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { - /** - * The preimage to the payment_hash, if the payment hash (and secret) were fetched via - * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to - * [`ChannelManager::claim_funds`]. - * - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKThirtyTwoBytes payment_preimage; +/** + * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_DescriptionCreationErrorZ { /** - * The \"payment secret\". This authenticates the sender to the recipient, preventing a - * number of deanonymization attacks during the routing process. - * It is provided here for your reference, however its accuracy is enforced directly by - * [`ChannelManager`] using the values you previously provided to - * [`ChannelManager::create_inbound_payment`] or - * [`ChannelManager::create_inbound_payment_for_hash`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash + * The contents of this CResult_DescriptionCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes payment_secret; + union LDKCResult_DescriptionCreationErrorZPtr contents; /** - * This is the `user_payment_id` which was provided to - * [`ChannelManager::create_inbound_payment_for_hash`] or - * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is - * simply copied here. It may be used to correlate PaymentReceived events with invoice - * metadata stored elsewhere. - * - * [`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 + * Whether this CResult_DescriptionCreationErrorZ represents a success state. */ - uint64_t user_payment_id; -} LDKPaymentPurpose_LDKInvoicePayment_Body; + bool result_ok; +} LDKCResult_DescriptionCreationErrorZ; + -typedef struct MUST_USE_STRUCT LDKPaymentPurpose { - LDKPaymentPurpose_Tag tag; - union { - LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; - struct { - struct LDKThirtyTwoBytes spontaneous_payment; - }; - }; -} LDKPaymentPurpose; /** - * The reason the channel was closed. See individual variants more details. + * Positive duration that defines when (relatively to the timestamp) in the future the invoice + * expires + * + * # Invariants + * The number of seconds this expiry time represents has to be in the range + * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a + * timestamp */ -typedef enum LDKClosureReason_Tag { - /** - * Closure generated from receiving a peer error message. - * - * Our counterparty may have broadcasted their latest commitment state, and we have - * as well. - */ - LDKClosureReason_CounterpartyForceClosed, - /** - * Closure generated from [`ChannelManager::force_close_channel`], called by the user. - * - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. - */ - LDKClosureReason_HolderForceClosed, +typedef struct MUST_USE_STRUCT LDKExpiryTime { /** - * The channel was closed after negotiating a cooperative close and we've now broadcasted - * the cooperative close transaction. Note the shutdown may have been initiated by us. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKClosureReason_CooperativeClosure, + LDKnativeExpiryTime *inner; /** - * A commitment transaction was confirmed on chain, closing the channel. Most likely this - * commitment transaction came from our counterparty, but it may also have come from - * a copy of our own `ChannelMonitor`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKClosureReason_CommitmentTxConfirmed, + bool is_owned; +} LDKExpiryTime; + +/** + * The contents of CResult_ExpiryTimeCreationErrorZ + */ +typedef union LDKCResult_ExpiryTimeCreationErrorZPtr { /** - * Closure generated from processing an event, likely a HTLC forward/relay/reception. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKClosureReason_ProcessingError, + struct LDKExpiryTime *result; /** - * The `PeerManager` informed us that we've disconnected from the peer. We close channels - * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the - * peer again in the future or if the peer disconnected before we finished negotiating - * the channel open. The first case may be caused by incompatible features which our - * counterparty, or we, require. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKClosureReason_DisconnectedPeer, + enum LDKCreationError *err; +} LDKCResult_ExpiryTimeCreationErrorZPtr; + +/** + * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ExpiryTimeCreationErrorZ { /** - * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than - * the ChannelManager deserialized. + * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKClosureReason_OutdatedChannelManager, + union LDKCResult_ExpiryTimeCreationErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state. */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; + bool result_ok; +} LDKCResult_ExpiryTimeCreationErrorZ; -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { +/** + * The contents of CResult_PrivateRouteCreationErrorZ + */ +typedef union LDKCResult_PrivateRouteCreationErrorZPtr { /** - * The error which the peer sent us. - * - * The string should be sanitized before it is used (e.g emitted to logs - * or printed to stdout). Otherwise, a well crafted error message may exploit - * a security vulnerability in the terminal emulator or the logging subsystem. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKStr peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { + struct LDKPrivateRoute *result; /** - * A developer-readable error message which we generated. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKStr err; -} LDKClosureReason_LDKProcessingError_Body; - -typedef struct MUST_USE_STRUCT LDKClosureReason { - LDKClosureReason_Tag tag; - union { - LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; - LDKClosureReason_LDKProcessingError_Body processing_error; - }; -} LDKClosureReason; + enum LDKCreationError *err; +} LDKCResult_PrivateRouteCreationErrorZPtr; /** - * 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). + * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef enum LDKEvent_Tag { +typedef struct LDKCResult_PrivateRouteCreationErrorZ { /** - * 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! + * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_FundingGenerationReady, + union LDKCResult_PrivateRouteCreationErrorZPtr contents; /** - * Indicates we've received money! Just gotta dig out that payment preimage and feed it to - * [`ChannelManager::claim_funds`] to get it.... - * Note that if the preimage is not known, you should call - * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid - * network congestion. - * If you fail to call either [`ChannelManager::claim_funds`] or - * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be - * automatically failed. - * - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards + * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. */ - LDKEvent_PaymentReceived, + bool result_ok; +} LDKCResult_PrivateRouteCreationErrorZ; + +/** + * The contents of CResult_StringErrorZ + */ +typedef union LDKCResult_StringErrorZPtr { /** - * 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. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_PaymentSent, + struct LDKStr *result; /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_PaymentPathFailed, + enum LDKSecp256k1Error *err; +} LDKCResult_StringErrorZPtr; + +/** + * A CResult_StringErrorZ represents the result of a fallible operation, + * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_StringErrorZ { /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. + * The contents of this CResult_StringErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_PendingHTLCsForwardable, + union LDKCResult_StringErrorZPtr contents; /** - * Used to indicate that an output which you should know how to spend was confirmed on chain - * and is now spendable. - * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your - * counterparty spending them due to some kind of timeout. Thus, you need to store them - * somewhere and spend them when you create on-chain transactions. + * Whether this CResult_StringErrorZ represents a success state. */ - LDKEvent_SpendableOutputs, + bool result_ok; +} LDKCResult_StringErrorZ; + +/** + * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ + */ +typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { /** - * This event is generated when a payment has been successfully forwarded through us and a - * forwarding fee earned. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_PaymentForwarded, + struct LDKChannelMonitorUpdate *result; /** - * Used to indicate that a channel with the given `channel_id` is in the process of closure. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_ChannelClosed, + struct LDKDecodeError *err; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; + +/** + * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { /** - * Used to indicate to the user that they can abandon the funding transaction and recycle the - * inputs for another purpose. + * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_DiscardFunding, + union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. */ - LDKEvent_Sentinel, -} LDKEvent_Tag; + bool result_ok; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; -typedef struct LDKEvent_LDKFundingGenerationReady_Body { +/** + * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not + */ +typedef enum LDKCOption_MonitorEventZ_Tag { /** - * The random channel_id we picked which you'll need to pass into - * ChannelManager::funding_transaction_generated. + * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent */ - struct LDKThirtyTwoBytes temporary_channel_id; + LDKCOption_MonitorEventZ_Some, /** - * The value, in satoshis, that the output should have. + * When we're in this state, this COption_MonitorEventZ contains nothing */ - uint64_t channel_value_satoshis; + LDKCOption_MonitorEventZ_None, /** - * The script which should be used in the transaction output. + * Must be last for serialization purposes */ - struct LDKCVec_u8Z output_script; + LDKCOption_MonitorEventZ_Sentinel, +} LDKCOption_MonitorEventZ_Tag; + +typedef struct LDKCOption_MonitorEventZ { + LDKCOption_MonitorEventZ_Tag tag; + union { + struct { + struct LDKMonitorEvent some; + }; + }; +} LDKCOption_MonitorEventZ; + +/** + * The contents of CResult_COption_MonitorEventZDecodeErrorZ + */ +typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - * an inbound channel. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint64_t user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; - -typedef struct LDKEvent_LDKPaymentReceived_Body { + struct LDKCOption_MonitorEventZ *result; /** - * The hash for which the preimage should be handed to the ChannelManager. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKThirtyTwoBytes payment_hash; + struct LDKDecodeError *err; +} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; + +/** + * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { /** - * The value, in thousandths of a satoshi, that this payment is for. + * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t amt; + union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. */ - struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentReceived_Body; + bool result_ok; +} LDKCResult_COption_MonitorEventZDecodeErrorZ; -typedef struct LDKEvent_LDKPaymentSent_Body { +/** + * The contents of CResult_HTLCUpdateDecodeErrorZ + */ +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * - * 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 LDKThirtyTwoBytes payment_id; + struct LDKHTLCUpdate *result; /** - * 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! + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKThirtyTwoBytes payment_preimage; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; + +/** + * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** - * The hash which was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes payment_hash; + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; /** - * 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 + * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. */ - struct LDKCOption_u64Z fee_paid_msat; -} LDKEvent_LDKPaymentSent_Body; + bool result_ok; +} LDKCResult_HTLCUpdateDecodeErrorZ; -typedef struct LDKEvent_LDKPaymentPathFailed_Body { + + +/** + * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is + * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this + * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was + * corrupted. + * Contains a developer-readable error message. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdateError { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes payment_id; + LDKnativeMonitorUpdateError *inner; /** - * The hash which was given to ChannelManager::send_payment. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKThirtyTwoBytes payment_hash; + bool is_owned; +} LDKMonitorUpdateError; + +/** + * The contents of CResult_NoneMonitorUpdateErrorZ + */ +typedef union LDKCResult_NoneMonitorUpdateErrorZPtr { /** - * Indicates the payment was rejected for some reason by the recipient. This implies that - * the payment has failed, not just the route in question. If this is not set, you may - * retry the payment via a different route. + * Note that this value is always NULL, as there are no contents in the OK variant */ - bool rejected_by_dest; + void *result; /** - * Any failure information conveyed via the Onion return packet by a node along the failed - * payment route. - * - * Should be applied to the [`NetworkGraph`] so that routing decisions can take into - * account the update. [`NetGraphMsgHandler`] is capable of doing this. - * - * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCOption_NetworkUpdateZ network_update; + struct LDKMonitorUpdateError *err; +} LDKCResult_NoneMonitorUpdateErrorZPtr; + +/** + * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneMonitorUpdateErrorZ { /** - * For both single-path and multi-path payments, this is set if all paths of the payment have - * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the - * larger MPP payment were still in flight when this event was generated. + * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - bool all_paths_failed; + union LDKCResult_NoneMonitorUpdateErrorZPtr contents; /** - * The payment path that failed. + * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state. */ - struct LDKCVec_RouteHopZ path; + bool result_ok; +} LDKCResult_NoneMonitorUpdateErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OutPointScriptZ { /** - * The channel responsible for the failed payment path. - * - * If this is `Some`, then the corresponding channel should be avoided when the payment is - * retried. May be `None` for older [`Event`] serializations. + * The element at position 0 */ - struct LDKCOption_u64Z short_channel_id; + struct LDKOutPoint a; /** - * Parameters needed to compute a new [`Route`] when retrying the failed payment path. - * - * See [`find_route`] for details. - * - * [`Route`]: crate::routing::router::Route - * [`find_route`]: crate::routing::router::find_route - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The element at position 1 */ - struct LDKRouteParameters retry; -} LDKEvent_LDKPaymentPathFailed_Body; + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointScriptZ; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u32ScriptZ { /** - * 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). + * The element at position 0 */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; - -typedef struct LDKEvent_LDKSpendableOutputs_Body { + uint32_t a; /** - * The outputs which you should store as spendable by you. + * The element at position 1 */ - struct LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; + struct LDKCVec_u8Z b; +} LDKC2Tuple_u32ScriptZ; -typedef struct LDKEvent_LDKPaymentForwarded_Body { +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_u32ScriptZZ { /** - * The fee, in milli-satoshis, which was earned as a result of the payment. - * - * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC - * was pending, the amount the next hop claimed will have been rounded down to the nearest - * whole satoshi. Thus, the fee calculated here may be higher than expected as we still - * claimed the full value in millisatoshis from the source. In this case, - * `claim_from_onchain_tx` will be set. - * - * If the channel which sent us the payment has been force-closed, we will claim the funds - * via an on-chain transaction. In that case we do not yet know the on-chain transaction - * fees which we will spend and will instead set this to `None`. It is possible duplicate - * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is - * `None`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCOption_u64Z fee_earned_msat; + struct LDKC2Tuple_u32ScriptZ *data; /** - * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain - * transaction. + * The number of elements pointed to by `data`. */ - bool claim_from_onchain_tx; -} LDKEvent_LDKPaymentForwarded_Body; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32ScriptZZ; -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 LDKThirtyTwoBytes channel_id; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - * an inbound channel. This will always be zero for objects serialized with LDK versions - * prior to 0.0.102. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * The element at position 0 */ - uint64_t user_channel_id; + struct LDKThirtyTwoBytes a; /** - * The reason the channel was closed. + * The element at position 1 */ - struct LDKClosureReason reason; -} LDKEvent_LDKChannelClosed_Body; + struct LDKCVec_C2Tuple_u32ScriptZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; -typedef struct LDKEvent_LDKDiscardFunding_Body { +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { /** - * The channel_id of the channel which has been closed. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes channel_id; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; /** - * The full transaction received from the user + * The number of elements pointed to by `data`. */ - struct LDKTransaction transaction; -} LDKEvent_LDKDiscardFunding_Body; - -typedef struct MUST_USE_STRUCT LDKEvent { - LDKEvent_Tag tag; - union { - LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKPaymentReceived_Body payment_received; - LDKEvent_LDKPaymentSent_Body payment_sent; - LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; - LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; - LDKEvent_LDKSpendableOutputs_Body spendable_outputs; - LDKEvent_LDKPaymentForwarded_Body payment_forwarded; - LDKEvent_LDKChannelClosed_Body channel_closed; - LDKEvent_LDKDiscardFunding_Body discard_funding; - }; -} LDKEvent; + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. @@ -7331,17 +7532,50 @@ typedef union LDKCResult_NodeIdDecodeErrorZPtr { * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NodeIdDecodeErrorZ { +typedef struct LDKCResult_NodeIdDecodeErrorZ { + /** + * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NodeIdDecodeErrorZPtr contents; + /** + * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NodeIdDecodeErrorZ; + +/** + * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ + */ +typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_NetworkUpdateZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr; + +/** + * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { /** - * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either + * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NodeIdDecodeErrorZPtr contents; + union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; /** - * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NodeIdDecodeErrorZ; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; /** * The `Access` trait defines behavior for accessing chain data and state, such as blocks and @@ -11004,6 +11238,14 @@ struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); */ void Str_free(struct LDKStr _res); +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif + /** * Creates a new CResult_SecretKeyErrorZ in the success state. */ @@ -11014,6 +11256,11 @@ struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey */ struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SecretKeyErrorZ. */ @@ -11029,6 +11276,11 @@ struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey */ struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PublicKeyErrorZ. */ @@ -11050,6 +11302,11 @@ struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ */ struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. */ @@ -11071,6 +11328,11 @@ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeE */ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. */ @@ -11092,6 +11354,11 @@ struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LD */ struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxCreationKeysErrorZ. */ @@ -11134,6 +11401,11 @@ struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitm */ struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. */ @@ -11155,6 +11427,11 @@ struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_C */ struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. */ @@ -11176,6 +11453,11 @@ struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransa */ struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. */ @@ -11202,6 +11484,11 @@ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitme */ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. */ @@ -11223,6 +11510,11 @@ struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitment */ struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. */ @@ -11244,6 +11536,11 @@ struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransacti */ struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. */ @@ -11259,6 +11556,11 @@ struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactio */ struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. */ @@ -11280,6 +11582,11 @@ struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTra */ struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. */ @@ -11295,6 +11602,11 @@ struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LD */ struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CVec_SignatureZNoneZ. */ @@ -11316,6 +11628,11 @@ struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ */ struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. */ @@ -11337,6 +11654,11 @@ struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInv */ struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. */ @@ -11352,6 +11674,11 @@ struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); */ struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneErrorZ. */ @@ -11373,6 +11700,11 @@ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LD */ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteHopDecodeErrorZ. */ @@ -11404,6 +11736,11 @@ struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute */ struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteDecodeErrorZ. */ @@ -11425,6 +11762,11 @@ struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeError */ struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. */ @@ -11472,6 +11814,11 @@ struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee */ struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PayeeDecodeErrorZ. */ @@ -11498,6 +11845,11 @@ struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct */ struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteHintDecodeErrorZ. */ @@ -11519,6 +11871,11 @@ struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(s */ struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. */ @@ -11545,6 +11902,11 @@ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LD */ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteLightningErrorZ. */ @@ -11566,6 +11928,11 @@ struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut */ struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxOutAccessErrorZ. */ @@ -11613,6 +11980,11 @@ struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateE */ struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. */ @@ -11650,6 +12022,53 @@ void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTran */ struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig); +/** + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); + +/** + * Constructs a new COption_ClosureReasonZ containing nothing + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state + */ +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); + +/** + * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); + +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + */ +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate */ @@ -11676,6 +12095,53 @@ struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCO */ void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +/** + * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event + */ +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); + +/** + * Constructs a new COption_EventZ containing nothing + */ +struct LDKCOption_EventZ COption_EventZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state + */ +void COption_EventZ_free(struct LDKCOption_EventZ _res); + +/** + * Creates a new COption_EventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); + +/** + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + */ +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -11691,6 +12157,11 @@ struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(s */ struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. */ @@ -11706,6 +12177,11 @@ struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(s */ struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. */ @@ -11721,6 +12197,11 @@ struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeError */ struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. */ @@ -11736,6 +12217,11 @@ struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeError */ struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. */ @@ -11751,6 +12237,11 @@ struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeE */ struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ. */ @@ -11766,6 +12257,11 @@ struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKSco */ struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ScorerDecodeErrorZ. */ @@ -11781,6 +12277,11 @@ struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaym */ struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. */ @@ -11802,6 +12303,11 @@ struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymen */ struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. */ @@ -11823,6 +12329,11 @@ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputD */ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. */ @@ -11844,6 +12355,11 @@ struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); */ struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneNoneZ. */ @@ -11881,6 +12397,11 @@ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_Signatu */ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. */ @@ -11902,6 +12423,11 @@ struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o */ struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SignatureNoneZ. */ @@ -11923,6 +12449,11 @@ struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o) */ struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SignDecodeErrorZ. */ @@ -11949,6 +12480,11 @@ struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok */ struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ @@ -11975,6 +12511,11 @@ struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKC */ struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. */ @@ -11996,6 +12537,11 @@ struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ */ struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. */ @@ -12022,6 +12568,11 @@ struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransac */ struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TransactionNoneZ. */ @@ -12058,6 +12609,11 @@ struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tu */ struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. */ @@ -12094,6 +12650,11 @@ struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); */ struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneAPIErrorZ. */ @@ -12125,6 +12686,11 @@ struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBy */ struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult__u832APIErrorZ. */ @@ -12146,6 +12712,11 @@ struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailu */ struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. */ @@ -12167,6 +12738,11 @@ struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(voi */ struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NonePaymentSendFailureZ. */ @@ -12204,6 +12780,11 @@ struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tup */ struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. */ @@ -12246,6 +12827,11 @@ struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struc */ struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. */ @@ -12282,6 +12868,11 @@ struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_B */ struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. */ @@ -12297,6 +12888,11 @@ struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok */ struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ @@ -12318,6 +12914,11 @@ struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LD */ struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ @@ -12354,6 +12955,11 @@ struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok */ struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ @@ -12369,6 +12975,11 @@ struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struc */ struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. */ @@ -12390,6 +13001,11 @@ struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o); */ struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SiPrefixNoneZ. */ @@ -12411,6 +13027,11 @@ struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o); */ struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InvoiceNoneZ. */ @@ -12432,6 +13053,11 @@ struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct */ struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SignedRawInvoiceNoneZ. */ @@ -12469,6 +13095,11 @@ struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayee */ struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ @@ -12495,6 +13126,11 @@ struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreat */ struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ @@ -12516,6 +13152,11 @@ struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); */ struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneSemanticErrorZ. */ @@ -12537,6 +13178,11 @@ struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct */ struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ @@ -12556,7 +13202,12 @@ struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok /** * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** * Frees any resources used by the CResult_DescriptionCreationErrorZ. @@ -12579,6 +13230,11 @@ struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(s */ struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ. */ @@ -12600,6 +13256,11 @@ struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ */ struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ @@ -12621,6 +13282,11 @@ struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); */ struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_StringErrorZ. */ @@ -12636,6 +13302,11 @@ struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateD */ struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. */ @@ -12647,6 +13318,53 @@ void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMoni */ struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + */ +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); + +/** + * Constructs a new COption_MonitorEventZ containing nothing + */ +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + */ +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); + +/** + * Creates a new COption_MonitorEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + */ +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ @@ -12657,6 +13375,11 @@ struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struc */ struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ @@ -12678,6 +13401,11 @@ struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(voi */ struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneMonitorUpdateErrorZ_is_ok(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ. */ @@ -12814,6 +13542,11 @@ struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_B */ struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. */ @@ -12829,6 +13562,11 @@ struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); */ struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneLightningErrorZ. */ @@ -12865,6 +13603,11 @@ struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); */ struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_boolLightningErrorZ. */ @@ -12917,6 +13660,11 @@ struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(s */ struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ @@ -12938,6 +13686,11 @@ struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); */ struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NonePeerHandleErrorZ. */ @@ -12959,6 +13712,11 @@ struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); */ struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_boolPeerHandleErrorZ. */ @@ -12980,6 +13738,11 @@ struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNod */ struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NodeIdDecodeErrorZ. */ @@ -12991,6 +13754,32 @@ void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); */ struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + */ +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access */ @@ -13016,6 +13805,11 @@ struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelI */ struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ. */ @@ -13037,6 +13831,11 @@ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(str */ struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. */ @@ -13058,6 +13857,11 @@ struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(str */ struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. */ @@ -13079,6 +13883,11 @@ struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoD */ struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. */ @@ -13105,6 +13914,11 @@ struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LD */ struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. */ @@ -13126,6 +13940,11 @@ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(s */ struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. */ @@ -13168,6 +13987,11 @@ struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struc */ struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NetAddressDecodeErrorZ. */ @@ -13209,6 +14033,11 @@ struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok */ struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. */ @@ -13230,6 +14059,11 @@ struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignatu */ struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. */ @@ -13251,6 +14085,11 @@ struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecod */ struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. */ @@ -13272,6 +14111,11 @@ struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok */ struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. */ @@ -13293,6 +14137,11 @@ struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRang */ struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. */ @@ -13314,6 +14163,11 @@ struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErr */ struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. */ @@ -13335,6 +14189,11 @@ struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ */ struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. */ @@ -13356,6 +14215,11 @@ struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok */ struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. */ @@ -13377,6 +14241,11 @@ struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok */ struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_FundingLockedDecodeErrorZ. */ @@ -13398,6 +14267,11 @@ struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o) */ struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InitDecodeErrorZ. */ @@ -13419,6 +14293,11 @@ struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(str */ struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. */ @@ -13440,6 +14319,11 @@ struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(s */ struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. */ @@ -13461,6 +14345,11 @@ struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LD */ struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ShutdownDecodeErrorZ. */ @@ -13482,6 +14371,11 @@ struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ */ struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. */ @@ -13503,6 +14397,11 @@ struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalforme */ struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. */ @@ -13524,6 +14423,11 @@ struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct */ struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. */ @@ -13545,6 +14449,11 @@ struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeE */ struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. */ @@ -13566,6 +14475,11 @@ struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok */ struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. */ @@ -13587,6 +14501,11 @@ struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o) */ struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PingDecodeErrorZ. */ @@ -13608,6 +14527,11 @@ struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o) */ struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PongDecodeErrorZ. */ @@ -13629,6 +14553,11 @@ struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChanne */ struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. */ @@ -13650,6 +14579,11 @@ struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDec */ struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. */ @@ -13671,6 +14605,11 @@ struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdat */ struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. */ @@ -13692,6 +14631,11 @@ struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok */ struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. */ @@ -13713,6 +14657,11 @@ struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(s */ struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. */ @@ -13734,6 +14683,11 @@ struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnou */ struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. */ @@ -13755,6 +14709,11 @@ struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErr */ struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. */ @@ -13776,6 +14735,11 @@ struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsD */ struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. */ @@ -13797,6 +14761,11 @@ struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelI */ struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. */ @@ -13818,6 +14787,11 @@ struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeE */ struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. */ @@ -13839,6 +14813,11 @@ struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeE */ struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. */ @@ -13860,6 +14839,11 @@ struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilte */ struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. */ @@ -13881,6 +14865,11 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationError */ struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ. */ @@ -13917,6 +14906,11 @@ struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok */ struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. */ @@ -13997,6 +14991,11 @@ struct LDKClosureReason ClosureReason_outdated_channel_manager(void); */ struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); +/** + * Read a ClosureReason from a byte array, created by ClosureReason_write + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); + /** * Frees any resources used by the Event */ @@ -14057,6 +15056,11 @@ struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struc */ struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +/** + * Read a Event from a byte array, created by Event_write + */ +struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); + /** * Frees any resources used by the MessageSendEvent */ @@ -14281,6 +15285,66 @@ uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); */ MUST_USE_RES enum LDKLevel Level_max(void); +/** + * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. + */ +void Record_free(struct LDKRecord this_obj); + +/** + * The verbosity level of the message. + */ +enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The verbosity level of the message. + */ +void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); + +/** + * The message body. + */ +struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The message body. + */ +void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * The module path of the message. + */ +struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The module path of the message. + */ +void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * The source file containing the message. + */ +struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The source file containing the message. + */ +void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * The line containing the message. + */ +uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The line containing the message. + */ +void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Creates a copy of the Record + */ +struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); + /** * Calls the free function if one is set */ @@ -15319,6 +16383,11 @@ struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a); */ struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj); +/** + * Read a MonitorEvent from a byte array, created by MonitorEvent_write + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser); + /** * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. */ @@ -20816,6 +21885,11 @@ struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, */ struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); +/** + * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); + /** * Constructs a new EventHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 730713c..d4c68a5 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -163,6 +163,7 @@ class ChannelMessageHandler; class RoutingMessageHandler; class DefaultRouter; class Level; +class Record; class Logger; class MonitorUpdateId; class Persist; @@ -234,9 +235,10 @@ class C2Tuple_BlockHashChannelMonitorZ; class CResult_NodeIdDecodeErrorZ; class CResult_ShutdownScriptInvalidShutdownScriptZ; class CResult_RecoverableSignatureNoneZ; +class CResult_COption_NetworkUpdateZDecodeErrorZ; class CResult_NodeAnnouncementInfoDecodeErrorZ; -class CVec_UpdateFailMalformedHTLCZ; class C3Tuple_RawInvoice_u832InvoiceSignatureZ; +class CVec_UpdateFailMalformedHTLCZ; class CResult_FundingSignedDecodeErrorZ; class CResult_NetworkGraphDecodeErrorZ; class CVec_RouteHopZ; @@ -283,20 +285,23 @@ class CResult_NoneErrorZ; class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; class CResult_PongDecodeErrorZ; class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +class COption_EventZ; class CVec_RouteHintZ; class COption_u16Z; class CVec_CVec_RouteHopZZ; class CResult_TrustedCommitmentTransactionNoneZ; class CResult_NoneLightningErrorZ; class CResult_NonePeerHandleErrorZ; -class COption_CVec_NetAddressZZ; +class CResult_COption_EventZDecodeErrorZ; class CResult_CVec_SignatureZNoneZ; class CResult_PayeeDecodeErrorZ; +class COption_CVec_NetAddressZZ; class CResult__u832APIErrorZ; class CResult_PaymentIdPaymentErrorZ; class CResult_DescriptionCreationErrorZ; -class CVec_C2Tuple_PublicKeyTypeZZ; +class CResult_COption_MonitorEventZDecodeErrorZ; class CResult_PayeePubKeyErrorZ; +class CVec_C2Tuple_PublicKeyTypeZZ; class CResult_RoutingFeesDecodeErrorZ; class CResult_QueryShortChannelIdsDecodeErrorZ; class CResult_InvoiceSemanticErrorZ; @@ -306,6 +311,7 @@ class CResult_NoneAPIErrorZ; class CVec_NetAddressZ; class CVec_C2Tuple_usizeTransactionZZ; class CVec_PublicKeyZ; +class COption_MonitorEventZ; class COption_TypeZ; class CResult_COption_TypeZDecodeErrorZ; class CResult_DirectionalChannelInfoDecodeErrorZ; @@ -322,13 +328,15 @@ class CResult_NoneSemanticErrorZ; class CVec_MonitorEventZ; class CVec_C2Tuple_u32ScriptZZ; class CResult_NoneChannelMonitorUpdateErrZ; +class CResult_COption_ClosureReasonZDecodeErrorZ; class CResult_SiPrefixNoneZ; class CResult_PublicKeyErrorZ; class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; -class CResult_RouteParametersDecodeErrorZ; class CResult_NoneNoneZ; -class CResult_PrivateRouteCreationErrorZ; +class CResult_RouteParametersDecodeErrorZ; +class COption_ClosureReasonZ; class CVec_APIErrorZ; +class CResult_PrivateRouteCreationErrorZ; class CResult_boolPeerHandleErrorZ; class CResult_ChannelUpdateDecodeErrorZ; class CVec_UpdateFulfillHTLCZ; @@ -3363,6 +3371,21 @@ public: const LDKLevel* operator &() const { return &self; } const LDKLevel* operator ->() const { return &self; } }; +class Record { +private: + LDKRecord self; +public: + Record(const Record&) = delete; + Record(Record&& o) : self(o.self) { memset(&o, 0, sizeof(Record)); } + Record(LDKRecord&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRecord)); } + operator LDKRecord() && { LDKRecord res = self; memset(&self, 0, sizeof(LDKRecord)); return res; } + ~Record() { Record_free(self); } + Record& operator=(Record&& o) { Record_free(self); self = o.self; memset(&o, 0, sizeof(Record)); return *this; } + LDKRecord* operator &() { return &self; } + LDKRecord* operator ->() { return &self; } + const LDKRecord* operator &() const { return &self; } + const LDKRecord* operator ->() const { return &self; } +}; class Logger { private: LDKLogger self; @@ -3380,7 +3403,7 @@ public: /** * Logs the `Record` */ - inline void log(const char *record); + inline void log(const struct LDKRecord *NONNULL_PTR record); }; class MonitorUpdateId { private: @@ -4488,6 +4511,21 @@ public: const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; } const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; } }; +class CResult_COption_NetworkUpdateZDecodeErrorZ { +private: + LDKCResult_COption_NetworkUpdateZDecodeErrorZ self; +public: + CResult_COption_NetworkUpdateZDecodeErrorZ(const CResult_COption_NetworkUpdateZDecodeErrorZ&) = delete; + CResult_COption_NetworkUpdateZDecodeErrorZ(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); } + CResult_COption_NetworkUpdateZDecodeErrorZ(LDKCResult_COption_NetworkUpdateZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); } + operator LDKCResult_COption_NetworkUpdateZDecodeErrorZ() && { LDKCResult_COption_NetworkUpdateZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); return res; } + ~CResult_COption_NetworkUpdateZDecodeErrorZ() { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); } + CResult_COption_NetworkUpdateZDecodeErrorZ& operator=(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); return *this; } + LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_NodeAnnouncementInfoDecodeErrorZ { private: LDKCResult_NodeAnnouncementInfoDecodeErrorZ self; @@ -4503,21 +4541,6 @@ public: const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_UpdateFailMalformedHTLCZ { -private: - LDKCVec_UpdateFailMalformedHTLCZ self; -public: - CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; - CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } - CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } - operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } - ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } - CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } - LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } -}; class C3Tuple_RawInvoice_u832InvoiceSignatureZ { private: LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ self; @@ -4533,6 +4556,21 @@ public: const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() const { return &self; } const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() const { return &self; } }; +class CVec_UpdateFailMalformedHTLCZ { +private: + LDKCVec_UpdateFailMalformedHTLCZ self; +public: + CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; + CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } + CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } + operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } + ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } + CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } + LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } +}; class CResult_FundingSignedDecodeErrorZ { private: LDKCResult_FundingSignedDecodeErrorZ self; @@ -5223,6 +5261,21 @@ public: const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() const { return &self; } const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() const { return &self; } }; +class COption_EventZ { +private: + LDKCOption_EventZ self; +public: + COption_EventZ(const COption_EventZ&) = delete; + COption_EventZ(COption_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_EventZ)); } + COption_EventZ(LDKCOption_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_EventZ)); } + operator LDKCOption_EventZ() && { LDKCOption_EventZ res = self; memset(&self, 0, sizeof(LDKCOption_EventZ)); return res; } + ~COption_EventZ() { COption_EventZ_free(self); } + COption_EventZ& operator=(COption_EventZ&& o) { COption_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_EventZ)); return *this; } + LDKCOption_EventZ* operator &() { return &self; } + LDKCOption_EventZ* operator ->() { return &self; } + const LDKCOption_EventZ* operator &() const { return &self; } + const LDKCOption_EventZ* operator ->() const { return &self; } +}; class CVec_RouteHintZ { private: LDKCVec_RouteHintZ self; @@ -5313,20 +5366,20 @@ public: const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } }; -class COption_CVec_NetAddressZZ { +class CResult_COption_EventZDecodeErrorZ { private: - LDKCOption_CVec_NetAddressZZ self; + LDKCResult_COption_EventZDecodeErrorZ self; public: - COption_CVec_NetAddressZZ(const COption_CVec_NetAddressZZ&) = delete; - COption_CVec_NetAddressZZ(COption_CVec_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); } - COption_CVec_NetAddressZZ(LDKCOption_CVec_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); } - operator LDKCOption_CVec_NetAddressZZ() && { LDKCOption_CVec_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); return res; } - ~COption_CVec_NetAddressZZ() { COption_CVec_NetAddressZZ_free(self); } - COption_CVec_NetAddressZZ& operator=(COption_CVec_NetAddressZZ&& o) { COption_CVec_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); return *this; } - LDKCOption_CVec_NetAddressZZ* operator &() { return &self; } - LDKCOption_CVec_NetAddressZZ* operator ->() { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator &() const { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator ->() const { return &self; } + CResult_COption_EventZDecodeErrorZ(const CResult_COption_EventZDecodeErrorZ&) = delete; + CResult_COption_EventZDecodeErrorZ(CResult_COption_EventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); } + CResult_COption_EventZDecodeErrorZ(LDKCResult_COption_EventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); } + operator LDKCResult_COption_EventZDecodeErrorZ() && { LDKCResult_COption_EventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); return res; } + ~CResult_COption_EventZDecodeErrorZ() { CResult_COption_EventZDecodeErrorZ_free(self); } + CResult_COption_EventZDecodeErrorZ& operator=(CResult_COption_EventZDecodeErrorZ&& o) { CResult_COption_EventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); return *this; } + LDKCResult_COption_EventZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_EventZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } }; class CResult_CVec_SignatureZNoneZ { private: @@ -5358,6 +5411,21 @@ public: const LDKCResult_PayeeDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PayeeDecodeErrorZ* operator ->() const { return &self; } }; +class COption_CVec_NetAddressZZ { +private: + LDKCOption_CVec_NetAddressZZ self; +public: + COption_CVec_NetAddressZZ(const COption_CVec_NetAddressZZ&) = delete; + COption_CVec_NetAddressZZ(COption_CVec_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); } + COption_CVec_NetAddressZZ(LDKCOption_CVec_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); } + operator LDKCOption_CVec_NetAddressZZ() && { LDKCOption_CVec_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); return res; } + ~COption_CVec_NetAddressZZ() { COption_CVec_NetAddressZZ_free(self); } + COption_CVec_NetAddressZZ& operator=(COption_CVec_NetAddressZZ&& o) { COption_CVec_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); return *this; } + LDKCOption_CVec_NetAddressZZ* operator &() { return &self; } + LDKCOption_CVec_NetAddressZZ* operator ->() { return &self; } + const LDKCOption_CVec_NetAddressZZ* operator &() const { return &self; } + const LDKCOption_CVec_NetAddressZZ* operator ->() const { return &self; } +}; class CResult__u832APIErrorZ { private: LDKCResult__u832APIErrorZ self; @@ -5403,20 +5471,20 @@ public: const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_PublicKeyTypeZZ { +class CResult_COption_MonitorEventZDecodeErrorZ { private: - LDKCVec_C2Tuple_PublicKeyTypeZZ self; + LDKCResult_COption_MonitorEventZDecodeErrorZ self; public: - CVec_C2Tuple_PublicKeyTypeZZ(const CVec_C2Tuple_PublicKeyTypeZZ&) = delete; - CVec_C2Tuple_PublicKeyTypeZZ(CVec_C2Tuple_PublicKeyTypeZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyTypeZZ)); } - CVec_C2Tuple_PublicKeyTypeZZ(LDKCVec_C2Tuple_PublicKeyTypeZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ)); } - operator LDKCVec_C2Tuple_PublicKeyTypeZZ() && { LDKCVec_C2Tuple_PublicKeyTypeZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ)); return res; } - ~CVec_C2Tuple_PublicKeyTypeZZ() { CVec_C2Tuple_PublicKeyTypeZZ_free(self); } - CVec_C2Tuple_PublicKeyTypeZZ& operator=(CVec_C2Tuple_PublicKeyTypeZZ&& o) { CVec_C2Tuple_PublicKeyTypeZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyTypeZZ)); return *this; } - LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() { return &self; } - LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; } + CResult_COption_MonitorEventZDecodeErrorZ(const CResult_COption_MonitorEventZDecodeErrorZ&) = delete; + CResult_COption_MonitorEventZDecodeErrorZ(CResult_COption_MonitorEventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); } + CResult_COption_MonitorEventZDecodeErrorZ(LDKCResult_COption_MonitorEventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); } + operator LDKCResult_COption_MonitorEventZDecodeErrorZ() && { LDKCResult_COption_MonitorEventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); return res; } + ~CResult_COption_MonitorEventZDecodeErrorZ() { CResult_COption_MonitorEventZDecodeErrorZ_free(self); } + CResult_COption_MonitorEventZDecodeErrorZ& operator=(CResult_COption_MonitorEventZDecodeErrorZ&& o) { CResult_COption_MonitorEventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); return *this; } + LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; } }; class CResult_PayeePubKeyErrorZ { private: @@ -5433,6 +5501,21 @@ public: const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; } const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_PublicKeyTypeZZ { +private: + LDKCVec_C2Tuple_PublicKeyTypeZZ self; +public: + CVec_C2Tuple_PublicKeyTypeZZ(const CVec_C2Tuple_PublicKeyTypeZZ&) = delete; + CVec_C2Tuple_PublicKeyTypeZZ(CVec_C2Tuple_PublicKeyTypeZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyTypeZZ)); } + CVec_C2Tuple_PublicKeyTypeZZ(LDKCVec_C2Tuple_PublicKeyTypeZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ)); } + operator LDKCVec_C2Tuple_PublicKeyTypeZZ() && { LDKCVec_C2Tuple_PublicKeyTypeZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ)); return res; } + ~CVec_C2Tuple_PublicKeyTypeZZ() { CVec_C2Tuple_PublicKeyTypeZZ_free(self); } + CVec_C2Tuple_PublicKeyTypeZZ& operator=(CVec_C2Tuple_PublicKeyTypeZZ&& o) { CVec_C2Tuple_PublicKeyTypeZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_PublicKeyTypeZZ)); return *this; } + LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() { return &self; } + LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; } +}; class CResult_RoutingFeesDecodeErrorZ { private: LDKCResult_RoutingFeesDecodeErrorZ self; @@ -5568,6 +5651,21 @@ public: const LDKCVec_PublicKeyZ* operator &() const { return &self; } const LDKCVec_PublicKeyZ* operator ->() const { return &self; } }; +class COption_MonitorEventZ { +private: + LDKCOption_MonitorEventZ self; +public: + COption_MonitorEventZ(const COption_MonitorEventZ&) = delete; + COption_MonitorEventZ(COption_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MonitorEventZ)); } + COption_MonitorEventZ(LDKCOption_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MonitorEventZ)); } + operator LDKCOption_MonitorEventZ() && { LDKCOption_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCOption_MonitorEventZ)); return res; } + ~COption_MonitorEventZ() { COption_MonitorEventZ_free(self); } + COption_MonitorEventZ& operator=(COption_MonitorEventZ&& o) { COption_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MonitorEventZ)); return *this; } + LDKCOption_MonitorEventZ* operator &() { return &self; } + LDKCOption_MonitorEventZ* operator ->() { return &self; } + const LDKCOption_MonitorEventZ* operator &() const { return &self; } + const LDKCOption_MonitorEventZ* operator ->() const { return &self; } +}; class COption_TypeZ { private: LDKCOption_TypeZ self; @@ -5808,6 +5906,21 @@ public: const LDKCResult_NoneChannelMonitorUpdateErrZ* operator &() const { return &self; } const LDKCResult_NoneChannelMonitorUpdateErrZ* operator ->() const { return &self; } }; +class CResult_COption_ClosureReasonZDecodeErrorZ { +private: + LDKCResult_COption_ClosureReasonZDecodeErrorZ self; +public: + CResult_COption_ClosureReasonZDecodeErrorZ(const CResult_COption_ClosureReasonZDecodeErrorZ&) = delete; + CResult_COption_ClosureReasonZDecodeErrorZ(CResult_COption_ClosureReasonZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); } + CResult_COption_ClosureReasonZDecodeErrorZ(LDKCResult_COption_ClosureReasonZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); } + operator LDKCResult_COption_ClosureReasonZDecodeErrorZ() && { LDKCResult_COption_ClosureReasonZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); return res; } + ~CResult_COption_ClosureReasonZDecodeErrorZ() { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); } + CResult_COption_ClosureReasonZDecodeErrorZ& operator=(CResult_COption_ClosureReasonZDecodeErrorZ&& o) { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); return *this; } + LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_SiPrefixNoneZ { private: LDKCResult_SiPrefixNoneZ self; @@ -5853,21 +5966,6 @@ public: const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } }; -class CResult_RouteParametersDecodeErrorZ { -private: - LDKCResult_RouteParametersDecodeErrorZ self; -public: - CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; - CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } - CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } - operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } - ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } - CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } - LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_NoneNoneZ { private: LDKCResult_NoneNoneZ self; @@ -5883,20 +5981,35 @@ public: const LDKCResult_NoneNoneZ* operator &() const { return &self; } const LDKCResult_NoneNoneZ* operator ->() const { return &self; } }; -class CResult_PrivateRouteCreationErrorZ { +class CResult_RouteParametersDecodeErrorZ { private: - LDKCResult_PrivateRouteCreationErrorZ self; + LDKCResult_RouteParametersDecodeErrorZ self; public: - CResult_PrivateRouteCreationErrorZ(const CResult_PrivateRouteCreationErrorZ&) = delete; - CResult_PrivateRouteCreationErrorZ(CResult_PrivateRouteCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); } - CResult_PrivateRouteCreationErrorZ(LDKCResult_PrivateRouteCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); } - operator LDKCResult_PrivateRouteCreationErrorZ() && { LDKCResult_PrivateRouteCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); return res; } - ~CResult_PrivateRouteCreationErrorZ() { CResult_PrivateRouteCreationErrorZ_free(self); } - CResult_PrivateRouteCreationErrorZ& operator=(CResult_PrivateRouteCreationErrorZ&& o) { CResult_PrivateRouteCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); return *this; } - LDKCResult_PrivateRouteCreationErrorZ* operator &() { return &self; } - LDKCResult_PrivateRouteCreationErrorZ* operator ->() { return &self; } - const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; } - const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; } + CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; + CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } + CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } + operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } + ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } + CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } + LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_ClosureReasonZ { +private: + LDKCOption_ClosureReasonZ self; +public: + COption_ClosureReasonZ(const COption_ClosureReasonZ&) = delete; + COption_ClosureReasonZ(COption_ClosureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ClosureReasonZ)); } + COption_ClosureReasonZ(LDKCOption_ClosureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ClosureReasonZ)); } + operator LDKCOption_ClosureReasonZ() && { LDKCOption_ClosureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_ClosureReasonZ)); return res; } + ~COption_ClosureReasonZ() { COption_ClosureReasonZ_free(self); } + COption_ClosureReasonZ& operator=(COption_ClosureReasonZ&& o) { COption_ClosureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ClosureReasonZ)); return *this; } + LDKCOption_ClosureReasonZ* operator &() { return &self; } + LDKCOption_ClosureReasonZ* operator ->() { return &self; } + const LDKCOption_ClosureReasonZ* operator &() const { return &self; } + const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } }; class CVec_APIErrorZ { private: @@ -5913,6 +6026,21 @@ public: const LDKCVec_APIErrorZ* operator &() const { return &self; } const LDKCVec_APIErrorZ* operator ->() const { return &self; } }; +class CResult_PrivateRouteCreationErrorZ { +private: + LDKCResult_PrivateRouteCreationErrorZ self; +public: + CResult_PrivateRouteCreationErrorZ(const CResult_PrivateRouteCreationErrorZ&) = delete; + CResult_PrivateRouteCreationErrorZ(CResult_PrivateRouteCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); } + CResult_PrivateRouteCreationErrorZ(LDKCResult_PrivateRouteCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); } + operator LDKCResult_PrivateRouteCreationErrorZ() && { LDKCResult_PrivateRouteCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); return res; } + ~CResult_PrivateRouteCreationErrorZ() { CResult_PrivateRouteCreationErrorZ_free(self); } + CResult_PrivateRouteCreationErrorZ& operator=(CResult_PrivateRouteCreationErrorZ&& o) { CResult_PrivateRouteCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); return *this; } + LDKCResult_PrivateRouteCreationErrorZ* operator &() { return &self; } + LDKCResult_PrivateRouteCreationErrorZ* operator ->() { return &self; } + const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; } + const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; } +}; class CResult_boolPeerHandleErrorZ { private: LDKCResult_boolPeerHandleErrorZ self; @@ -6457,7 +6585,7 @@ inline LDK::CResult_NoneLightningErrorZ RoutingMessageHandler::handle_query_shor LDK::CResult_NoneLightningErrorZ ret = (self.handle_query_short_channel_ids)(self.this_arg, their_node_id, msg); return ret; } -inline void Logger::log(const char *record) { +inline void Logger::log(const struct LDKRecord *NONNULL_PTR record) { (self.log)(self.this_arg, record); } inline LDK::CResult_NoneChannelMonitorUpdateErrZ Persist::persist_new_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id) { diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index 6943888..68ca65a 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -39,6 +39,11 @@ pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SecretKeyErrorZ. pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { } @@ -113,6 +118,11 @@ pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PublicKeyErrorZ. pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { } @@ -204,6 +214,11 @@ pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } @@ -295,6 +310,11 @@ pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { } @@ -386,6 +406,11 @@ pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1E result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TxCreationKeysErrorZ. pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { } @@ -514,6 +539,11 @@ pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::light result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } @@ -605,6 +635,11 @@ pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_e result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { } @@ -696,6 +731,11 @@ pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { } @@ -833,6 +873,11 @@ pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { } @@ -924,6 +969,11 @@ pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::l result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { } @@ -1014,6 +1064,11 @@ pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_Truste result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { } @@ -1085,6 +1140,11 @@ pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightn result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { } @@ -1175,6 +1235,11 @@ pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_Tru result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { } @@ -1245,6 +1310,11 @@ pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZN result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CVec_SignatureZNoneZ. pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { } @@ -1333,6 +1403,11 @@ pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { } @@ -1424,6 +1499,11 @@ pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lig result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { } @@ -1497,6 +1577,11 @@ pub extern "C" fn CResult_NoneErrorZ_err(e: crate::c_types::IOError) -> CResult_ result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneErrorZ_is_ok(o: &CResult_NoneErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneErrorZ. pub extern "C" fn CResult_NoneErrorZ_free(_res: CResult_NoneErrorZ) { } @@ -1585,6 +1670,11 @@ pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteHopDecodeErrorZ. pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { } @@ -1768,6 +1858,11 @@ pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::D result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteDecodeErrorZ. pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { } @@ -1859,6 +1954,11 @@ pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::l result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteParametersDecodeErrorZ. pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { } @@ -2033,6 +2133,11 @@ pub extern "C" fn CResult_PayeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::D result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PayeeDecodeErrorZ_is_ok(o: &CResult_PayeeDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PayeeDecodeErrorZ. pub extern "C" fn CResult_PayeeDecodeErrorZ_free(_res: CResult_PayeeDecodeErrorZ) { } @@ -2170,6 +2275,11 @@ pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msg result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteHintDecodeErrorZ. pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { } @@ -2261,6 +2371,11 @@ pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { } @@ -2398,6 +2513,11 @@ pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RouteLightningErrorZ. pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { } @@ -2489,6 +2609,11 @@ pub extern "C" fn CResult_TxOutAccessErrorZ_err(e: crate::lightning::chain::Acce result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TxOutAccessErrorZ_is_ok(o: &CResult_TxOutAccessErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TxOutAccessErrorZ. pub extern "C" fn CResult_TxOutAccessErrorZ_free(_res: CResult_TxOutAccessErrorZ) { } @@ -2713,6 +2838,11 @@ pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_err(e: crate::lightning:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_is_ok(o: &CResult_NoneChannelMonitorUpdateErrZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. pub extern "C" fn CResult_NoneChannelMonitorUpdateErrZ_free(_res: CResult_NoneChannelMonitorUpdateErrZ) { } @@ -2845,6 +2975,139 @@ pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_free(_res: COption_C2Tuple_ pub extern "C" fn COption_C2Tuple_usizeTransactionZZ_clone(orig: &COption_C2Tuple_usizeTransactionZZ) -> COption_C2Tuple_usizeTransactionZZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::events::ClosureReason or not +pub enum COption_ClosureReasonZ { + /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason + Some(crate::lightning::util::events::ClosureReason), + /// When we're in this state, this COption_ClosureReasonZ contains nothing + None +} +impl COption_ClosureReasonZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::Some(_) = self { true } else { false } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::ClosureReason { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason +pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::util::events::ClosureReason) -> COption_ClosureReasonZ { + COption_ClosureReasonZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_ClosureReasonZ containing nothing +pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ { + COption_ClosureReasonZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state +pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { } +#[no_mangle] +/// Creates a new COption_ClosureReasonZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_ClosureReasonZDecodeErrorZ +pub union CResult_COption_ClosureReasonZDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::COption_ClosureReasonZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_COption_ClosureReasonZDecodeErrorZ { + /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr, + /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + 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_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { } +impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { + 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_ClosureReasonZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = std::ptr::null_mut() }; + CResult_COption_ClosureReasonZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = std::ptr::null_mut(); } + CResult_COption_ClosureReasonZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_ClosureReasonZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] /// An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not pub enum COption_NetworkUpdateZ { /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate @@ -2927,6 +3190,139 @@ impl Clone for CVec_SpendableOutputDescriptorZ { } } #[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::events::Event or not +pub enum COption_EventZ { + /// When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event + Some(crate::lightning::util::events::Event), + /// When we're in this state, this COption_EventZ contains nothing + None +} +impl COption_EventZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::Some(_) = self { true } else { false } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::util::events::Event { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_EventZ containing a crate::lightning::util::events::Event +pub extern "C" fn COption_EventZ_some(o: crate::lightning::util::events::Event) -> COption_EventZ { + COption_EventZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_EventZ containing nothing +pub extern "C" fn COption_EventZ_none() -> COption_EventZ { + COption_EventZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state +pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { } +#[no_mangle] +/// Creates a new COption_EventZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_EventZDecodeErrorZ +pub union CResult_COption_EventZDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::COption_EventZ, + /// A pointer to 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_EventZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_COption_EventZDecodeErrorZ { + /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_EventZDecodeErrorZPtr, + /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_EventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_EventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { + 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_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_EventZDecodeErrorZ. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { } +impl Drop for CResult_COption_EventZDecodeErrorZ { + 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_EventZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = std::ptr::null_mut() }; + CResult_COption_EventZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = std::ptr::null_mut(); } + CResult_COption_EventZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_EventZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_MessageSendEventZ { @@ -3013,6 +3409,11 @@ pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { } @@ -3087,6 +3488,11 @@ pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { } @@ -3161,6 +3567,11 @@ pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::l result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { } @@ -3235,6 +3646,11 @@ pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::l result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceFeaturesDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. pub extern "C" fn CResult_InvoiceFeaturesDecodeErrorZ_free(_res: CResult_InvoiceFeaturesDecodeErrorZ) { } @@ -3309,6 +3725,11 @@ pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_err(e: crate::lightning: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_is_ok(o: &CResult_ScoringParametersDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ScoringParametersDecodeErrorZ. pub extern "C" fn CResult_ScoringParametersDecodeErrorZ_free(_res: CResult_ScoringParametersDecodeErrorZ) { } @@ -3383,6 +3804,11 @@ pub extern "C" fn CResult_ScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ScorerDecodeErrorZ_is_ok(o: &CResult_ScorerDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ScorerDecodeErrorZ. pub extern "C" fn CResult_ScorerDecodeErrorZ_free(_res: CResult_ScorerDecodeErrorZ) { } @@ -3457,6 +3883,11 @@ pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crat result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { } @@ -3548,6 +3979,11 @@ pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { } @@ -3639,6 +4075,11 @@ pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::li result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { } @@ -3728,6 +4169,11 @@ pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ { result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneNoneZ. pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { } @@ -3854,6 +4300,11 @@ pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() -> CResul result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. pub extern "C" fn CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res: CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ) { } @@ -3941,6 +4392,11 @@ pub extern "C" fn CResult_SignatureNoneZ_err() -> CResult_SignatureNoneZ { result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SignatureNoneZ_is_ok(o: &CResult_SignatureNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SignatureNoneZ. pub extern "C" fn CResult_SignatureNoneZ_free(_res: CResult_SignatureNoneZ) { } @@ -4029,6 +4485,11 @@ pub extern "C" fn CResult_SignDecodeErrorZ_err(e: crate::lightning::ln::msgs::De result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SignDecodeErrorZ_is_ok(o: &CResult_SignDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SignDecodeErrorZ. pub extern "C" fn CResult_SignDecodeErrorZ_free(_res: CResult_SignDecodeErrorZ) { } @@ -4165,6 +4626,11 @@ pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_Recoverable result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RecoverableSignatureNoneZ. pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { } @@ -4298,6 +4764,11 @@ pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_err() -> CResult_CVec_CVec_u8ZZNon result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_is_ok(o: &CResult_CVec_CVec_u8ZZNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. pub extern "C" fn CResult_CVec_CVec_u8ZZNoneZ_free(_res: CResult_CVec_CVec_u8ZZNoneZ) { } @@ -4386,6 +4857,11 @@ pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { } @@ -4522,6 +4998,11 @@ pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_TransactionNoneZ. pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { } @@ -4678,6 +5159,11 @@ pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e: cr result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o: &CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. pub extern "C" fn CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res: CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ) { } @@ -4788,6 +5274,11 @@ pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::A result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneAPIErrorZ. pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { } @@ -4968,6 +5459,11 @@ pub extern "C" fn CResult__u832APIErrorZ_err(e: crate::lightning::util::errors:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult__u832APIErrorZ_is_ok(o: &CResult__u832APIErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult__u832APIErrorZ. pub extern "C" fn CResult__u832APIErrorZ_free(_res: CResult__u832APIErrorZ) { } @@ -5059,6 +5555,11 @@ pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { } @@ -5149,6 +5650,11 @@ pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::c result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NonePaymentSendFailureZ. pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { } @@ -5279,6 +5785,11 @@ pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. pub extern "C" fn CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ) { } @@ -5458,6 +5969,11 @@ pub extern "C" fn CResult_PaymentSecretAPIErrorZ_err(e: crate::lightning::util:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PaymentSecretAPIErrorZ_is_ok(o: &CResult_PaymentSecretAPIErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PaymentSecretAPIErrorZ. pub extern "C" fn CResult_PaymentSecretAPIErrorZ_free(_res: CResult_PaymentSecretAPIErrorZ) { } @@ -5617,6 +6133,11 @@ pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e: cr result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. pub extern "C" fn CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ) { } @@ -5691,6 +6212,11 @@ pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { } @@ -5782,6 +6308,11 @@ pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_OutPointDecodeErrorZ. pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { } @@ -5905,6 +6436,11 @@ pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { } @@ -5979,6 +6515,11 @@ pub extern "C" fn CResult_PaymentIdPaymentErrorZ_err(e: crate::lightning_invoice result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PaymentIdPaymentErrorZ_is_ok(o: &CResult_PaymentIdPaymentErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PaymentIdPaymentErrorZ. pub extern "C" fn CResult_PaymentIdPaymentErrorZ_free(_res: CResult_PaymentIdPaymentErrorZ) { } @@ -6069,6 +6610,11 @@ pub extern "C" fn CResult_SiPrefixNoneZ_err() -> CResult_SiPrefixNoneZ { result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SiPrefixNoneZ_is_ok(o: &CResult_SiPrefixNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SiPrefixNoneZ. pub extern "C" fn CResult_SiPrefixNoneZ_free(_res: CResult_SiPrefixNoneZ) { } @@ -6156,6 +6702,11 @@ pub extern "C" fn CResult_InvoiceNoneZ_err() -> CResult_InvoiceNoneZ { result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InvoiceNoneZ_is_ok(o: &CResult_InvoiceNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InvoiceNoneZ. pub extern "C" fn CResult_InvoiceNoneZ_free(_res: CResult_InvoiceNoneZ) { } @@ -6243,6 +6794,11 @@ pub extern "C" fn CResult_SignedRawInvoiceNoneZ_err() -> CResult_SignedRawInvoic result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SignedRawInvoiceNoneZ_is_ok(o: &CResult_SignedRawInvoiceNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_SignedRawInvoiceNoneZ. pub extern "C" fn CResult_SignedRawInvoiceNoneZ_free(_res: CResult_SignedRawInvoiceNoneZ) { } @@ -6377,6 +6933,11 @@ pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Erro result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PayeePubKeyErrorZ. pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { } @@ -6514,6 +7075,11 @@ pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightnin result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { } @@ -6604,6 +7170,11 @@ pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::Se result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneSemanticErrorZ. pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { } @@ -6692,6 +7263,11 @@ pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InvoiceSemanticErrorZ. pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { } @@ -6783,6 +7359,11 @@ pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invo result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_DescriptionCreationErrorZ. pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { } @@ -6874,6 +7455,11 @@ pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_err(e: crate::lightning_invoi result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_is_ok(o: &CResult_ExpiryTimeCreationErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ExpiryTimeCreationErrorZ. pub extern "C" fn CResult_ExpiryTimeCreationErrorZ_free(_res: CResult_ExpiryTimeCreationErrorZ) { } @@ -6965,6 +7551,11 @@ pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_inv result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PrivateRouteCreationErrorZ. pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { } @@ -7056,6 +7647,11 @@ pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_StringErrorZ. pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { } @@ -7130,6 +7726,11 @@ pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightni result_ok: false, } } +/// 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 +} #[no_mangle] /// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } @@ -7181,6 +7782,139 @@ impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not +pub enum COption_MonitorEventZ { + /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + Some(crate::lightning::chain::channelmonitor::MonitorEvent), + /// When we're in this state, this COption_MonitorEventZ contains nothing + None +} +impl COption_MonitorEventZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::Some(_) = self { true } else { false } + } + #[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::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_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, +} +#[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, + } +} +#[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, + } +} +/// 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 +} +#[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 { + 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_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 = std::ptr::null_mut() }; + CResult_COption_MonitorEventZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = std::ptr::null_mut(); } + CResult_COption_MonitorEventZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_MonitorEventZDecodeErrorZ { + 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 }))) + } } + } + } +} +#[no_mangle] +/// 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_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// The contents of CResult_HTLCUpdateDecodeErrorZ pub union CResult_HTLCUpdateDecodeErrorZPtr { /// A pointer to the contents in the success state. @@ -7221,6 +7955,11 @@ pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::ms result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } @@ -7311,6 +8050,11 @@ pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_err(e: crate::lightning::chain result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_is_ok(o: &CResult_NoneMonitorUpdateErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneMonitorUpdateErrorZ. pub extern "C" fn CResult_NoneMonitorUpdateErrorZ_free(_res: CResult_NoneMonitorUpdateErrorZ) { } @@ -7931,6 +8675,11 @@ pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: cr result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { } @@ -8004,6 +8753,11 @@ pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NoneLightningErrorZ. pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { } @@ -8160,6 +8914,11 @@ pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_boolLightningErrorZ. pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { } @@ -8435,6 +9194,11 @@ pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln:: 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) { } @@ -8525,6 +9289,11 @@ pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer 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) { } @@ -8613,6 +9382,11 @@ pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_boolPeerHandleErrorZ. pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { } @@ -8704,6 +9478,11 @@ pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NodeIdDecodeErrorZ. pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { } @@ -8755,6 +9534,102 @@ impl Clone for CResult_NodeIdDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ +pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_COption_NetworkUpdateZDecodeErrorZ { + /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr, + /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + 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_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { } +impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { + 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_NetworkUpdateZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = std::ptr::null_mut() }; + CResult_COption_NetworkUpdateZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = std::ptr::null_mut(); } + CResult_COption_NetworkUpdateZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_NetworkUpdateZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// An enum which can either contain a crate::lightning::chain::Access or not pub enum COption_AccessZ { /// When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access @@ -8827,6 +9702,11 @@ pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_err(e: crate::light result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o: &CResult_DirectionalChannelInfoDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ. pub extern "C" fn CResult_DirectionalChannelInfoDecodeErrorZ_free(_res: CResult_DirectionalChannelInfoDecodeErrorZ) { } @@ -8918,6 +9798,11 @@ pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::m result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { } @@ -9009,6 +9894,11 @@ pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::m result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { } @@ -9100,6 +9990,11 @@ pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightni result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { } @@ -9237,6 +10132,11 @@ pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NodeInfoDecodeErrorZ. pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { } @@ -9328,6 +10228,11 @@ pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { } @@ -9456,6 +10361,11 @@ pub extern "C" fn CResult_NetAddressDecodeErrorZ_err(e: crate::lightning::ln::ms result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NetAddressDecodeErrorZ_is_ok(o: &CResult_NetAddressDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NetAddressDecodeErrorZ. pub extern "C" fn CResult_NetAddressDecodeErrorZ_free(_res: CResult_NetAddressDecodeErrorZ) { } @@ -9731,6 +10641,11 @@ pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { } @@ -9822,6 +10737,11 @@ pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::light result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { } @@ -9913,6 +10833,11 @@ pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { } @@ -10004,6 +10929,11 @@ pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { } @@ -10095,6 +11025,11 @@ pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightn result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } @@ -10186,6 +11121,11 @@ pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning:: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { } @@ -10277,6 +11217,11 @@ pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { } @@ -10368,6 +11313,11 @@ pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_FundingSignedDecodeErrorZ. pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { } @@ -10459,6 +11409,11 @@ pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_FundingLockedDecodeErrorZ. pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { } @@ -10550,6 +11505,11 @@ pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::De result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InitDecodeErrorZ. pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { } @@ -10641,6 +11601,11 @@ pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::m result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_OpenChannelDecodeErrorZ. pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { } @@ -10732,6 +11697,11 @@ pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { } @@ -10823,6 +11793,11 @@ pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ShutdownDecodeErrorZ. pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { } @@ -10914,6 +11889,11 @@ pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { } @@ -11005,6 +11985,11 @@ pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ligh result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { } @@ -11096,6 +12081,11 @@ pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msg result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { } @@ -11187,6 +12177,11 @@ pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { } @@ -11278,6 +12273,11 @@ pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { } @@ -11369,6 +12369,11 @@ pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::De result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PingDecodeErrorZ. pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { } @@ -11460,6 +12465,11 @@ pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::De result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_PongDecodeErrorZ. pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { } @@ -11551,6 +12561,11 @@ pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate:: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { } @@ -11642,6 +12657,11 @@ pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightnin result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { } @@ -11733,6 +12753,11 @@ pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightn result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { } @@ -11824,6 +12849,11 @@ pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { } @@ -11915,6 +12945,11 @@ pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln:: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { } @@ -12006,6 +13041,11 @@ pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lig result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { } @@ -12097,6 +13137,11 @@ pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning:: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { } @@ -12188,6 +13233,11 @@ pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightni result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { } @@ -12279,6 +13329,11 @@ pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ligh result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { } @@ -12370,6 +13425,11 @@ pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { } @@ -12461,6 +13521,11 @@ pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning: result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { } @@ -12552,6 +13617,11 @@ pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightn result_ok: false, } } +/// 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 { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { } @@ -12643,6 +13713,11 @@ pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_err(e: crate::lightning_in result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_InvoiceSignOrCreationErrorZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ. pub extern "C" fn CResult_InvoiceSignOrCreationErrorZ_free(_res: CResult_InvoiceSignOrCreationErrorZ) { } @@ -12765,6 +13840,11 @@ pub extern "C" fn CResult_LockedChannelMonitorNoneZ_err() -> CResult_LockedChann result_ok: false, } } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_LockedChannelMonitorNoneZ_is_ok(o: &CResult_LockedChannelMonitorNoneZ) -> bool { + o.result_ok +} #[no_mangle] /// Frees any resources used by the CResult_LockedChannelMonitorNoneZ. pub extern "C" fn CResult_LockedChannelMonitorNoneZ_free(_res: CResult_LockedChannelMonitorNoneZ) { } diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index dcf6d13..a55bee5 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -149,7 +149,7 @@ pub(crate) extern "C" fn ChannelMonitorUpdate_write_void(obj: *const c_void) -> #[no_mangle] /// Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write pub extern "C" fn ChannelMonitorUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelMonitorUpdateDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::channelmonitor::ChannelMonitorUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -426,6 +426,13 @@ pub extern "C" fn MonitorEvent_update_failed(a: crate::lightning::chain::transac pub extern "C" fn MonitorEvent_write(obj: &MonitorEvent) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } +#[no_mangle] +/// Read a MonitorEvent from a byte array, created by MonitorEvent_write +pub extern "C" fn MonitorEvent_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_MonitorEventZDecodeErrorZ { + 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_MonitorEventZ::None } else { crate::c_types::derived::COption_MonitorEventZ::Some( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_res +} use lightning::chain::channelmonitor::HTLCUpdate as nativeHTLCUpdateImport; pub(crate) type nativeHTLCUpdate = nativeHTLCUpdateImport; @@ -510,7 +517,7 @@ pub(crate) extern "C" fn HTLCUpdate_write_void(obj: *const c_void) -> crate::c_t #[no_mangle] /// Read a HTLCUpdate from a byte array, created by HTLCUpdate_write pub extern "C" fn HTLCUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCUpdateDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/chain/keysinterface.rs b/lightning-c-bindings/src/lightning/chain/keysinterface.rs index ca5d47e..360d33e 100644 --- a/lightning-c-bindings/src/lightning/chain/keysinterface.rs +++ b/lightning-c-bindings/src/lightning/chain/keysinterface.rs @@ -192,7 +192,7 @@ pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_write_void(obj: *const c #[no_mangle] /// Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write pub extern "C" fn DelayedPaymentOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::keysinterface::DelayedPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -332,7 +332,7 @@ pub(crate) extern "C" fn StaticPaymentOutputDescriptor_write_void(obj: *const c_ #[no_mangle] /// Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write pub extern "C" fn StaticPaymentOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::keysinterface::StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -523,7 +523,7 @@ pub extern "C" fn SpendableOutputDescriptor_write(obj: &SpendableOutputDescripto #[no_mangle] /// Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SpendableOutputDescriptorDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::keysinterface::SpendableOutputDescriptor::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1491,7 +1491,7 @@ pub(crate) extern "C" fn InMemorySigner_write_void(obj: *const c_void) -> crate: #[no_mangle] /// Read a InMemorySigner from a byte array, created by InMemorySigner_write pub extern "C" fn InMemorySigner_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InMemorySignerDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index bc59dd0..59cf6d1 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -157,7 +157,7 @@ pub(crate) extern "C" fn OutPoint_write_void(obj: *const c_void) -> crate::c_typ #[no_mangle] /// Read a OutPoint from a byte array, created by OutPoint_write pub extern "C" fn OutPoint_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OutPointDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index 8228a8a..519744c 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -251,7 +251,7 @@ pub(crate) extern "C" fn TxCreationKeys_write_void(obj: *const c_void) -> crate: #[no_mangle] /// Read a TxCreationKeys from a byte array, created by TxCreationKeys_write pub extern "C" fn TxCreationKeys_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_TxCreationKeysDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -422,7 +422,7 @@ pub(crate) extern "C" fn ChannelPublicKeys_write_void(obj: *const c_void) -> cra #[no_mangle] /// Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write pub extern "C" fn ChannelPublicKeys_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelPublicKeysDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::ChannelPublicKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -623,7 +623,7 @@ pub(crate) extern "C" fn HTLCOutputInCommitment_write_void(obj: *const c_void) - #[no_mangle] /// Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write pub extern "C" fn HTLCOutputInCommitment_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCOutputInCommitmentDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::HTLCOutputInCommitment { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -958,7 +958,7 @@ pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_write_void(obj #[no_mangle] /// Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write pub extern "C" fn CounterpartyChannelTransactionParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::CounterpartyChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -974,7 +974,7 @@ pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_v #[no_mangle] /// Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTransactionParametersDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::ChannelTransactionParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1178,7 +1178,7 @@ pub(crate) extern "C" fn HolderCommitmentTransaction_write_void(obj: *const c_vo #[no_mangle] /// Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write pub extern "C" fn HolderCommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HolderCommitmentTransactionDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::HolderCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1311,7 +1311,7 @@ pub(crate) extern "C" fn BuiltCommitmentTransaction_write_void(obj: *const c_voi #[no_mangle] /// Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write pub extern "C" fn BuiltCommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BuiltCommitmentTransactionDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::BuiltCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1626,7 +1626,7 @@ pub(crate) extern "C" fn CommitmentTransaction_write_void(obj: *const c_void) -> #[no_mangle] /// Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write pub extern "C" fn CommitmentTransaction_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentTransactionDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs index 7bee3b0..591173e 100644 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ b/lightning-c-bindings/src/lightning/ln/features.rs @@ -515,28 +515,28 @@ pub(crate) extern "C" fn InvoiceFeatures_write_void(obj: *const c_void) -> crate #[no_mangle] /// Read a InitFeatures from a byte array, created by InitFeatures_write pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InitFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } #[no_mangle] /// Read a NodeFeatures from a byte array, created by NodeFeatures_write pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::NodeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } #[no_mangle] /// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } #[no_mangle] /// Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write pub extern "C" fn InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceFeaturesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index 8c20bdd..62bfae5 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -2979,7 +2979,7 @@ pub extern "C" fn NetAddress_write(obj: &NetAddress) -> crate::c_types::derived: #[no_mangle] /// Read a NetAddress from a byte array, created by NetAddress_write pub extern "C" fn NetAddress_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetAddressDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::NetAddress::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5141,7 +5141,7 @@ pub(crate) extern "C" fn AcceptChannel_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a AcceptChannel from a byte array, created by AcceptChannel_write pub extern "C" fn AcceptChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AcceptChannelDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::AcceptChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5157,7 +5157,7 @@ pub(crate) extern "C" fn AnnouncementSignatures_write_void(obj: *const c_void) - #[no_mangle] /// Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write pub extern "C" fn AnnouncementSignatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AnnouncementSignaturesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5173,7 +5173,7 @@ pub(crate) extern "C" fn ChannelReestablish_write_void(obj: *const c_void) -> cr #[no_mangle] /// Read a ChannelReestablish from a byte array, created by ChannelReestablish_write pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelReestablishDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5189,7 +5189,7 @@ pub(crate) extern "C" fn ClosingSigned_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a ClosingSigned from a byte array, created by ClosingSigned_write pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ClosingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5205,7 +5205,7 @@ pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) -> #[no_mangle] /// Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedFeeRangeDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ClosingSignedFeeRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5221,7 +5221,7 @@ pub(crate) extern "C" fn CommitmentSigned_write_void(obj: *const c_void) -> crat #[no_mangle] /// Read a CommitmentSigned from a byte array, created by CommitmentSigned_write pub extern "C" fn CommitmentSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::CommitmentSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5237,7 +5237,7 @@ pub(crate) extern "C" fn FundingCreated_write_void(obj: *const c_void) -> crate: #[no_mangle] /// Read a FundingCreated from a byte array, created by FundingCreated_write pub extern "C" fn FundingCreated_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingCreatedDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::FundingCreated { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5253,7 +5253,7 @@ pub(crate) extern "C" fn FundingSigned_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a FundingSigned from a byte array, created by FundingSigned_write pub extern "C" fn FundingSigned_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingSignedDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::FundingSigned { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5269,7 +5269,7 @@ pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a FundingLocked from a byte array, created by FundingLocked_write pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::FundingLocked { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5285,7 +5285,7 @@ pub(crate) extern "C" fn Init_write_void(obj: *const c_void) -> crate::c_types:: #[no_mangle] /// Read a Init from a byte array, created by Init_write pub extern "C" fn Init_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::Init { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5301,7 +5301,7 @@ pub(crate) extern "C" fn OpenChannel_write_void(obj: *const c_void) -> crate::c_ #[no_mangle] /// Read a OpenChannel from a byte array, created by OpenChannel_write pub extern "C" fn OpenChannel_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OpenChannelDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::OpenChannel { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5317,7 +5317,7 @@ pub(crate) extern "C" fn RevokeAndACK_write_void(obj: *const c_void) -> crate::c #[no_mangle] /// Read a RevokeAndACK from a byte array, created by RevokeAndACK_write pub extern "C" fn RevokeAndACK_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RevokeAndACKDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5333,7 +5333,7 @@ pub(crate) extern "C" fn Shutdown_write_void(obj: *const c_void) -> crate::c_typ #[no_mangle] /// Read a Shutdown from a byte array, created by Shutdown_write pub extern "C" fn Shutdown_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::Shutdown { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5349,7 +5349,7 @@ pub(crate) extern "C" fn UpdateFailHTLC_write_void(obj: *const c_void) -> crate: #[no_mangle] /// Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write pub extern "C" fn UpdateFailHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailHTLCDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UpdateFailHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5365,7 +5365,7 @@ pub(crate) extern "C" fn UpdateFailMalformedHTLC_write_void(obj: *const c_void) #[no_mangle] /// Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write pub extern "C" fn UpdateFailMalformedHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFailMalformedHTLCDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UpdateFailMalformedHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5381,7 +5381,7 @@ pub(crate) extern "C" fn UpdateFee_write_void(obj: *const c_void) -> crate::c_ty #[no_mangle] /// Read a UpdateFee from a byte array, created by UpdateFee_write pub extern "C" fn UpdateFee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFeeDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UpdateFee { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5397,7 +5397,7 @@ pub(crate) extern "C" fn UpdateFulfillHTLC_write_void(obj: *const c_void) -> cra #[no_mangle] /// Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateFulfillHTLCDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UpdateFulfillHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5413,7 +5413,7 @@ pub(crate) extern "C" fn UpdateAddHTLC_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write pub extern "C" fn UpdateAddHTLC_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UpdateAddHTLCDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UpdateAddHTLC { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5429,7 +5429,7 @@ pub(crate) extern "C" fn Ping_write_void(obj: *const c_void) -> crate::c_types:: #[no_mangle] /// Read a Ping from a byte array, created by Ping_write pub extern "C" fn Ping_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PingDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::Ping { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5445,7 +5445,7 @@ pub(crate) extern "C" fn Pong_write_void(obj: *const c_void) -> crate::c_types:: #[no_mangle] /// Read a Pong from a byte array, created by Pong_write pub extern "C" fn Pong_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PongDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::Pong { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5461,7 +5461,7 @@ pub(crate) extern "C" fn UnsignedChannelAnnouncement_write_void(obj: *const c_vo #[no_mangle] /// Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write pub extern "C" fn UnsignedChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelAnnouncementDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5477,7 +5477,7 @@ pub(crate) extern "C" fn ChannelAnnouncement_write_void(obj: *const c_void) -> c #[no_mangle] /// Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write pub extern "C" fn ChannelAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelAnnouncementDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5493,7 +5493,7 @@ pub(crate) extern "C" fn UnsignedChannelUpdate_write_void(obj: *const c_void) -> #[no_mangle] /// Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write pub extern "C" fn UnsignedChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedChannelUpdateDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5509,7 +5509,7 @@ pub(crate) extern "C" fn ChannelUpdate_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a ChannelUpdate from a byte array, created by ChannelUpdate_write pub extern "C" fn ChannelUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelUpdateDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5525,7 +5525,7 @@ pub(crate) extern "C" fn ErrorMessage_write_void(obj: *const c_void) -> crate::c #[no_mangle] /// Read a ErrorMessage from a byte array, created by ErrorMessage_write pub extern "C" fn ErrorMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ErrorMessageDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ErrorMessage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5541,7 +5541,7 @@ pub(crate) extern "C" fn UnsignedNodeAnnouncement_write_void(obj: *const c_void) #[no_mangle] /// Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write pub extern "C" fn UnsignedNodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnsignedNodeAnnouncementDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5557,14 +5557,14 @@ pub(crate) extern "C" fn NodeAnnouncement_write_void(obj: *const c_void) -> crat #[no_mangle] /// Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write pub extern "C" fn NodeAnnouncement_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } #[no_mangle] /// Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write pub extern "C" fn QueryShortChannelIds_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryShortChannelIdsDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5589,7 +5589,7 @@ pub(crate) extern "C" fn ReplyShortChannelIdsEnd_write_void(obj: *const c_void) #[no_mangle] /// Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write pub extern "C" fn ReplyShortChannelIdsEnd_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyShortChannelIdsEndDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5613,14 +5613,14 @@ pub(crate) extern "C" fn QueryChannelRange_write_void(obj: *const c_void) -> cra #[no_mangle] /// Read a QueryChannelRange from a byte array, created by QueryChannelRange_write pub extern "C" fn QueryChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_QueryChannelRangeDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } #[no_mangle] /// Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write pub extern "C" fn ReplyChannelRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ReplyChannelRangeDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -5645,7 +5645,7 @@ pub(crate) extern "C" fn GossipTimestampFilter_write_void(obj: *const c_void) -> #[no_mangle] /// Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write pub extern "C" fn GossipTimestampFilter_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_GossipTimestampFilterDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index 0cac956..f40f364 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -172,7 +172,7 @@ pub(crate) extern "C" fn ShutdownScript_write_void(obj: *const c_void) -> crate: #[no_mangle] /// Read a ShutdownScript from a byte array, created by ShutdownScript_write pub extern "C" fn ShutdownScript_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ShutdownScriptDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::script::ShutdownScript { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/routing/network_graph.rs b/lightning-c-bindings/src/lightning/routing/network_graph.rs index 2f939ba..9c7e3e3 100644 --- a/lightning-c-bindings/src/lightning/routing/network_graph.rs +++ b/lightning-c-bindings/src/lightning/routing/network_graph.rs @@ -123,7 +123,7 @@ pub(crate) extern "C" fn NodeId_write_void(obj: *const c_void) -> crate::c_types #[no_mangle] /// Read a NodeId from a byte array, created by NodeId_write pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeIdDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -418,6 +418,13 @@ pub extern "C" fn NetworkUpdate_node_failure(node_id: crate::c_types::PublicKey, pub extern "C" fn NetworkUpdate_write(obj: &NetworkUpdate) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } +#[no_mangle] +/// Read a NetworkUpdate from a byte array, created by NetworkUpdate_write +pub extern "C" fn NetworkUpdate_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_NetworkUpdateZDecodeErrorZ { + 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_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::network_graph::NetworkUpdate::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_res +} impl From for crate::lightning::util::events::EventHandler { fn from(obj: nativeNetGraphMsgHandler) -> Self { let mut rust_obj = NetGraphMsgHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -837,7 +844,7 @@ pub(crate) extern "C" fn DirectionalChannelInfo_write_void(obj: *const c_void) - #[no_mangle] /// Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write pub extern "C" fn DirectionalChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DirectionalChannelInfoDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::DirectionalChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1045,7 +1052,7 @@ pub(crate) extern "C" fn ChannelInfo_write_void(obj: *const c_void) -> crate::c_ #[no_mangle] /// Read a ChannelInfo from a byte array, created by ChannelInfo_write pub extern "C" fn ChannelInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelInfoDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::ChannelInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1183,7 +1190,7 @@ pub(crate) extern "C" fn RoutingFees_write_void(obj: *const c_void) -> crate::c_ #[no_mangle] /// Read a RoutingFees from a byte array, created by RoutingFees_write pub extern "C" fn RoutingFees_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RoutingFeesDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::RoutingFees { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1363,7 +1370,7 @@ pub(crate) extern "C" fn NodeAnnouncementInfo_write_void(obj: *const c_void) -> #[no_mangle] /// Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write pub extern "C" fn NodeAnnouncementInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeAnnouncementInfoDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeAnnouncementInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1510,7 +1517,7 @@ pub(crate) extern "C" fn NodeInfo_write_void(obj: *const c_void) -> crate::c_typ #[no_mangle] /// Read a NodeInfo from a byte array, created by NodeInfo_write pub extern "C" fn NodeInfo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeInfoDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NodeInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1526,7 +1533,7 @@ pub(crate) extern "C" fn NetworkGraph_write_void(obj: *const c_void) -> crate::c #[no_mangle] /// Read a NetworkGraph from a byte array, created by NetworkGraph_write pub extern "C" fn NetworkGraph_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NetworkGraphDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::network_graph::NetworkGraph { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index 04be1c5..6f8692a 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -207,7 +207,7 @@ pub(crate) extern "C" fn RouteHop_write_void(obj: *const c_void) -> crate::c_typ #[no_mangle] /// Read a RouteHop from a byte array, created by RouteHop_write pub extern "C" fn RouteHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHopDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -391,7 +391,7 @@ pub(crate) extern "C" fn Route_write_void(obj: *const c_void) -> crate::c_types: #[no_mangle] /// Read a Route from a byte array, created by Route_write pub extern "C" fn Route_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -525,7 +525,7 @@ pub(crate) extern "C" fn RouteParameters_write_void(obj: *const c_void) -> crate #[no_mangle] /// Read a RouteParameters from a byte array, created by RouteParameters_write pub extern "C" fn RouteParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteParametersDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -708,7 +708,7 @@ pub(crate) extern "C" fn Payee_write_void(obj: *const c_void) -> crate::c_types: #[no_mangle] /// Read a Payee from a byte array, created by Payee_write pub extern "C" fn Payee_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PayeeDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Payee { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -849,7 +849,7 @@ pub(crate) extern "C" fn RouteHint_write_void(obj: *const c_void) -> crate::c_ty #[no_mangle] /// Read a RouteHint from a byte array, created by RouteHint_write pub extern "C" fn RouteHint_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHintDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHint { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -1039,7 +1039,7 @@ pub(crate) extern "C" fn RouteHintHop_write_void(obj: *const c_void) -> crate::c #[no_mangle] /// Read a RouteHintHop from a byte array, created by RouteHintHop_write pub extern "C" fn RouteHintHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteHintHopDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::RouteHintHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/routing/scorer.rs b/lightning-c-bindings/src/lightning/routing/scorer.rs index 29bb05d..00dd4ab 100644 --- a/lightning-c-bindings/src/lightning/routing/scorer.rs +++ b/lightning-c-bindings/src/lightning/routing/scorer.rs @@ -256,7 +256,7 @@ pub(crate) extern "C" fn ScoringParameters_write_void(obj: *const c_void) -> cra #[no_mangle] /// Read a ScoringParameters from a byte array, created by ScoringParameters_write pub extern "C" fn ScoringParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScoringParametersDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::ScoringParameters { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } @@ -325,7 +325,7 @@ pub(crate) extern "C" fn Scorer_write_void(obj: *const c_void) -> crate::c_types #[no_mangle] /// Read a Scorer from a byte array, created by Scorer_write pub extern "C" fn Scorer_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ScorerDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + let res: Result = crate::c_types::deserialize_obj(ser); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::scorer::Scorer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index 180a8fb..dd2dc3d 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -799,7 +799,7 @@ pub(crate) extern "C" fn ChannelConfig_write_void(obj: *const c_void) -> crate:: #[no_mangle] /// Read a ChannelConfig from a byte array, created by ChannelConfig_write pub extern "C" fn ChannelConfig_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelConfigDecodeErrorZ { - let res = crate::c_types::deserialize_obj(ser); + 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::util::config::ChannelConfig { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/util/events.rs b/lightning-c-bindings/src/lightning/util/events.rs index 6baa8b2..a507a9e 100644 --- a/lightning-c-bindings/src/lightning/util/events.rs +++ b/lightning-c-bindings/src/lightning/util/events.rs @@ -343,6 +343,13 @@ pub extern "C" fn ClosureReason_outdated_channel_manager() -> ClosureReason { pub extern "C" fn ClosureReason_write(obj: &ClosureReason) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } +#[no_mangle] +/// Read a ClosureReason from a byte array, created by ClosureReason_write +pub extern "C" fn ClosureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_ClosureReasonZDecodeErrorZ { + 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_ClosureReasonZ::None } else { crate::c_types::derived::COption_ClosureReasonZ::Some( { crate::lightning::util::events::ClosureReason::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_res +} /// 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 @@ -999,6 +1006,13 @@ pub extern "C" fn Event_discard_funding(channel_id: crate::c_types::ThirtyTwoByt pub extern "C" fn Event_write(obj: &Event) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } +#[no_mangle] +/// Read a Event from a byte array, created by Event_write +pub extern "C" fn Event_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_EventZDecodeErrorZ { + 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_EventZ::None } else { crate::c_types::derived::COption_EventZ::Some( { crate::lightning::util::events::Event::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_res +} /// An event generated by ChannelManager which indicates a message should be sent to a peer (or /// broadcast to most peers). /// These events are handled by PeerManager::process_events if you are using a PeerManager. diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index 7aa67a2..b4d7c1a 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -126,6 +126,132 @@ pub extern "C" fn Level_max() -> crate::lightning::util::logger::Level { crate::lightning::util::logger::Level::native_into(ret) } + +use lightning::util::logger::Record as nativeRecordImport; +pub(crate) type nativeRecord = nativeRecordImport<'static>; + +/// A Record, unit of logging output with Metadata to enable filtering +/// Module_path, file, line to inform on log's source +#[must_use] +#[repr(C)] +pub struct Record { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, inner must be non-null, however in places where + /// the Rust equivalent takes an Option, it may be set to null to indicate None. + pub inner: *mut nativeRecord, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 Record { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeRecord>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the Record, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn Record_free(this_obj: Record) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Record_free_void(this_ptr: *mut c_void) { + unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRecord); } +} +#[allow(unused)] +impl Record { + pub(crate) fn get_native_ref(&self) -> &'static nativeRecord { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRecord { + 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 nativeRecord { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = std::ptr::null_mut(); + ret + } +} +/// The verbosity level of the message. +#[no_mangle] +pub extern "C" fn Record_get_level(this_ptr: &Record) -> crate::lightning::util::logger::Level { + let mut inner_val = &mut this_ptr.get_native_mut_ref().level; + crate::lightning::util::logger::Level::from_native(inner_val) +} +/// The verbosity level of the message. +#[no_mangle] +pub extern "C" fn Record_set_level(this_ptr: &mut Record, mut val: crate::lightning::util::logger::Level) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.level = val.into_native(); +} +/// The message body. +#[no_mangle] +pub extern "C" fn Record_get_args(this_ptr: &Record) -> crate::c_types::Str { + let mut inner_val = &mut this_ptr.get_native_mut_ref().args; + inner_val.as_str().into() +} +/// The message body. +#[no_mangle] +pub extern "C" fn Record_set_args(this_ptr: &mut Record, mut val: crate::c_types::Str) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.args = val.into_string(); +} +/// The module path of the message. +#[no_mangle] +pub extern "C" fn Record_get_module_path(this_ptr: &Record) -> crate::c_types::Str { + let mut inner_val = &mut this_ptr.get_native_mut_ref().module_path; + inner_val.into() +} +/// The module path of the message. +#[no_mangle] +pub extern "C" fn Record_set_module_path(this_ptr: &mut Record, mut val: crate::c_types::Str) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.module_path = val.into_str(); +} +/// The source file containing the message. +#[no_mangle] +pub extern "C" fn Record_get_file(this_ptr: &Record) -> crate::c_types::Str { + let mut inner_val = &mut this_ptr.get_native_mut_ref().file; + inner_val.into() +} +/// The source file containing the message. +#[no_mangle] +pub extern "C" fn Record_set_file(this_ptr: &mut Record, mut val: crate::c_types::Str) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.file = val.into_str(); +} +/// The line containing the message. +#[no_mangle] +pub extern "C" fn Record_get_line(this_ptr: &Record) -> u32 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().line; + *inner_val +} +/// The line containing the message. +#[no_mangle] +pub extern "C" fn Record_set_line(this_ptr: &mut Record, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.line = val; +} +impl Clone for Record { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeRecord>::is_null(self.inner) { std::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 Record_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeRecord)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the Record +pub extern "C" fn Record_clone(orig: &Record) -> Record { + orig.clone() +} /// A trait encapsulating the operations required of a logger #[repr(C)] pub struct Logger { @@ -133,7 +259,7 @@ pub struct Logger { /// This has no meaning in the LDK, and can be NULL or any other value. pub this_arg: *mut c_void, /// Logs the `Record` - pub log: extern "C" fn (this_arg: *const c_void, record: *const std::os::raw::c_char), + pub log: extern "C" fn (this_arg: *const c_void, record: &crate::lightning::util::logger::Record), /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, @@ -152,8 +278,7 @@ pub(crate) extern "C" fn Logger_clone_fields(orig: &Logger) -> Logger { use lightning::util::logger::Logger as rustLogger; impl rustLogger for Logger { fn log(&self, mut record: &lightning::util::logger::Record) { - let mut local_record = std::ffi::CString::new(format!("{}", record.args)).unwrap(); - (self.log)(self.this_arg, local_record.as_ptr()) + (self.log)(self.this_arg, &crate::lightning::util::logger::Record { inner: unsafe { ObjOps::nonnull_ptr_to_inner((record as *const lightning::util::logger::Record<'_, >) as *mut _) }, is_owned: false }) } }