X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=090c0ee8417baca1e20c69697d7f6f031525bdc5;hb=a945b11d9f16864753054a47128d71a96de29f73;hp=a1b91e72ee07b855ceac0a4782c7f453a2ed3899;hpb=5271372bfe3ddc870c806f7b7ee13c4a7660e7e5;p=ldk-c-bindings 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