X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=7c5d88dda372d920c978b2ae6c5f1271db2f6d9c;hp=17abdfde4b89a3950abfc03f99e8d85365e08159;hb=dd5bf474af6c806b20c26f4f2b751f3226a94dfd;hpb=fee27c4b40d1d25609a38bb220dd64b297af929a diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 17abdfd..7c5d88d 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. */ @@ -28,6 +28,24 @@ typedef enum LDKAccessError { LDKAccessError_Sentinel, } LDKAccessError; +/** + * An enum which can either contain a or not + */ +typedef enum LDKCOption_NoneZ { + /** + * When we're in this state, this COption_NoneZ contains a + */ + LDKCOption_NoneZ_Some, + /** + * When we're in this state, this COption_NoneZ contains nothing + */ + LDKCOption_NoneZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NoneZ_Sentinel, +} LDKCOption_NoneZ; + /** * An error enum representing a failure to persist a channel monitor update. */ @@ -37,9 +55,10 @@ typedef enum LDKChannelMonitorUpdateErr { * our state failed, but is expected to succeed at some point in the future). * * Such a failure will \"freeze\" a channel, preventing us from revoking old states or - * submitting new commitment transactions to the counterparty. Once the update(s) which failed - * have been successfully applied, ChannelManager::channel_monitor_updated can be used to - * restore the channel to an operational state. + * submitting new commitment transactions to the counterparty. Once the update(s) that failed + * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned + * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an + * operational state. * * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If * you return a TemporaryFailure you must ensure that it is written to disk safely before @@ -53,13 +72,14 @@ typedef enum LDKChannelMonitorUpdateErr { * the channel which would invalidate previous ChannelMonitors are not made when a channel has * been \"frozen\". * - * Note that even if updates made after TemporaryFailure succeed you must still call - * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel - * operation. + * Note that even if updates made after TemporaryFailure succeed you must still provide a + * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable + * normal channel operation. Note that this is normally generated through a call to + * [`ChainMonitor::channel_monitor_updated`]. * - * Note that the update being processed here will not be replayed for you when you call - * ChannelManager::channel_monitor_updated, so you must store the update itself along - * with the persisted ChannelMonitor on your own local disk prior to returning a + * Note that the update being processed here will not be replayed for you when you return a + * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so + * you must store the update itself on your own local disk prior to returning a * TemporaryFailure. You may, of course, employ a journaling approach, storing only the * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at * reload-time. @@ -67,6 +87,8 @@ typedef enum LDKChannelMonitorUpdateErr { * For deployments where a copy of ChannelMonitors and other local state are backed up in a * remote location (with local copies persisted immediately), it is anticipated that all * updates will return TemporaryFailure until the remote copies could be updated. + * + * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated */ LDKChannelMonitorUpdateErr_TemporaryFailure, /** @@ -141,6 +163,10 @@ typedef enum LDKCreationError { * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp` */ LDKCreationError_ExpiryTimeOutOfBounds, + /** + * The supplied millisatoshi amount was greater than the total bitcoin supply. + */ + LDKCreationError_InvalidAmount, /** * Must be last for serialization purposes */ @@ -209,6 +235,10 @@ typedef enum LDKIOError { * An enum representing the available verbosity levels of the logger. */ typedef enum LDKLevel { + /** + * Designates extremely verbose information, including gossip-induced messages + */ + LDKLevel_Gossip, /** * Designates very low priority, often extremely verbose, information */ @@ -1529,6 +1559,100 @@ typedef struct LDKCResult_RouteDecodeErrorZ { bool result_ok; } LDKCResult_RouteDecodeErrorZ; + + +/** + * Parameters needed to find a [`Route`] for paying a [`Payee`]. + * + * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed + * payment path. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + */ +typedef struct MUST_USE_STRUCT LDKRouteParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteParameters *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; +} LDKRouteParameters; + +/** + * The contents of CResult_RouteParametersDecodeErrorZ + */ +typedef union LDKCResult_RouteParametersDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteParameters *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_RouteParametersDecodeErrorZPtr; + +/** + * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RouteParametersDecodeErrorZ { + /** + * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteParametersDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteParametersDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteParametersDecodeErrorZ; + + + +/** + * A list of hops along a payment path terminating with a channel to the recipient. + */ +typedef struct MUST_USE_STRUCT LDKRouteHint { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHint *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; +} LDKRouteHint; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHintZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKRouteHint *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_RouteHintZ; + /** * An enum which can either contain a u64 or not */ @@ -1559,74 +1683,193 @@ typedef struct LDKCOption_u64Z { /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * The recipient of a payment. */ -typedef struct MUST_USE_STRUCT LDKChannelDetails { +typedef struct MUST_USE_STRUCT LDKPayee { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelDetails *inner; + LDKnativePayee *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; -} LDKChannelDetails; +} LDKPayee; /** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. + * The contents of CResult_PayeeDecodeErrorZ + */ +typedef union LDKCResult_PayeeDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPayee *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_PayeeDecodeErrorZPtr; + +/** + * A CResult_PayeeDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Payee 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_PayeeDecodeErrorZ { + /** + * The contents of this CResult_PayeeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PayeeDecodeErrorZPtr contents; + /** + * Whether this CResult_PayeeDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PayeeDecodeErrorZ; + + + +/** + * A channel descriptor for a hop along a payment path. + */ +typedef struct MUST_USE_STRUCT LDKRouteHintHop { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHintHop *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; +} LDKRouteHintHop; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_ChannelDetailsZ { +typedef struct LDKCVec_RouteHintHopZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKChannelDetails *data; + struct LDKRouteHintHop *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_ChannelDetailsZ; +} LDKCVec_RouteHintHopZ; + +/** + * The contents of CResult_RouteHintDecodeErrorZ + */ +typedef union LDKCResult_RouteHintDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteHint *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_RouteHintDecodeErrorZPtr; + +/** + * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RouteHintDecodeErrorZ { + /** + * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteHintDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteHintDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteHintDecodeErrorZ; + +/** + * The contents of CResult_RouteHintHopDecodeErrorZ + */ +typedef union LDKCResult_RouteHintHopDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteHintHop *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_RouteHintHopDecodeErrorZPtr; + +/** + * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RouteHintHopDecodeErrorZ { + /** + * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteHintHopDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteHintHopDecodeErrorZ; /** - * A list of hops along a payment path terminating with a channel to the recipient. + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels */ -typedef struct MUST_USE_STRUCT LDKRouteHint { +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRouteHint *inner; + LDKnativeChannelDetails *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; -} LDKRouteHint; +} LDKChannelDetails; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_RouteHintZ { +typedef struct LDKCVec_ChannelDetailsZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKRouteHint *data; + struct LDKChannelDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_RouteHintZ; +} LDKCVec_ChannelDetailsZ; @@ -1860,12 +2103,41 @@ typedef enum LDKMonitorEvent_Tag { * A monitor event that the Channel's commitment transaction was confirmed. */ LDKMonitorEvent_CommitmentTxConfirmed, + /** + * Indicates a [`ChannelMonitor`] update has completed. See + * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure + */ + LDKMonitorEvent_UpdateCompleted, + /** + * Indicates a [`ChannelMonitor`] update has failed. See + * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure + */ + LDKMonitorEvent_UpdateFailed, /** * Must be last for serialization purposes */ LDKMonitorEvent_Sentinel, } LDKMonitorEvent_Tag; +typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body { + /** + * The funding outpoint of the [`ChannelMonitor`] that was updated + */ + struct LDKOutPoint funding_txo; + /** + * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or + * [`ChannelMonitor::get_latest_update_id`]. + * + * Note that this should only be set to a given update's ID if all previous updates for the + * same [`ChannelMonitor`] have been applied and persisted. + */ + uint64_t monitor_update_id; +} LDKMonitorEvent_LDKUpdateCompleted_Body; + typedef struct MUST_USE_STRUCT LDKMonitorEvent { LDKMonitorEvent_Tag tag; union { @@ -1875,6 +2147,10 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent { struct { struct LDKOutPoint commitment_tx_confirmed; }; + LDKMonitorEvent_LDKUpdateCompleted_Body update_completed; + struct { + struct LDKOutPoint update_failed; + }; }; } LDKMonitorEvent; @@ -1921,42 +2197,183 @@ typedef struct LDKCOption_C2Tuple_usizeTransactionZZ { }; } LDKCOption_C2Tuple_usizeTransactionZZ; - - /** - * A channel_update message to be sent or received from a peer + * The reason the channel was closed. See individual variants more details. */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef enum LDKClosureReason_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. + * Closure generated from receiving a peer error message. + * + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. */ - LDKnativeChannelUpdate *inner; + LDKClosureReason_CounterpartyForceClosed, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. */ - bool is_owned; -} LDKChannelUpdate; - -/** - * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion - * return packet by a node along the route. See [BOLT #4] for details. - * - * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md - */ -typedef enum LDKNetworkUpdate_Tag { + LDKClosureReason_HolderForceClosed, /** - * An error indicating a `channel_update` messages should be applied via - * [`NetworkGraph::update_channel`]. + * 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. */ - LDKNetworkUpdate_ChannelUpdateMessage, + LDKClosureReason_CooperativeClosure, /** - * An error indicating only that a channel has been closed, which should be applied via - * [`NetworkGraph::close_channel_from_update`]. - */ + * 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, + /** + * The funding transaction failed to confirm in a timely manner on an inbound channel. + */ + LDKClosureReason_FundingTimedOut, + /** + * 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; + + + +/** + * A channel_update message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelUpdate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelUpdate *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; +} LDKChannelUpdate; + +/** + * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion + * return packet by a node along the route. See [BOLT #4] for details. + * + * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md + */ +typedef enum LDKNetworkUpdate_Tag { + /** + * An error indicating a `channel_update` messages should be applied via + * [`NetworkGraph::update_channel`]. + */ + LDKNetworkUpdate_ChannelUpdateMessage, + /** + * An error indicating only that a channel has been closed, which should be applied via + * [`NetworkGraph::close_channel_from_update`]. + */ LDKNetworkUpdate_ChannelClosed, /** * An error indicating only that a node has failed, which should be applied via @@ -2181,722 +2598,1241 @@ 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; - - + LDKPaymentPurpose_SpontaneousPayment, + /** + * Must be last for serialization purposes + */ + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; -/** - * An open_channel message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKOpenChannel { +typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The preimage to the payment_hash, if the payment hash (and secret) were fetched via + * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to + * [`ChannelManager::claim_funds`]. + * + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKnativeOpenChannel *inner; + struct LDKThirtyTwoBytes payment_preimage; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 \"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 */ - bool is_owned; -} LDKOpenChannel; - + struct LDKThirtyTwoBytes payment_secret; +} 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_created 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 LDKFundingCreated { +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! + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - LDKnativeFundingCreated *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. + * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `PaymentReceived` events may be generated for the same payment. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards */ - bool is_owned; -} LDKFundingCreated; - - - -/** - * A funding_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingSigned { + 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. */ - LDKnativeFundingSigned *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 HTLC we sent failed. Probably some intermediary node dropped + * something. You may wish to retry with a different route. + * + * Note that this does *not* indicate that all paths for an MPP payment have failed, see + * [`Event::PaymentFailed`] and [`all_paths_failed`]. + * + * [`all_paths_failed`]: Self::all_paths_failed */ - bool is_owned; -} LDKFundingSigned; - - - -/** - * A funding_locked message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKFundingLocked { + 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. + * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events + * provide failure information for each MPP part in the payment. + * + * This event is provided once there are no further pending HTLCs for the payment and the + * payment is no longer retryable, either due to a several-block timeout or because + * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - LDKnativeFundingLocked *inner; + LDKEvent_PaymentFailed, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 [`ChannelManager::process_pending_htlc_forwards`] should be called at + * a time in the future. + * + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ - bool is_owned; -} LDKFundingLocked; - - - -/** - * An announcement_signatures message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { + LDKEvent_PendingHTLCsForwardable, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 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. */ - LDKnativeAnnouncementSignatures *inner; + LDKEvent_SpendableOutputs, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 event is generated when a payment has been successfully forwarded through us and a + * forwarding fee earned. */ - 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_PaymentForwarded, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 a channel with the given `channel_id` is in the process of closure. */ - LDKnativeCommitmentUpdate *inner; + LDKEvent_ChannelClosed, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 to the user that they can abandon the funding transaction and recycle the + * inputs for another purpose. */ - bool is_owned; -} LDKCommitmentUpdate; - - - -/** - * A revoke_and_ack message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKRevokeAndACK { + LDKEvent_DiscardFunding, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 that a path for an outbound payment was successful. + * + * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See + * [`Event::PaymentSent`] for obtaining the payment preimage. */ - LDKnativeRevokeAndACK *inner; + LDKEvent_PaymentPathSuccessful, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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. Note that LDK will + * not stop you from registering duplicate payment hashes for inbound payments. */ - 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 that 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 { - /** - * The peer took some action which made us think they were useless. Disconnect them. - */ - LDKErrorAction_DisconnectPeer, +typedef struct LDKEvent_LDKPaymentPathFailed_Body { /** - * The peer did something harmless that we weren't able to process, just log and ignore + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKErrorAction_IgnoreError, + struct LDKThirtyTwoBytes payment_id; /** - * The peer did something harmless that we weren't able to meaningfully process. - * If the error is logged, log it at the given level. + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKErrorAction_IgnoreAndLog, + struct LDKThirtyTwoBytes payment_hash; /** - * The peer did something incorrect. Tell them. + * 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_SendErrorMessage, + bool rejected_by_dest; /** - * Must be last for serialization purposes + * 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_Sentinel, -} LDKErrorAction_Tag; + struct LDKCOption_NetworkUpdateZ network_update; + /** + * 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. + * + * Note that if you are retrying individual MPP parts, using this value to determine if a + * payment has fully failed is race-y. Because multiple failures can happen prior to events + * being processed, you may retry in response to a first failure, with a second failure + * (with `all_paths_failed` set) still pending. Then, when the second failure is processed + * you will see `all_paths_failed` set even though the retry of the first failure still + * has an associated in-flight HTLC. See (1) for an example of such a failure. + * + * If you wish to retry individual MPP parts and learn when a payment has failed, you must + * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event. + * + * (1) + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + bool all_paths_failed; + /** + * 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 LDKRouteParameters retry; +} LDKEvent_LDKPaymentPathFailed_Body; -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { +typedef struct LDKEvent_LDKPaymentFailed_Body { /** - * An error message which we should make an effort to send before we disconnect. + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_hash; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { + /** + * The minimum amount of time that should be waited prior to calling + * process_pending_htlc_forwards. To increase the effort required to correlate payments, + * you should wait a random amount of time in roughly the range (now + time_forwardable, + * now + 5*time_forwardable). + */ + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; + +typedef struct LDKEvent_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 LDKEvent_LDKPaymentPathSuccessful_Body { + /** + * 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 + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; + struct LDKThirtyTwoBytes payment_hash; + /** + * The payment path that was successful. + * + * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + */ + struct LDKCVec_RouteHopZ path; +} LDKEvent_LDKPaymentPathSuccessful_Body; -typedef struct LDKErrorAction_LDKSendErrorMessage_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_LDKPaymentFailed_Body payment_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_LDKPaymentPathSuccessful_Body payment_path_successful; + }; +} LDKEvent; + +/** + * An enum which can either contain a crate::lightning::util::events::Event or not + */ +typedef enum LDKCOption_EventZ_Tag { /** - * The message to send. + * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; + 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 MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag 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, - /** - * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendFundingSigned, + 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_locked 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_SendFundingLocked, + LDKnativeFundingLocked *inner; /** - * Used to indicate that an announcement_signatures 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_SendAnnouncementSignatures, + 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 series of HTLC update messages, as well as a commitment_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_UpdateHTLCs, + LDKnativeAnnouncementSignatures *inner; /** - * Used to indicate that a revoke_and_ack 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_SendRevokeAndACK, + 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 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, + LDKnativeCommitmentUpdate *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; +} 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 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, + LDKnativeRevokeAndACK *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; +} LDKRevokeAndACK; + + + +/** + * A closing_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * 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, + LDKnativeClosingSigned *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; +} LDKClosingSigned; + + + +/** + * A shutdown message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKShutdown { /** - * 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, + LDKnativeShutdown *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; +} LDKShutdown; + + + +/** + * A channel_reestablish message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * 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, + LDKnativeChannelReestablish *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; +} LDKChannelReestablish; + + + +/** + * A channel_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** - * 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, + LDKnativeChannelAnnouncement *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; +} LDKChannelAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_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 LDKAcceptChannel msg; -} LDKMessageSendEvent_LDKSendAcceptChannel_Body; + bool is_owned; +} LDKNodeAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_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 LDKOpenChannel msg; -} LDKMessageSendEvent_LDKSendOpenChannel_Body; + bool is_owned; +} LDKErrorMessage; -typedef struct LDKMessageSendEvent_LDKSendFundingCreated_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 LDKFundingCreated msg; -} LDKMessageSendEvent_LDKSendFundingCreated_Body; - -typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { + LDKErrorAction_IgnoreError, /** - * The node_id of the node which should receive this message + * 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 message which should be sent. + * The peer provided us with a gossip message which we'd already seen. In most cases this + * should be ignored, but it may result in the message being forwarded if it is a duplicate of + * our own channel announcements. */ - struct LDKFundingSigned msg; -} LDKMessageSendEvent_LDKSendFundingSigned_Body; - -typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { + LDKErrorAction_IgnoreDuplicateGossip, /** - * The node_id of the node which should receive these message(s) + * The peer did something incorrect. Tell them. */ - struct LDKPublicKey node_id; + LDKErrorAction_SendErrorMessage, /** - * The funding_locked message which should be sent. + * Must be last for serialization purposes */ - struct LDKFundingLocked msg; -} LDKMessageSendEvent_LDKSendFundingLocked_Body; - -typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; + +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { /** - * The node_id of the node which should receive these message(s) + * 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 LDKPublicKey node_id; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; + +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { /** - * The announcement_signatures message which should be sent. + * The message to send. */ - struct LDKAnnouncementSignatures msg; -} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; -typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_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 node_id of the node which should receive these message(s) + * A pointer to the opaque Rust object. + * Nearly everywhere, 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; + LDKnativeQueryChannelRange *inner; /** - * The update messages which should be sent. ALL messages in the struct 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 LDKCommitmentUpdate updates; -} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + 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; - -typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { + LDKMessageSendEvent_SendRevokeAndACK, /** - * The node_id of the node which should receive this message + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. */ - struct LDKPublicKey node_id; + LDKMessageSendEvent_SendClosingSigned, /** - * The channel_update which should be sent. + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKSendChannelUpdate_Body; - -typedef struct LDKMessageSendEvent_LDKHandleError_Body { + LDKMessageSendEvent_SendShutdown, /** - * The node_id of the node which should receive this message + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. */ - struct LDKPublicKey node_id; + LDKMessageSendEvent_SendChannelReestablish, /** - * The action which should be taken. + * 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. */ - struct LDKErrorAction action; -} LDKMessageSendEvent_LDKHandleError_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { + LDKMessageSendEvent_BroadcastChannelAnnouncement, /** - * The node_id of this message recipient + * Used to indicate that a node_announcement should be broadcast to all peers. */ - struct LDKPublicKey node_id; + LDKMessageSendEvent_BroadcastNodeAnnouncement, /** - * The query_channel_range which should be sent. + * Used to indicate that a channel_update should be broadcast to all peers. */ - struct LDKQueryChannelRange msg; -} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; + 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_LDKSendShortIdsQuery_Body { +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_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 LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; -typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The reply_channel_range which should be sent. + * The message which should be sent. */ - struct LDKReplyChannelRange msg; -} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + struct LDKOpenChannel msg; +} LDKMessageSendEvent_LDKSendOpenChannel_Body; -typedef struct MUST_USE_STRUCT LDKMessageSendEvent { - LDKMessageSendEvent_Tag tag; +typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKFundingCreated msg; +} LDKMessageSendEvent_LDKSendFundingCreated_Body; + +typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKFundingSigned msg; +} LDKMessageSendEvent_LDKSendFundingSigned_Body; + +typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { + /** + * The node_id of the node which should receive these message(s) + */ + struct LDKPublicKey node_id; + /** + * The funding_locked message which should be sent. + */ + struct LDKFundingLocked msg; +} LDKMessageSendEvent_LDKSendFundingLocked_Body; + +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; @@ -2939,181 +3875,294 @@ typedef struct LDKCVec_MessageSendEventZ { /** - * Features used within an `init` message. + * Parameters for configuring [`Scorer`]. */ -typedef struct MUST_USE_STRUCT LDKInitFeatures { +typedef struct MUST_USE_STRUCT LDKScoringParameters { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInitFeatures *inner; + LDKnativeScoringParameters *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInitFeatures; +} LDKScoringParameters; /** - * The contents of CResult_InitFeaturesDecodeErrorZ + * The contents of CResult_ScoringParametersDecodeErrorZ */ -typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { +typedef union LDKCResult_ScoringParametersDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInitFeatures *result; + struct LDKScoringParameters *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_InitFeaturesDecodeErrorZPtr; +} LDKCResult_ScoringParametersDecodeErrorZPtr; /** - * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InitFeaturesDecodeErrorZ { +typedef struct LDKCResult_ScoringParametersDecodeErrorZ { /** - * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either + * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + union LDKCResult_ScoringParametersDecodeErrorZPtr contents; /** - * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InitFeaturesDecodeErrorZ; +} LDKCResult_ScoringParametersDecodeErrorZ; /** - * Features used within a `node_announcement` message. + * [`Score`] implementation that provides reasonable default behavior. + * + * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with + * slightly higher fees are available. Will further penalize channels that fail to relay payments. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: crate::routing::scoring */ -typedef struct MUST_USE_STRUCT LDKNodeFeatures { +typedef struct MUST_USE_STRUCT LDKScorer { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeFeatures *inner; + LDKnativeScorer *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNodeFeatures; +} LDKScorer; /** - * The contents of CResult_NodeFeaturesDecodeErrorZ + * The contents of CResult_ScorerDecodeErrorZ */ -typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { +typedef union LDKCResult_ScorerDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNodeFeatures *result; + struct LDKScorer *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_NodeFeaturesDecodeErrorZPtr; +} LDKCResult_ScorerDecodeErrorZPtr; /** - * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { +typedef struct LDKCResult_ScorerDecodeErrorZ { /** - * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either + * The contents of this CResult_ScorerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + union LDKCResult_ScorerDecodeErrorZPtr contents; /** - * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + * Whether this CResult_ScorerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NodeFeaturesDecodeErrorZ; +} LDKCResult_ScorerDecodeErrorZ; /** - * Features used within a `channel_announcement` message. + * Features used within an `init` message. */ -typedef struct MUST_USE_STRUCT LDKChannelFeatures { +typedef struct MUST_USE_STRUCT LDKInitFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelFeatures *inner; + LDKnativeInitFeatures *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelFeatures; +} LDKInitFeatures; /** - * The contents of CResult_ChannelFeaturesDecodeErrorZ + * The contents of CResult_InitFeaturesDecodeErrorZ */ -typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { +typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelFeatures *result; + struct LDKInitFeatures *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_ChannelFeaturesDecodeErrorZPtr; +} LDKCResult_InitFeaturesDecodeErrorZPtr; /** - * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { +typedef struct LDKCResult_InitFeaturesDecodeErrorZ { /** - * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either + * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + union LDKCResult_InitFeaturesDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelFeaturesDecodeErrorZ; +} LDKCResult_InitFeaturesDecodeErrorZ; /** - * Features used within an invoice. + * Features used within a `channel_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKInvoiceFeatures { +typedef struct MUST_USE_STRUCT LDKChannelFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoiceFeatures *inner; + LDKnativeChannelFeatures *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvoiceFeatures; +} LDKChannelFeatures; + +/** + * The contents of CResult_ChannelFeaturesDecodeErrorZ + */ +typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ChannelFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { + /** + * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelFeaturesDecodeErrorZ; + + + +/** + * Features used within a `node_announcement` message. + */ +typedef struct MUST_USE_STRUCT LDKNodeFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKNodeFeatures; + +/** + * The contents of CResult_NodeFeaturesDecodeErrorZ + */ +typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNodeFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_NodeFeaturesDecodeErrorZPtr; + +/** + * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { + /** + * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NodeFeaturesDecodeErrorZ; + + + +/** + * Features used within an invoice. + */ +typedef struct MUST_USE_STRUCT LDKInvoiceFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceFeatures *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; +} LDKInvoiceFeatures; /** * The contents of CResult_InvoiceFeaturesDecodeErrorZ @@ -3148,6 +4197,68 @@ typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_InvoiceFeaturesDecodeErrorZ; + + +/** + * Features used within the channel_type field in an OpenChannel message. + * + * A channel is always of some known \"type\", describing the transaction formats used and the exact + * semantics of our interaction with our peer. + * + * Note that because a channel is a specific type which is proposed by the opener and accepted by + * the counterparty, only required features are allowed here. + * + * This is serialized differently from other feature types - it is not prefixed by a length, and + * thus must only appear inside a TLV where its length is known in advance. + */ +typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelTypeFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelTypeFeatures; + +/** + * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ + */ +typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelTypeFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { + /** + * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZ; + /** * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ */ @@ -3951,59 +5062,6 @@ typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { bool result_ok; } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; - - -/** - * A payment identifier used to uniquely identify a payment to LDK. - */ -typedef struct MUST_USE_STRUCT LDKPaymentId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativePaymentId *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; -} LDKPaymentId; - -/** - * The contents of CResult_PaymentIdDecodeErrorZ - */ -typedef union LDKCResult_PaymentIdDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPaymentId *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_PaymentIdDecodeErrorZPtr; - -/** - * A CResult_PaymentIdDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::PaymentId 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_PaymentIdDecodeErrorZ { - /** - * The contents of this CResult_PaymentIdDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PaymentIdDecodeErrorZPtr contents; - /** - * Whether this CResult_PaymentIdDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PaymentIdDecodeErrorZ; - /** * An enum which can either contain a u16 or not */ @@ -4276,6 +5334,25 @@ typedef enum LDKPaymentSendFailure_Tag { 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 { @@ -4288,9 +5365,7 @@ typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { struct { struct LDKCVec_APIErrorZ all_failed_retry_safe; }; - struct { - struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure; - }; + LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; }; } LDKPaymentSendFailure; @@ -4302,7 +5377,7 @@ typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPaymentId *result; + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. @@ -4312,7 +5387,7 @@ typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { /** * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::PaymentId on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_PaymentIdPaymentSendFailureZ { @@ -4370,7 +5445,7 @@ typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { /** * The element at position 1 */ - struct LDKPaymentId b; + struct LDKThirtyTwoBytes b; } LDKC2Tuple_PaymentHashPaymentIdZ; /** @@ -4427,14 +5502,14 @@ typedef struct LDKSixteenBytes { } LDKSixteenBytes; /** - * A 10-byte byte array. + * A 12-byte byte array. */ -typedef struct LDKTenBytes { +typedef struct LDKTwelveBytes { /** - * The ten bytes + * The twelve bytes */ - uint8_t data[10]; -} LDKTenBytes; + uint8_t data[12]; +} LDKTwelveBytes; /** * An address which can be used to connect to a remote peer @@ -4450,6 +5525,9 @@ typedef enum LDKNetAddress_Tag { LDKNetAddress_IPv6, /** * An old-style Tor onion address/port on which the peer is listening. + * + * This field is deprecated and the Tor network generally no longer supports V2 Onion + * addresses. Thus, the details are not parsed here. */ LDKNetAddress_OnionV2, /** @@ -4486,17 +5564,6 @@ typedef struct LDKNetAddress_LDKIPv6_Body { 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 @@ -4521,7 +5588,9 @@ typedef struct MUST_USE_STRUCT LDKNetAddress { union { LDKNetAddress_LDKIPv4_Body i_pv4; LDKNetAddress_LDKIPv6_Body i_pv6; - LDKNetAddress_LDKOnionV2_Body onion_v2; + struct { + struct LDKTwelveBytes onion_v2; + }; LDKNetAddress_LDKOnionV3_Body onion_v3; }; } LDKNetAddress; @@ -4557,74 +5626,204 @@ typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { } LDKC2Tuple_PaymentHashPaymentSecretZ; /** - * The contents of CResult_PaymentSecretAPIErrorZ + * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ */ -typedef union LDKCResult_PaymentSecretAPIErrorZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { /** * 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 LDKC2Tuple_PaymentHashPaymentSecretZ *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 LDKAPIError *err; -} LDKCResult_PaymentSecretAPIErrorZPtr; + void *err; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr; /** - * 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_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentSecretAPIErrorZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { /** - * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentSecretAPIErrorZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents; /** - * Whether this CResult_PaymentSecretAPIErrorZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentSecretAPIErrorZ; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ */ -typedef struct LDKCVec_ChannelMonitorZ { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { /** - * 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 LDKChannelMonitor *data; + struct LDKC2Tuple_PaymentHashPaymentSecretZ *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_ChannelMonitorZ; - - + struct LDKAPIError *err; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr; /** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. + * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ 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 MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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_PaymentHashPaymentSecretZAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeChannelMonitorUpdate *inner; + union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr 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_PaymentHashPaymentSecretZAPIErrorZ represents a success state. */ - bool is_owned; -} LDKChannelMonitorUpdate; + bool result_ok; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ; + +/** + * The contents of CResult_PaymentSecretNoneZ + */ +typedef union LDKCResult_PaymentSecretNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_PaymentSecretNoneZPtr; + +/** + * A CResult_PaymentSecretNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentSecretNoneZ { + /** + * The contents of this CResult_PaymentSecretNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentSecretNoneZPtr contents; + /** + * Whether this CResult_PaymentSecretNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentSecretNoneZ; + +/** + * The contents of CResult_PaymentSecretAPIErrorZ + */ +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 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_PaymentSecretAPIErrorZPtr; + +/** + * 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_PaymentSecretAPIErrorZ { + /** + * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentSecretAPIErrorZPtr contents; + /** + * Whether this CResult_PaymentSecretAPIErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentSecretAPIErrorZ; + +/** + * The contents of CResult_PaymentPreimageAPIErrorZ + */ +typedef union LDKCResult_PaymentPreimageAPIErrorZPtr { + /** + * 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_PaymentPreimageAPIErrorZPtr; + +/** + * A CResult_PaymentPreimageAPIErrorZ 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_PaymentPreimageAPIErrorZ { + /** + * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentPreimageAPIErrorZPtr contents; + /** + * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentPreimageAPIErrorZ; + +/** + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ChannelMonitorZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKChannelMonitor *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ChannelMonitorZ; + + + +/** + * An update generated by the underlying Channel itself which contains some new information the + * ChannelMonitor should be made aware of. + */ +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelMonitorUpdate *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; +} LDKChannelMonitorUpdate; /** * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as @@ -4680,6 +5879,13 @@ typedef struct LDKWatch { /** * 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_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); /** @@ -4784,6 +5990,12 @@ typedef struct LDKKeysInterface { * blindly signing the hash. */ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage); + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * This method must return the same value each time it is called. + */ + struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(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. @@ -4807,12 +6019,12 @@ typedef struct LDKFeeEstimator { /** * 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). + * Must return a value 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) + * This method can be implemented with the following unit conversions: + * * max(satoshis-per-byte * 250, 253) + * * max(satoshis-per-kbyte / 4, 253) */ uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); /** @@ -4822,6 +6034,27 @@ typedef struct LDKFeeEstimator { void (*free)(void *this_arg); } LDKFeeEstimator; + + +/** + * 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 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. + */ + 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; +} LDKRecord; + /** * A trait encapsulating the operations required of a logger */ @@ -4834,7 +6067,7 @@ typedef struct LDKLogger { /** * Logs the `Record` */ - void (*log)(const void *this_arg, const char *record); + void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -5121,6 +6354,76 @@ typedef struct LDKCResult_COption_TypeZDecodeErrorZ { bool result_ok; } LDKCResult_COption_TypeZDecodeErrorZ; +/** + * An error that may occur when making a payment. + */ +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, + /** + * 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. + */ + 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 { + /** + * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentIdPaymentErrorZPtr contents; + /** + * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentIdPaymentErrorZ; + /** * The contents of CResult_SiPrefixNoneZ */ @@ -5759,93 +7062,97 @@ typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { } LDKCResult_ChannelMonitorUpdateDecodeErrorZ; /** - * The contents of CResult_HTLCUpdateDecodeErrorZ + * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not */ -typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { +typedef enum LDKCOption_MonitorEventZ_Tag { + /** + * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + */ + LDKCOption_MonitorEventZ_Some, + /** + * When we're in this state, this COption_MonitorEventZ contains nothing + */ + LDKCOption_MonitorEventZ_None, + /** + * Must be last for serialization purposes + */ + 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 { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKHTLCUpdate *result; + struct LDKCOption_MonitorEventZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_HTLCUpdateDecodeErrorZPtr; +} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; /** - * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_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_HTLCUpdateDecodeErrorZ { +typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { /** - * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; + union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; /** - * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_HTLCUpdateDecodeErrorZ; - - - -/** - * 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 { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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; +} LDKCResult_COption_MonitorEventZDecodeErrorZ; /** - * The contents of CResult_NoneMonitorUpdateErrorZ + * The contents of CResult_HTLCUpdateDecodeErrorZ */ -typedef union LDKCResult_NoneMonitorUpdateErrorZPtr { +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { /** - * 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 LDKHTLCUpdate *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; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; /** - * 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_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_NoneMonitorUpdateErrorZ { +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** - * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either + * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneMonitorUpdateErrorZPtr contents; + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state. + * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneMonitorUpdateErrorZ; +} LDKCResult_HTLCUpdateDecodeErrorZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -5922,2115 +7229,1679 @@ typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** - * 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. + * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKPaymentPurpose_Tag { +typedef struct LDKCVec_EventZ { /** - * Information for receiving a payment that we generated an invoice for. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKPaymentPurpose_InvoicePayment, + struct LDKEvent *data; /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. + * The number of elements pointed to by `data`. */ - LDKPaymentPurpose_SpontaneousPayment, - /** - * Must be last for serialization purposes - */ - LDKPaymentPurpose_Sentinel, -} LDKPaymentPurpose_Tag; + uintptr_t datalen; +} LDKCVec_EventZ; -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 dynamically-allocated array of crate::c_types::Transactions of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_TransactionZ { /** - * 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes payment_secret; + struct LDKTransaction *data; /** - * 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 + * The number of elements pointed to by `data`. */ - 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; + uintptr_t datalen; +} LDKCVec_TransactionZ; /** - * The reason the channel was closed. See individual variants more details. + * A tuple of 2 elements. See the individual fields for the types contained. */ -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 LDKC2Tuple_u32TxOutZ { /** - * 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. + * The element at position 0 */ - LDKClosureReason_CooperativeClosure, + uint32_t a; /** - * 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`. + * The element at position 1 */ - LDKClosureReason_CommitmentTxConfirmed, + struct LDKTxOut b; +} LDKC2Tuple_u32TxOutZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** - * Closure generated from processing an event, likely a HTLC forward/relay/reception. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKClosureReason_ProcessingError, + struct LDKC2Tuple_u32TxOutZ *data; /** - * 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. + * The number of elements pointed to by `data`. */ - LDKClosureReason_DisconnectedPeer, + uintptr_t datalen; +} LDKCVec_C2Tuple_u32TxOutZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { /** - * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than - * the ChannelManager deserialized. + * The element at position 0 */ - LDKClosureReason_OutdatedChannelManager, + struct LDKThirtyTwoBytes a; /** - * Must be last for serialization purposes + * The element at position 1 */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_TransactionOutputsZ { /** - * 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. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKStr peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; /** - * A developer-readable error message which we generated. + * The number of elements pointed to by `data`. */ - 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; + uintptr_t datalen; +} LDKCVec_TransactionOutputsZ; /** - * An Event which you should probably take some action in response to. + * Details about the balance(s) available for spending once the channel appears on chain. * - * 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). + * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not + * be provided. */ -typedef enum LDKEvent_Tag { +typedef enum LDKBalance_Tag { /** - * 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 channel is not yet closed (or the commitment or closing transaction has not yet + * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is + * force-closed now. */ - LDKEvent_FundingGenerationReady, + LDKBalance_ClaimableOnChannelClose, /** - * 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 + * The channel has been closed, and the given balance is ours but awaiting confirmations until + * we consider it spendable. */ - LDKEvent_PaymentReceived, + LDKBalance_ClaimableAwaitingConfirmations, /** - * 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). + * The channel has been closed, and the given balance should be ours but awaiting spending + * transaction confirmation. If the spending transaction does not confirm in time, it is + * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. * - * 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. + * Once the spending transaction confirms, before it has reached enough confirmations to be + * considered safe from chain reorganizations, the balance will instead be provided via + * [`Balance::ClaimableAwaitingConfirmations`]. */ - LDKEvent_PaymentSent, + LDKBalance_ContentiousClaimable, /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. + * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain + * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat + * likely to be claimed by our counterparty before we do. */ - LDKEvent_PaymentPathFailed, + LDKBalance_MaybeClaimableHTLCAwaitingTimeout, /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. + * Must be last for serialization purposes */ - LDKEvent_PendingHTLCsForwardable, + LDKBalance_Sentinel, +} LDKBalance_Tag; + +typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * Used to indicate that an output which you should know how to spend was confirmed on chain - * and is now spendable. - * Such an output will *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. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - LDKEvent_SpendableOutputs, + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKClaimableOnChannelClose_Body; + +typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { /** - * This event is generated when a payment has been successfully forwarded through us and a - * forwarding fee earned. + * The amount available to claim, in satoshis, possibly excluding the on-chain fees which + * were spent in broadcasting the transaction. */ - LDKEvent_PaymentForwarded, + uint64_t claimable_amount_satoshis; /** - * Used to indicate that a channel with the given `channel_id` is in the process of closure. + * The height at which an [`Event::SpendableOutputs`] event will be generated for this + * amount. */ - LDKEvent_ChannelClosed, + uint32_t confirmation_height; +} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + +typedef struct LDKBalance_LDKContentiousClaimable_Body { /** - * Used to indicate to the user that they can abandon the funding transaction and recycle the - * inputs for another purpose. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - LDKEvent_DiscardFunding, + uint64_t claimable_amount_satoshis; /** - * Must be last for serialization purposes + * The height at which the counterparty may be able to claim the balance if we have not + * done so. */ - LDKEvent_Sentinel, -} LDKEvent_Tag; + uint32_t timeout_height; +} LDKBalance_LDKContentiousClaimable_Body; -typedef struct LDKEvent_LDKFundingGenerationReady_Body { +typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body { /** - * The random channel_id we picked which you'll need to pass into - * ChannelManager::funding_transaction_generated. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - struct LDKThirtyTwoBytes temporary_channel_id; + uint64_t claimable_amount_satoshis; /** - * The value, in satoshis, that the output should have. + * The height at which we will be able to claim the balance if our counterparty has not + * done so. */ - uint64_t channel_value_satoshis; + uint32_t claimable_height; +} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body; + +typedef struct MUST_USE_STRUCT LDKBalance { + LDKBalance_Tag tag; + union { + LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; + LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; + LDKBalance_LDKContentiousClaimable_Body contentious_claimable; + LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout; + }; +} LDKBalance; + +/** + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_BalanceZ { /** - * The script which should be used in the transaction output. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCVec_u8Z output_script; + struct LDKBalance *data; /** - * 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 + * The number of elements pointed to by `data`. */ - uint64_t user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; + uintptr_t datalen; +} LDKCVec_BalanceZ; -typedef struct LDKEvent_LDKPaymentReceived_Body { - /** - * The hash for which the preimage should be handed to the ChannelManager. - */ - struct LDKThirtyTwoBytes payment_hash; +/** + * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + */ +typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { /** - * The value, in thousandths of a satoshi, that this payment is for. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint64_t amt; + struct LDKC2Tuple_BlockHashChannelMonitorZ *result; /** - * 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. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentReceived_Body; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; -typedef struct LDKEvent_LDKPaymentSent_Body { +/** + * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { /** - * 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! + * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes payment_preimage; + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; /** - * The hash which was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. */ - struct LDKThirtyTwoBytes payment_hash; -} LDKEvent_LDKPaymentSent_Body; + bool result_ok; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; -typedef struct LDKEvent_LDKPaymentPathFailed_Body { +/** + * The contents of CResult_NoneLightningErrorZ + */ +typedef union LDKCResult_NoneLightningErrorZPtr { /** - * The hash which was given to ChannelManager::send_payment. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKThirtyTwoBytes payment_hash; + void *result; /** - * 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. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool rejected_by_dest; + struct LDKLightningError *err; +} LDKCResult_NoneLightningErrorZPtr; + +/** + * A CResult_NoneLightningErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneLightningErrorZ { /** - * 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 + * The contents of this CResult_NoneLightningErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCOption_NetworkUpdateZ network_update; + union LDKCResult_NoneLightningErrorZPtr contents; /** - * 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. + * Whether this CResult_NoneLightningErrorZ represents a success state. */ - bool all_paths_failed; + bool result_ok; +} LDKCResult_NoneLightningErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PublicKeyTypeZ { /** - * The payment path that failed. + * The element at position 0 */ - struct LDKCVec_RouteHopZ path; + struct LDKPublicKey a; /** - * 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 1 */ - struct LDKCOption_u64Z short_channel_id; -} LDKEvent_LDKPaymentPathFailed_Body; + struct LDKType b; +} LDKC2Tuple_PublicKeyTypeZ; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { /** - * 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; - -typedef struct LDKEvent_LDKSpendableOutputs_Body { + struct LDKC2Tuple_PublicKeyTypeZ *data; /** - * The outputs which you should store as spendable by you. + * The number of elements pointed to by `data`. */ - struct LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; + uintptr_t datalen; +} LDKCVec_C2Tuple_PublicKeyTypeZZ; -typedef struct LDKEvent_LDKPaymentForwarded_Body { +/** + * The contents of CResult_boolLightningErrorZ + */ +typedef union LDKCResult_boolLightningErrorZPtr { /** - * 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`. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_u64Z fee_earned_msat; + bool *result; /** - * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain - * transaction. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool claim_from_onchain_tx; -} LDKEvent_LDKPaymentForwarded_Body; + struct LDKLightningError *err; +} LDKCResult_boolLightningErrorZPtr; -typedef struct LDKEvent_LDKChannelClosed_Body { +/** + * A CResult_boolLightningErrorZ represents the result of a fallible operation, + * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_boolLightningErrorZ { /** - * The channel_id of the channel which has been closed. Note that on-chain transactions - * resolving the channel are likely still awaiting confirmation. + * The contents of this CResult_boolLightningErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes channel_id; + union LDKCResult_boolLightningErrorZPtr contents; /** - * 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 + * Whether this CResult_boolLightningErrorZ represents a success state. */ - uint64_t user_channel_id; + bool result_ok; +} LDKCResult_boolLightningErrorZ; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { /** - * The reason the channel was closed. + * The element at position 0 */ - struct LDKClosureReason reason; -} LDKEvent_LDKChannelClosed_Body; - -typedef struct LDKEvent_LDKDiscardFunding_Body { + struct LDKChannelAnnouncement a; /** - * The channel_id of the channel which has been closed. + * The element at position 1 */ - struct LDKThirtyTwoBytes channel_id; + struct LDKChannelUpdate b; /** - * The full transaction received from the user + * The element at position 2 */ - 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; + struct LDKChannelUpdate c; +} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; /** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_EventZ { +typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKEvent *data; + struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_EventZ; +} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; /** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_TransactionZ { +typedef struct LDKCVec_NodeAnnouncementZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKTransaction *data; + struct LDKNodeAnnouncement *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_TransactionZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_u32TxOutZ { - /** - * The element at position 0 - */ - uint32_t a; - /** - * The element at position 1 - */ - struct LDKTxOut b; -} LDKC2Tuple_u32TxOutZ; +} LDKCVec_NodeAnnouncementZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_u32TxOutZZ { +typedef struct LDKCVec_PublicKeyZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_u32TxOutZ *data; + struct LDKPublicKey *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_u32TxOutZZ; +} LDKCVec_PublicKeyZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Error for PeerManager errors. If you get one of these, you must disconnect the socket and + * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the + * descriptor. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { /** - * The element at position 0 + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes a; + LDKnativePeerHandleError *inner; /** - * The element at position 1 + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + bool is_owned; +} LDKPeerHandleError; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_CVec_u8ZPeerHandleErrorZ */ -typedef struct LDKCVec_TransactionOutputsZ { +typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; + struct LDKCVec_u8Z *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_TransactionOutputsZ; + struct LDKPeerHandleError *err; +} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; /** - * Details about the balance(s) available for spending once the channel appears on chain. - * - * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not - * be provided. + * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef enum LDKBalance_Tag { - /** - * The channel is not yet closed (or the commitment or closing transaction has not yet - * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - * force-closed now. - */ - LDKBalance_ClaimableOnChannelClose, - /** - * The channel has been closed, and the given balance is ours but awaiting confirmations until - * we consider it spendable. - */ - LDKBalance_ClaimableAwaitingConfirmations, +typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { /** - * The channel has been closed, and the given balance should be ours but awaiting spending - * transaction confirmation. If the spending transaction does not confirm in time, it is - * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. - * - * Once the spending transaction confirms, before it has reached enough confirmations to be - * considered safe from chain reorganizations, the balance will instead be provided via - * [`Balance::ClaimableAwaitingConfirmations`]. + * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKBalance_ContentiousClaimable, + union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; /** - * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain - * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat - * likely to be claimed by our counterparty before we do. + * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. */ - LDKBalance_MaybeClaimableHTLCAwaitingTimeout, + bool result_ok; +} LDKCResult_CVec_u8ZPeerHandleErrorZ; + +/** + * The contents of CResult_NonePeerHandleErrorZ + */ +typedef union LDKCResult_NonePeerHandleErrorZPtr { /** - * Must be last for serialization purposes + * Note that this value is always NULL, as there are no contents in the OK variant */ - LDKBalance_Sentinel, -} LDKBalance_Tag; - -typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { + void *result; /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uint64_t claimable_amount_satoshis; -} LDKBalance_LDKClaimableOnChannelClose_Body; + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; -typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { +/** + * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NonePeerHandleErrorZ { /** - * The amount available to claim, in satoshis, possibly excluding the on-chain fees which - * were spent in broadcasting the transaction. + * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t claimable_amount_satoshis; + union LDKCResult_NonePeerHandleErrorZPtr contents; /** - * The height at which an [`Event::SpendableOutputs`] event will be generated for this - * amount. + * Whether this CResult_NonePeerHandleErrorZ represents a success state. */ - uint32_t confirmation_height; -} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + bool result_ok; +} LDKCResult_NonePeerHandleErrorZ; -typedef struct LDKBalance_LDKContentiousClaimable_Body { +/** + * The contents of CResult_boolPeerHandleErrorZ + */ +typedef union LDKCResult_boolPeerHandleErrorZPtr { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint64_t claimable_amount_satoshis; + bool *result; /** - * The height at which the counterparty may be able to claim the balance if we have not - * done so. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uint32_t timeout_height; -} LDKBalance_LDKContentiousClaimable_Body; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; -typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body { +/** + * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, + * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_boolPeerHandleErrorZ { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t claimable_amount_satoshis; + union LDKCResult_boolPeerHandleErrorZPtr contents; /** - * The height at which we will be able to claim the balance if our counterparty has not - * done so. + * Whether this CResult_boolPeerHandleErrorZ represents a success state. */ - uint32_t claimable_height; -} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body; + bool result_ok; +} LDKCResult_boolPeerHandleErrorZ; + -typedef struct MUST_USE_STRUCT LDKBalance { - LDKBalance_Tag tag; - union { - LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; - LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; - LDKBalance_LDKContentiousClaimable_Body contentious_claimable; - LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout; - }; -} LDKBalance; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. - * This corresponds to std::vector in C++ + * Represents the compressed public key of a node */ -typedef struct LDKCVec_BalanceZ { +typedef struct MUST_USE_STRUCT LDKNodeId { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKBalance *data; + LDKnativeNodeId *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_BalanceZ; + bool is_owned; +} LDKNodeId; /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * The contents of CResult_NodeIdDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef union LDKCResult_NodeIdDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKNodeId *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; +} LDKCResult_NodeIdDecodeErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, + * 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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_NodeIdDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_NodeIdDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_NodeIdDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_NodeIdDecodeErrorZ; /** - * The contents of CResult_NoneLightningErrorZ + * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ */ -typedef union LDKCResult_NoneLightningErrorZPtr { +typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { /** - * 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 LDKCOption_NetworkUpdateZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKLightningError *err; -} LDKCResult_NoneLightningErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr; /** - * A CResult_NoneLightningErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. + * A CResult_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_NoneLightningErrorZ { +typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { /** - * The contents of this CResult_NoneLightningErrorZ, 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_NoneLightningErrorZPtr contents; + union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; /** - * Whether this CResult_NoneLightningErrorZ represents a success state. + * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneLightningErrorZ; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_PublicKeyTypeZ { - /** - * The element at position 0 - */ - struct LDKPublicKey a; - /** - * The element at position 1 - */ - struct LDKType b; -} LDKC2Tuple_PublicKeyTypeZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_PublicKeyTypeZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyTypeZZ; - -/** - * The contents of CResult_boolLightningErrorZ + * The `Access` trait defines behavior for accessing chain data and state, such as blocks and + * UTXOs. */ -typedef union LDKCResult_boolLightningErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - bool *result; +typedef struct LDKAccess { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - struct LDKLightningError *err; -} LDKCResult_boolLightningErrorZPtr; - -/** - * A CResult_boolLightningErrorZ represents the result of a fallible operation, - * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_boolLightningErrorZ { + void *this_arg; /** - * The contents of this CResult_boolLightningErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `genesis_hash` is for a different chain or if such a transaction output + * is unknown. + * + * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - union LDKCResult_boolLightningErrorZPtr contents; + struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); /** - * Whether this CResult_boolLightningErrorZ 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_boolLightningErrorZ; + void (*free)(void *this_arg); +} LDKAccess; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * An enum which can either contain a crate::lightning::chain::Access or not */ -typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { +typedef enum LDKCOption_AccessZ_Tag { /** - * The element at position 0 + * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access */ - struct LDKChannelAnnouncement a; + LDKCOption_AccessZ_Some, /** - * The element at position 1 + * When we're in this state, this COption_AccessZ contains nothing */ - struct LDKChannelUpdate b; + LDKCOption_AccessZ_None, /** - * The element at position 2 + * Must be last for serialization purposes */ - struct LDKChannelUpdate c; -} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; + LDKCOption_AccessZ_Sentinel, +} LDKCOption_AccessZ_Tag; + +typedef struct LDKCOption_AccessZ { + LDKCOption_AccessZ_Tag tag; + union { + struct { + struct LDKAccess some; + }; + }; +} LDKCOption_AccessZ; + + /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size. - * This corresponds to std::vector in C++ + * Details about one direction of a channel. Received + * within a channel update. */ -typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { /** - * 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 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data; + LDKnativeDirectionalChannelInfo *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_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; + bool is_owned; +} LDKDirectionalChannelInfo; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_DirectionalChannelInfoDecodeErrorZ */ -typedef struct LDKCVec_NodeAnnouncementZ { +typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr { /** - * 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 LDKNodeAnnouncement *data; + struct LDKDirectionalChannelInfo *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_NodeAnnouncementZ; + struct LDKDecodeError *err; +} LDKCResult_DirectionalChannelInfoDecodeErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo 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 LDKCVec_PublicKeyZ { +typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKPublicKey *data; + union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; + bool result_ok; +} LDKCResult_DirectionalChannelInfoDecodeErrorZ; /** - * Error for PeerManager errors. If you get one of these, you must disconnect the socket and - * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the - * descriptor. + * Details about a channel (both directions). + * Received within a channel announcement. */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct MUST_USE_STRUCT LDKChannelInfo { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePeerHandleError *inner; + LDKnativeChannelInfo *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKPeerHandleError; +} LDKChannelInfo; /** - * The contents of CResult_CVec_u8ZPeerHandleErrorZ + * The contents of CResult_ChannelInfoDecodeErrorZ */ -typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { +typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_u8Z *result; + struct LDKChannelInfo *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelInfoDecodeErrorZPtr; /** - * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { +typedef struct LDKCResult_ChannelInfoDecodeErrorZ { /** - * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either + * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; + union LDKCResult_ChannelInfoDecodeErrorZPtr contents; /** - * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_u8ZPeerHandleErrorZ; +} LDKCResult_ChannelInfoDecodeErrorZ; + -/** - * The contents of CResult_NonePeerHandleErrorZ - */ -typedef union LDKCResult_NonePeerHandleErrorZPtr { - /** - * 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 LDKPeerHandleError *err; -} LDKCResult_NonePeerHandleErrorZPtr; /** - * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Fees for routing via a given channel or a node */ -typedef struct LDKCResult_NonePeerHandleErrorZ { +typedef struct MUST_USE_STRUCT LDKRoutingFees { /** - * The contents of this CResult_NonePeerHandleErrorZ, 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_NonePeerHandleErrorZPtr contents; + LDKnativeRoutingFees *inner; /** - * Whether this CResult_NonePeerHandleErrorZ 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_NonePeerHandleErrorZ; + bool is_owned; +} LDKRoutingFees; /** - * The contents of CResult_boolPeerHandleErrorZ + * The contents of CResult_RoutingFeesDecodeErrorZ */ -typedef union LDKCResult_boolPeerHandleErrorZPtr { +typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - bool *result; + struct LDKRoutingFees *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_boolPeerHandleErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_RoutingFeesDecodeErrorZPtr; /** - * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, - * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_boolPeerHandleErrorZ { +typedef struct LDKCResult_RoutingFeesDecodeErrorZ { /** - * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_boolPeerHandleErrorZPtr contents; + union LDKCResult_RoutingFeesDecodeErrorZPtr contents; /** - * Whether this CResult_boolPeerHandleErrorZ represents a success state. + * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_boolPeerHandleErrorZ; +} LDKCResult_RoutingFeesDecodeErrorZ; /** - * Represents the compressed public key of a node + * Information received in the latest node_announcement from this node. */ -typedef struct MUST_USE_STRUCT LDKNodeId { +typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeId *inner; + LDKnativeNodeAnnouncementInfo *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNodeId; +} LDKNodeAnnouncementInfo; /** - * The contents of CResult_NodeIdDecodeErrorZ + * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ */ -typedef union LDKCResult_NodeIdDecodeErrorZPtr { +typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNodeId *result; + struct LDKNodeAnnouncementInfo *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_NodeIdDecodeErrorZPtr; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr; /** - * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NodeIdDecodeErrorZ { +typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { /** - * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either + * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NodeIdDecodeErrorZPtr contents; + union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents; /** - * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NodeIdDecodeErrorZ; - -/** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. - */ -typedef struct LDKAccess { - /** - * 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 transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. - * - * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id - */ - struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKAccess; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::chain::Access or not + * A dynamically-allocated array of u64s of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_AccessZ_Tag { - /** - * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access - */ - LDKCOption_AccessZ_Some, +typedef struct LDKCVec_u64Z { /** - * When we're in this state, this COption_AccessZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_AccessZ_None, + uint64_t *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_AccessZ_Sentinel, -} LDKCOption_AccessZ_Tag; - -typedef struct LDKCOption_AccessZ { - LDKCOption_AccessZ_Tag tag; - union { - struct { - struct LDKAccess some; - }; - }; -} LDKCOption_AccessZ; + uintptr_t datalen; +} LDKCVec_u64Z; /** - * Details about one direction of a channel. Received - * within a channel update. + * Details about a node in the network, known from the network announcement. */ -typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { +typedef struct MUST_USE_STRUCT LDKNodeInfo { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDirectionalChannelInfo *inner; + LDKnativeNodeInfo *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; -} LDKDirectionalChannelInfo; +} LDKNodeInfo; /** - * The contents of CResult_DirectionalChannelInfoDecodeErrorZ + * The contents of CResult_NodeInfoDecodeErrorZ */ -typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr { +typedef union LDKCResult_NodeInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKDirectionalChannelInfo *result; + struct LDKNodeInfo *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_DirectionalChannelInfoDecodeErrorZPtr; +} LDKCResult_NodeInfoDecodeErrorZPtr; /** - * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ { +typedef struct LDKCResult_NodeInfoDecodeErrorZ { /** - * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either + * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents; + union LDKCResult_NodeInfoDecodeErrorZPtr contents; /** - * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state. + * Whether this CResult_NodeInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_DirectionalChannelInfoDecodeErrorZ; +} LDKCResult_NodeInfoDecodeErrorZ; /** - * Details about a channel (both directions). - * Received within a channel announcement. + * Represents the network as nodes and channels between them */ -typedef struct MUST_USE_STRUCT LDKChannelInfo { +typedef struct MUST_USE_STRUCT LDKNetworkGraph { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelInfo *inner; + LDKnativeNetworkGraph *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; -} LDKChannelInfo; +} LDKNetworkGraph; /** - * The contents of CResult_ChannelInfoDecodeErrorZ + * The contents of CResult_NetworkGraphDecodeErrorZ */ -typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { +typedef union LDKCResult_NetworkGraphDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelInfo *result; + struct LDKNetworkGraph *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_ChannelInfoDecodeErrorZPtr; +} LDKCResult_NetworkGraphDecodeErrorZPtr; /** - * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelInfoDecodeErrorZ { +typedef struct LDKCResult_NetworkGraphDecodeErrorZ { /** - * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either + * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelInfoDecodeErrorZPtr contents; + union LDKCResult_NetworkGraphDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelInfoDecodeErrorZ; - - +} LDKCResult_NetworkGraphDecodeErrorZ; /** - * Fees for routing via a given channel or a node + * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not */ -typedef struct MUST_USE_STRUCT LDKRoutingFees { +typedef enum LDKCOption_CVec_NetAddressZZ_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_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ */ - LDKnativeRoutingFees *inner; + LDKCOption_CVec_NetAddressZZ_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_CVec_NetAddressZZ contains nothing */ - bool is_owned; -} LDKRoutingFees; + LDKCOption_CVec_NetAddressZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_CVec_NetAddressZZ_Sentinel, +} LDKCOption_CVec_NetAddressZZ_Tag; + +typedef struct LDKCOption_CVec_NetAddressZZ { + LDKCOption_CVec_NetAddressZZ_Tag tag; + union { + struct { + struct LDKCVec_NetAddressZ some; + }; + }; +} LDKCOption_CVec_NetAddressZZ; /** - * The contents of CResult_RoutingFeesDecodeErrorZ + * The contents of CResult_NetAddressDecodeErrorZ */ -typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { +typedef union LDKCResult_NetAddressDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRoutingFees *result; + struct LDKNetAddress *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_RoutingFeesDecodeErrorZPtr; +} LDKCResult_NetAddressDecodeErrorZPtr; /** - * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::NetAddress 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_RoutingFeesDecodeErrorZ { +typedef struct LDKCResult_NetAddressDecodeErrorZ { /** - * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either + * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RoutingFeesDecodeErrorZPtr contents; + union LDKCResult_NetAddressDecodeErrorZPtr contents; /** - * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. + * Whether this CResult_NetAddressDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RoutingFeesDecodeErrorZ; +} LDKCResult_NetAddressDecodeErrorZ; /** - * Information received in the latest node_announcement from this node. + * An update_add_htlc message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { +typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeAnnouncementInfo *inner; + LDKnativeUpdateAddHTLC *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; -} LDKNodeAnnouncementInfo; +} LDKUpdateAddHTLC; /** - * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ + * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { +typedef struct LDKCVec_UpdateAddHTLCZ { /** - * 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 LDKNodeAnnouncementInfo *result; + struct LDKUpdateAddHTLC *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_NodeAnnouncementInfoDecodeErrorZPtr; + uintptr_t datalen; +} LDKCVec_UpdateAddHTLCZ; + + /** - * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An update_fulfill_htlc message to be sent or received from a peer */ -typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { /** - * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, 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_NodeAnnouncementInfoDecodeErrorZPtr contents; + LDKnativeUpdateFulfillHTLC *inner; /** - * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ 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_NodeAnnouncementInfoDecodeErrorZ; + bool is_owned; +} LDKUpdateFulfillHTLC; /** - * A dynamically-allocated array of u64s of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_u64Z { +typedef struct LDKCVec_UpdateFulfillHTLCZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - uint64_t *data; + struct LDKUpdateFulfillHTLC *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_u64Z; +} LDKCVec_UpdateFulfillHTLCZ; /** - * Details about a node in the network, known from the network announcement. + * An update_fail_htlc message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKNodeInfo { +typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeInfo *inner; + LDKnativeUpdateFailHTLC *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; -} LDKNodeInfo; - -/** - * The contents of CResult_NodeInfoDecodeErrorZ - */ -typedef union LDKCResult_NodeInfoDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKNodeInfo *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_NodeInfoDecodeErrorZPtr; +} LDKUpdateFailHTLC; /** - * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_NodeInfoDecodeErrorZ { +typedef struct LDKCVec_UpdateFailHTLCZ { /** - * The contents of this CResult_NodeInfoDecodeErrorZ, 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_NodeInfoDecodeErrorZPtr contents; + struct LDKUpdateFailHTLC *data; /** - * Whether this CResult_NodeInfoDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_NodeInfoDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_UpdateFailHTLCZ; /** - * Represents the network as nodes and channels between them + * An update_fail_malformed_htlc message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKNetworkGraph { +typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNetworkGraph *inner; + LDKnativeUpdateFailMalformedHTLC *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; -} LDKNetworkGraph; +} LDKUpdateFailMalformedHTLC; /** - * The contents of CResult_NetworkGraphDecodeErrorZ + * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_NetworkGraphDecodeErrorZPtr { +typedef struct LDKCVec_UpdateFailMalformedHTLCZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKUpdateFailMalformedHTLC *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_UpdateFailMalformedHTLCZ; + +/** + * The contents of CResult_AcceptChannelDecodeErrorZ + */ +typedef union LDKCResult_AcceptChannelDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetworkGraph *result; + struct LDKAcceptChannel *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_NetworkGraphDecodeErrorZPtr; +} LDKCResult_AcceptChannelDecodeErrorZPtr; /** - * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetworkGraphDecodeErrorZ { +typedef struct LDKCResult_AcceptChannelDecodeErrorZ { /** - * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either + * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetworkGraphDecodeErrorZPtr contents; + union LDKCResult_AcceptChannelDecodeErrorZPtr contents; /** - * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. + * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetworkGraphDecodeErrorZ; - -/** - * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not - */ -typedef enum LDKCOption_CVec_NetAddressZZ_Tag { - /** - * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ - */ - LDKCOption_CVec_NetAddressZZ_Some, - /** - * When we're in this state, this COption_CVec_NetAddressZZ contains nothing - */ - LDKCOption_CVec_NetAddressZZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_CVec_NetAddressZZ_Sentinel, -} LDKCOption_CVec_NetAddressZZ_Tag; - -typedef struct LDKCOption_CVec_NetAddressZZ { - LDKCOption_CVec_NetAddressZZ_Tag tag; - union { - struct { - struct LDKCVec_NetAddressZ some; - }; - }; -} LDKCOption_CVec_NetAddressZZ; +} LDKCResult_AcceptChannelDecodeErrorZ; /** - * The contents of CResult_NetAddressu8Z + * The contents of CResult_AnnouncementSignaturesDecodeErrorZ */ -typedef union LDKCResult_NetAddressu8ZPtr { +typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetAddress *result; + struct LDKAnnouncementSignatures *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - uint8_t *err; -} LDKCResult_NetAddressu8ZPtr; + struct LDKDecodeError *err; +} LDKCResult_AnnouncementSignaturesDecodeErrorZPtr; /** - * A CResult_NetAddressu8Z represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure. + * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetAddressu8Z { +typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ { /** - * The contents of this CResult_NetAddressu8Z, accessible via either + * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetAddressu8ZPtr contents; + union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents; /** - * Whether this CResult_NetAddressu8Z represents a success state. + * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetAddressu8Z; +} LDKCResult_AnnouncementSignaturesDecodeErrorZ; /** - * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ + * The contents of CResult_ChannelReestablishDecodeErrorZ */ -typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr { +typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCResult_NetAddressu8Z *result; + struct LDKChannelReestablish *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_CResult_NetAddressu8ZDecodeErrorZPtr; +} LDKCResult_ChannelReestablishDecodeErrorZPtr; /** - * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ { +typedef struct LDKCResult_ChannelReestablishDecodeErrorZ { /** - * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents; + union LDKCResult_ChannelReestablishDecodeErrorZPtr contents; /** - * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state. + * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; +} LDKCResult_ChannelReestablishDecodeErrorZ; /** - * The contents of CResult_NetAddressDecodeErrorZ + * The contents of CResult_ClosingSignedDecodeErrorZ */ -typedef union LDKCResult_NetAddressDecodeErrorZPtr { +typedef union LDKCResult_ClosingSignedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetAddress *result; + struct LDKClosingSigned *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_NetAddressDecodeErrorZPtr; +} LDKCResult_ClosingSignedDecodeErrorZPtr; /** - * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetAddressDecodeErrorZ { +typedef struct LDKCResult_ClosingSignedDecodeErrorZ { /** - * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either + * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetAddressDecodeErrorZPtr contents; + union LDKCResult_ClosingSignedDecodeErrorZPtr contents; /** - * Whether this CResult_NetAddressDecodeErrorZ represents a success state. + * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetAddressDecodeErrorZ; +} LDKCResult_ClosingSignedDecodeErrorZ; /** - * An update_add_htlc message to be sent or received from a peer + * The minimum and maximum fees which the sender is willing to place on the closing transaction. + * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing + * to use. */ -typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { +typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateAddHTLC *inner; + LDKnativeClosingSignedFeeRange *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; -} LDKUpdateAddHTLC; +} LDKClosingSignedFeeRange; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ */ -typedef struct LDKCVec_UpdateAddHTLCZ { +typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr { /** - * 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 LDKUpdateAddHTLC *data; + struct LDKClosingSignedFeeRange *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_UpdateAddHTLCZ; + struct LDKDecodeError *err; +} LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr; + +/** + * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ { + /** + * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents; + /** + * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClosingSignedFeeRangeDecodeErrorZ; /** - * An update_fulfill_htlc message to be sent or received from a peer + * A commitment_signed message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { +typedef struct MUST_USE_STRUCT LDKCommitmentSigned { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUpdateFulfillHTLC *inner; + LDKnativeCommitmentSigned *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; -} LDKUpdateFulfillHTLC; +} LDKCommitmentSigned; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_CommitmentSignedDecodeErrorZ */ -typedef struct LDKCVec_UpdateFulfillHTLCZ { +typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr { /** - * 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 LDKUpdateFulfillHTLC *data; + struct LDKCommitmentSigned *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_UpdateFulfillHTLCZ; - - + struct LDKDecodeError *err; +} LDKCResult_CommitmentSignedDecodeErrorZPtr; /** - * An update_fail_htlc message to be sent or received from a peer + * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { +typedef struct LDKCResult_CommitmentSignedDecodeErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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_CommitmentSignedDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeUpdateFailHTLC *inner; + union LDKCResult_CommitmentSignedDecodeErrorZPtr 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_CommitmentSignedDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKUpdateFailHTLC; + bool result_ok; +} LDKCResult_CommitmentSignedDecodeErrorZ; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_FundingCreatedDecodeErrorZ */ -typedef struct LDKCVec_UpdateFailHTLCZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKUpdateFailHTLC *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_UpdateFailHTLCZ; - - - -/** - * An update_fail_malformed_htlc message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUpdateFailMalformedHTLC *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; -} LDKUpdateFailMalformedHTLC; - -/** - * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_UpdateFailMalformedHTLCZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKUpdateFailMalformedHTLC *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_UpdateFailMalformedHTLCZ; - -/** - * The contents of CResult_AcceptChannelDecodeErrorZ - */ -typedef union LDKCResult_AcceptChannelDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKAcceptChannel *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_AcceptChannelDecodeErrorZPtr; - -/** - * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_AcceptChannelDecodeErrorZ { - /** - * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_AcceptChannelDecodeErrorZPtr contents; - /** - * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_AcceptChannelDecodeErrorZ; - -/** - * The contents of CResult_AnnouncementSignaturesDecodeErrorZ - */ -typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr { +typedef union LDKCResult_FundingCreatedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKAnnouncementSignatures *result; + struct LDKFundingCreated *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_AnnouncementSignaturesDecodeErrorZPtr; +} LDKCResult_FundingCreatedDecodeErrorZPtr; /** - * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ { +typedef struct LDKCResult_FundingCreatedDecodeErrorZ { /** - * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either + * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents; + union LDKCResult_FundingCreatedDecodeErrorZPtr contents; /** - * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. + * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_AnnouncementSignaturesDecodeErrorZ; +} LDKCResult_FundingCreatedDecodeErrorZ; /** - * The contents of CResult_ChannelReestablishDecodeErrorZ + * The contents of CResult_FundingSignedDecodeErrorZ */ -typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr { +typedef union LDKCResult_FundingSignedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelReestablish *result; + struct LDKFundingSigned *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_ChannelReestablishDecodeErrorZPtr; +} LDKCResult_FundingSignedDecodeErrorZPtr; /** - * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelReestablishDecodeErrorZ { +typedef struct LDKCResult_FundingSignedDecodeErrorZ { /** - * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either + * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelReestablishDecodeErrorZPtr contents; + union LDKCResult_FundingSignedDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. + * Whether this CResult_FundingSignedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelReestablishDecodeErrorZ; +} LDKCResult_FundingSignedDecodeErrorZ; /** - * The contents of CResult_ClosingSignedDecodeErrorZ + * The contents of CResult_FundingLockedDecodeErrorZ */ -typedef union LDKCResult_ClosingSignedDecodeErrorZPtr { +typedef union LDKCResult_FundingLockedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClosingSigned *result; + struct LDKFundingLocked *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_ClosingSignedDecodeErrorZPtr; +} LDKCResult_FundingLockedDecodeErrorZPtr; /** - * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FundingLocked 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_ClosingSignedDecodeErrorZ { +typedef struct LDKCResult_FundingLockedDecodeErrorZ { /** - * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either + * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ClosingSignedDecodeErrorZPtr contents; + union LDKCResult_FundingLockedDecodeErrorZPtr contents; /** - * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. + * Whether this CResult_FundingLockedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ClosingSignedDecodeErrorZ; +} LDKCResult_FundingLockedDecodeErrorZ; /** - * The minimum and maximum fees which the sender is willing to place on the closing transaction. - * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing - * to use. + * An init message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange { +typedef struct MUST_USE_STRUCT LDKInit { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeClosingSignedFeeRange *inner; + LDKnativeInit *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; -} LDKClosingSignedFeeRange; +} LDKInit; /** - * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ + * The contents of CResult_InitDecodeErrorZ */ -typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr { +typedef union LDKCResult_InitDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClosingSignedFeeRange *result; + struct LDKInit *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_ClosingSignedFeeRangeDecodeErrorZPtr; +} LDKCResult_InitDecodeErrorZPtr; /** - * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_InitDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ { +typedef struct LDKCResult_InitDecodeErrorZ { /** - * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either + * The contents of this CResult_InitDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents; + union LDKCResult_InitDecodeErrorZPtr contents; /** - * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + * Whether this CResult_InitDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ClosingSignedFeeRangeDecodeErrorZ; - - - -/** - * A commitment_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKCommitmentSigned { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeCommitmentSigned *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; -} LDKCommitmentSigned; +} LDKCResult_InitDecodeErrorZ; /** - * The contents of CResult_CommitmentSignedDecodeErrorZ + * The contents of CResult_OpenChannelDecodeErrorZ */ -typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr { +typedef union LDKCResult_OpenChannelDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCommitmentSigned *result; + struct LDKOpenChannel *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_CommitmentSignedDecodeErrorZPtr; +} LDKCResult_OpenChannelDecodeErrorZPtr; /** - * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CommitmentSignedDecodeErrorZ { +typedef struct LDKCResult_OpenChannelDecodeErrorZ { /** - * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either + * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CommitmentSignedDecodeErrorZPtr contents; + union LDKCResult_OpenChannelDecodeErrorZPtr contents; /** - * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state. + * Whether this CResult_OpenChannelDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CommitmentSignedDecodeErrorZ; +} LDKCResult_OpenChannelDecodeErrorZ; /** - * The contents of CResult_FundingCreatedDecodeErrorZ + * The contents of CResult_RevokeAndACKDecodeErrorZ */ -typedef union LDKCResult_FundingCreatedDecodeErrorZPtr { +typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKFundingCreated *result; + struct LDKRevokeAndACK *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_FundingCreatedDecodeErrorZPtr; +} LDKCResult_RevokeAndACKDecodeErrorZPtr; /** - * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_FundingCreatedDecodeErrorZ { +typedef struct LDKCResult_RevokeAndACKDecodeErrorZ { /** - * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either + * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_FundingCreatedDecodeErrorZPtr contents; + union LDKCResult_RevokeAndACKDecodeErrorZPtr contents; /** - * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. + * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_FundingCreatedDecodeErrorZ; +} LDKCResult_RevokeAndACKDecodeErrorZ; /** - * The contents of CResult_FundingSignedDecodeErrorZ + * The contents of CResult_ShutdownDecodeErrorZ */ -typedef union LDKCResult_FundingSignedDecodeErrorZPtr { +typedef union LDKCResult_ShutdownDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKFundingSigned *result; + struct LDKShutdown *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_FundingSignedDecodeErrorZPtr; +} LDKCResult_ShutdownDecodeErrorZPtr; /** - * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_FundingSignedDecodeErrorZ { - /** - * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_FundingSignedDecodeErrorZPtr contents; - /** - * Whether this CResult_FundingSignedDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_FundingSignedDecodeErrorZ; - -/** - * The contents of CResult_FundingLockedDecodeErrorZ - */ -typedef union LDKCResult_FundingLockedDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKFundingLocked *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_FundingLockedDecodeErrorZPtr; - -/** - * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ { - /** - * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_FundingLockedDecodeErrorZPtr contents; - /** - * Whether this CResult_FundingLockedDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_FundingLockedDecodeErrorZ; - - - -/** - * An init message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKInit { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInit *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; -} LDKInit; - -/** - * The contents of CResult_InitDecodeErrorZ - */ -typedef union LDKCResult_InitDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInit *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_InitDecodeErrorZPtr; - -/** - * A CResult_InitDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InitDecodeErrorZ { - /** - * The contents of this CResult_InitDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InitDecodeErrorZPtr contents; - /** - * Whether this CResult_InitDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InitDecodeErrorZ; - -/** - * The contents of CResult_OpenChannelDecodeErrorZ - */ -typedef union LDKCResult_OpenChannelDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKOpenChannel *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_OpenChannelDecodeErrorZPtr; - -/** - * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_OpenChannelDecodeErrorZ { - /** - * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_OpenChannelDecodeErrorZPtr contents; - /** - * Whether this CResult_OpenChannelDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_OpenChannelDecodeErrorZ; - -/** - * The contents of CResult_RevokeAndACKDecodeErrorZ - */ -typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRevokeAndACK *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_RevokeAndACKDecodeErrorZPtr; - -/** - * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_RevokeAndACKDecodeErrorZ { - /** - * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RevokeAndACKDecodeErrorZPtr contents; - /** - * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RevokeAndACKDecodeErrorZ; - -/** - * The contents of CResult_ShutdownDecodeErrorZ - */ -typedef union LDKCResult_ShutdownDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKShutdown *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_ShutdownDecodeErrorZPtr; - -/** - * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_ShutdownDecodeErrorZ { @@ -9370,18 +10241,46 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; + + +/** + * An opaque identifier describing a specific [`Persist`] method call. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdateId *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMonitorUpdateId; + /** * `Persist` defines behavior for persisting channel monitors: this could mean * writing once to disk, and/or uploading to one or more backup services. * - * Note that for every new monitor, you **must** persist the new `ChannelMonitor` - * to disk/backups. And, on every update, you **must** persist either the - * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk - * of situations such as revoking a transaction, then crashing before this - * revocation can be persisted, then unintentionally broadcasting a revoked - * transaction and losing money. This is a risk because previous channel states - * are toxic, so it's important that whatever channel state is persisted is - * kept up-to-date. + * Each method can return three possible values: + * * If persistence (including any relevant `fsync()` calls) happens immediately, the + * implementation should return `Ok(())`, indicating normal channel operation should continue. + * * If persistence happens asynchronously, implementations should first ensure the + * [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return + * `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the + * background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be + * called with the corresponding [`MonitorUpdateId`]. + * + * Note that unlike the direct [`chain::Watch`] interface, + * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. + * + * * If persistence fails for some reason, implementations should return + * `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be + * closed without broadcasting the latest state. See + * [`ChannelMonitorUpdateErr::PermanentFailure`] for more details. */ typedef struct LDKPersist { /** @@ -9390,25 +10289,36 @@ typedef struct LDKPersist { */ void *this_arg; /** - * Persist a new channel's data. The data can be stored any way you want, but - * the identifier provided by Rust-Lightning is the channel's outpoint (and - * it is up to you to maintain a correct mapping between the outpoint and the - * stored channel data). Note that you **must** persist every new monitor to - * disk. See the `Persist` trait documentation for more details. + * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. + * + * The data can be stored any way you want, but the identifier provided by LDK is the + * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint + * and the stored channel data). Note that you **must** persist every new monitor to disk. + * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`]. * * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [`Writeable::write`]: crate::util::ser::Writeable::write */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data); + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); /** - * Update one channel's data. The provided `ChannelMonitor` has already - * applied the given update. + * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given + * update. + * + * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the + * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more + * details. * - * Note that on every update, you **must** persist either the - * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See - * the `Persist` trait documentation for more details. + * During blockchain synchronization operations, this may be called with no + * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. + * Note that after the full [`ChannelMonitor`] is persisted any previous + * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be + * applied to the persisted [`ChannelMonitor`] as they were already applied. * * If an implementer chooses to persist the updates only, they need to make * sure that all the updates are applied to the `ChannelMonitors` *before* @@ -9422,13 +10332,18 @@ typedef struct LDKPersist { * them in batches. The size of each monitor grows `O(number of state updates)` * whereas updates are small and `O(1)`. * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`]. + * * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and * [`ChannelMonitorUpdateErr`] for requirements when returning errors. * * [`Writeable::write`]: crate::util::ser::Writeable::write + * + * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data); + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -9678,20 +10593,25 @@ typedef struct LDKChannelMessageHandler { * * At a high-level, the process for deserializing a ChannelManager and resuming normal operation * is: - * 1) Deserialize all stored ChannelMonitors. - * 2) Deserialize the ChannelManager by filling in this struct and calling: - * <(BlockHash, ChannelManager)>::read(reader, args) - * This may result in closing some Channels if the ChannelMonitor is newer than the stored - * ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted. - * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same - * way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and - * ChannelMonitor::get_funding_txo(). - * 4) Reconnect blocks on your ChannelMonitors. - * 5) Disconnect/connect blocks on the ChannelManager. - * 6) Move the ChannelMonitors into your local chain::Watch. - * - * Note that the ordering of #4-6 is not of importance, however all three must occur before you - * call any other methods on the newly-deserialized ChannelManager. + * 1) Deserialize all stored [`ChannelMonitor`]s. + * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling: + * `<(BlockHash, ChannelManager)>::read(reader, args)` + * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored + * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted. + * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the + * same way you would handle a [`chain::Filter`] call using + * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. + * 4) Reconnect blocks on your [`ChannelMonitor`]s. + * 5) Disconnect/connect blocks on the [`ChannelManager`]. + * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. + * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you + * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in + * the next step. + * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a + * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. + * + * Note that the ordering of #4-7 is not of importance, however all four must occur before you + * call any other methods on the newly-deserialized [`ChannelManager`]. * * Note that because some channels may be closed during deserialization, it is critical that you * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to @@ -9699,6 +10619,8 @@ typedef struct LDKChannelMessageHandler { * broadcast), and then later deserialize a newer version of the same ChannelManager (which will * not force-close the same channels but consider them live), you may end up revoking a state for * which you've already broadcasted the transaction. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** @@ -10072,28 +10994,6 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { bool is_owned; } LDKDirectedChannelTransactionParameters; -/** - * An interface used to score payment channels for path finding. - * - *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. - */ -typedef struct LDKScore { - /** - * 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 fee in msats willing to be paid to avoid routing through the given channel. - */ - uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKScore; - /** @@ -10141,52 +11041,97 @@ typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { bool is_owned; } LDKNetGraphMsgHandler; - - /** - * A channel descriptor for a hop along a payment path. + * An interface used to score payment channels for path finding. + * + *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. */ -typedef struct MUST_USE_STRUCT LDKRouteHintHop { +typedef struct LDKScore { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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. */ - LDKnativeRouteHintHop *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 fee in msats willing to be paid to avoid routing `send_amt_msat` through the + * given channel in the direction from `source` to `target`. + * + * The channel's capacity (less any other MPP parts which are also being considered for use in + * the same payment) is given by `channel_capacity_msat`. It may be guessed from various + * sources or assumed from no data at all. + * + * For hints provided in the invoice, we assume the channel has sufficient capacity to accept + * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other + * cases it is set to `Some`, even if we're guessing at the channel value. + * + * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC. */ - bool is_owned; -} LDKRouteHintHop; - - - -/** - * [`routing::Score`] implementation that provides reasonable default behavior. - * - * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with - * slightly higher fees are available. + uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target); + /** + * Handles updating channel penalties after failing to route through a channel. + */ + void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + /** + * Handles updating channel penalties after successfully routing along a path. + */ + void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKScore; + +/** + * A scorer that is accessed under a lock. * - * See [module-level documentation] for usage. + * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while + * having shared ownership of a scorer but without requiring internal locking in [`Score`] + * implementations. Internal locking would be detrimental to route finding performance and could + * result in [`Score::channel_penalty_msat`] returning a different value for the same channel. * - * [module-level documentation]: crate::routing::scorer + * [`find_route`]: crate::routing::router::find_route */ -typedef struct MUST_USE_STRUCT LDKScorer { +typedef struct LDKLockableScore { + /** + * 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 locked scorer. + */ + struct LDKScore (*lock)(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); +} LDKLockableScore; + + + +/** + * A concrete implementation of [`LockableScore`] which supports multi-threading. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeScorer *inner; + LDKnativeMultiThreadedLockableScore *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; -} LDKScorer; +} LDKMultiThreadedLockableScore; @@ -10231,6 +11176,8 @@ typedef struct MUST_USE_STRUCT LDKFilesystemPersister { * [`ChannelManager`] persistence should be done in the background. * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`] * at the appropriate intervals. + * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to + * [`BackgroundProcessor::start`]). * * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied * upon as doing so may result in high latency. @@ -10309,762 +11256,1301 @@ typedef struct MUST_USE_STRUCT LDKRawDataPart { /** - * SHA-256 hash + * SHA-256 hash + */ +typedef struct MUST_USE_STRUCT LDKSha256 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSha256 *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSha256; + + + +/** + * `min_final_cltv_expiry` to use for the last HTLC in the route + */ +typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMinFinalCltvExpiry *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; +} LDKMinFinalCltvExpiry; + +/** + * Integer in the range `0..32` + */ +typedef struct LDKu5 { + uint8_t _0; +} LDKu5; + +/** + * A 20-byte byte array. + */ +typedef struct LDKTwentyBytes { + /** + * The twenty bytes + */ + uint8_t data[20]; +} LDKTwentyBytes; + +/** + * Fallback address in case no LN payment is possible + */ +typedef enum LDKFallback_Tag { + LDKFallback_SegWitProgram, + LDKFallback_PubKeyHash, + LDKFallback_ScriptHash, + /** + * Must be last for serialization purposes + */ + LDKFallback_Sentinel, +} LDKFallback_Tag; + +typedef struct LDKFallback_LDKSegWitProgram_Body { + struct LDKu5 version; + struct LDKCVec_u8Z program; +} LDKFallback_LDKSegWitProgram_Body; + +typedef struct MUST_USE_STRUCT LDKFallback { + LDKFallback_Tag tag; + union { + LDKFallback_LDKSegWitProgram_Body seg_wit_program; + struct { + struct LDKTwentyBytes pub_key_hash; + }; + struct { + struct LDKTwentyBytes script_hash; + }; + }; +} LDKFallback; + +/** + * A trait defining behavior of an [`Invoice`] payer. + */ +typedef struct LDKPayer { + /** + * 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 payer's node id. + */ + struct LDKPublicKey (*node_id)(const void *this_arg); + /** + * Returns the payer's channels. + */ + struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg); + /** + * Sends a payment over the Lightning Network using the given [`Route`]. + * + * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + /** + * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. + */ + struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); + /** + * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. + */ + struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); + /** + * Signals that no further retries for the given payment will occur. + */ + void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKPayer; + +/** + * A trait defining behavior for routing an [`Invoice`] payment. + */ +typedef struct LDKRouter { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKRouter; + + + +/** + * A utility for paying [`Invoice`]s and sending spontaneous payments. + * + * See [module-level documentation] for details. + * + * [module-level documentation]: crate::payment + */ +typedef struct MUST_USE_STRUCT LDKInvoicePayer { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoicePayer *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; +} LDKInvoicePayer; + + + +/** + * Number of attempts to retry payment path failures for an [`Invoice`]. + * + * Note that this is the number of *path* failures, not full payment retries. For multi-path + * payments, if this is less than the total number of paths, we will never even retry all of the + * payment's paths. + */ +typedef struct MUST_USE_STRUCT LDKRetryAttempts { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRetryAttempts *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; +} LDKRetryAttempts; + + + +/** + * A [`Router`] implemented using [`find_route`]. + */ +typedef struct MUST_USE_STRUCT LDKDefaultRouter { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDefaultRouter *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDefaultRouter; + +extern const uintptr_t MAX_BUF_SIZE; + +extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; + +extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; + +extern const uint32_t ANTI_REORG_DELAY; + +extern const uint16_t BREAKDOWN_TIMEOUT; + +extern const uint16_t MIN_CLTV_EXPIRY_DELTA; + +extern const uint32_t MIN_FINAL_CLTV_EXPIRY; + +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + +extern const uint64_t DEFAULT_EXPIRY_TIME; + +extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; + +extern const uint8_t TAG_PAYMENT_HASH; + +extern const uint8_t TAG_DESCRIPTION; + +extern const uint8_t TAG_PAYEE_PUB_KEY; + +extern const uint8_t TAG_DESCRIPTION_HASH; + +extern const uint8_t TAG_EXPIRY_TIME; + +extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; + +extern const uint8_t TAG_FALLBACK; + +extern const uint8_t TAG_PRIVATE_ROUTE; + +extern const uint8_t TAG_PAYMENT_SECRET; + +extern const uint8_t TAG_FEATURES; + +struct LDKStr _ldk_get_compiled_version(void); + +struct LDKStr _ldk_c_bindings_get_compiled_version(void); + +/** + * Frees the data buffer, if data_is_owned is set and datalen > 0. + */ +void Transaction_free(struct LDKTransaction _res); + +/** + * Convenience function for constructing a new TxOut + */ +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); + +/** + * Frees the data pointed to by script_pubkey. + */ +void TxOut_free(struct LDKTxOut _res); + +/** + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + */ +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +/** + * Frees the data buffer, if chars_is_owned is set and len > 0. + */ +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. + */ +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); + +/** + * Creates a new CResult_SecretKeyErrorZ in the error state. + */ +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SecretKeyErrorZ. + */ +void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); + +/** + * Creates a new CResult_PublicKeyErrorZ in the success state. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); + +/** + * Creates a new CResult_PublicKeyErrorZ in the error state. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PublicKeyErrorZ. + */ +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); + +/** + * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + */ +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. + */ +void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxCreationKeysErrorZ in the success state. + */ +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); + +/** + * Creates a new CResult_TxCreationKeysErrorZ in the error state. + */ +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxCreationKeysErrorZ. + */ +void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); + +/** + * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_u32Z containing a u32 + */ +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); + +/** + * Constructs a new COption_u32Z containing nothing + */ +struct LDKCOption_u32Z COption_u32Z_none(void); + +/** + * Frees any resources associated with the u32, if we are in the Some state + */ +void COption_u32Z_free(struct LDKCOption_u32Z _res); + +/** + * Creates a new COption_u32Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + */ +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. + */ +void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_NoneZ containing a + */ +enum LDKCOption_NoneZ COption_NoneZ_some(void); + +/** + * Constructs a new COption_NoneZ containing nothing + */ +enum LDKCOption_NoneZ COption_NoneZ_none(void); + +/** + * Frees any resources associated with the , if we are in the Some state + */ +void COption_NoneZ_free(enum LDKCOption_NoneZ _res); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + */ +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. + */ +void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKSha256 { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSha256 *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSha256; +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * `min_final_cltv_expiry` to use for the last HTLC in the route + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMinFinalCltvExpiry *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; -} LDKMinFinalCltvExpiry; +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); /** - * Integer in the range `0..32` + * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. */ -typedef struct LDKu5 { - uint8_t _0; -} LDKu5; +void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); /** - * A 20-byte byte array. + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct LDKTwentyBytes { - /** - * The twenty bytes - */ - uint8_t data[20]; -} LDKTwentyBytes; +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Fallback address in case no LN payment is possible + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef enum LDKFallback_Tag { - LDKFallback_SegWitProgram, - LDKFallback_PubKeyHash, - LDKFallback_ScriptHash, - /** - * Must be last for serialization purposes - */ - LDKFallback_Sentinel, -} LDKFallback_Tag; +void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); -typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKu5 version; - struct LDKCVec_u8Z program; -} LDKFallback_LDKSegWitProgram_Body; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); -typedef struct MUST_USE_STRUCT LDKFallback { - LDKFallback_Tag tag; - union { - LDKFallback_LDKSegWitProgram_Body seg_wit_program; - struct { - struct LDKTwentyBytes pub_key_hash; - }; - struct { - struct LDKTwentyBytes script_hash; - }; - }; -} LDKFallback; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t MAX_BUF_SIZE; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +/** + * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + */ +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -extern const uint32_t ANTI_REORG_DELAY; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); -extern const uint16_t BREAKDOWN_TIMEOUT; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint16_t MIN_CLTV_EXPIRY_DELTA; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint32_t MIN_FINAL_CLTV_EXPIRY; +/** + * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + */ +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); -extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t DEFAULT_EXPIRY_TIME; +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); -extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); -extern const uint8_t TAG_PAYMENT_HASH; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); -extern const uint8_t TAG_DESCRIPTION; +/** + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + */ +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); -extern const uint8_t TAG_PAYEE_PUB_KEY; +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); -extern const uint8_t TAG_DESCRIPTION_HASH; +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint8_t TAG_EXPIRY_TIME; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; +/** + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + */ +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); -extern const uint8_t TAG_FALLBACK; +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -extern const uint8_t TAG_PRIVATE_ROUTE; +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); -extern const uint8_t TAG_PAYMENT_SECRET; +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); -extern const uint8_t TAG_FEATURES; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); -struct LDKStr _ldk_get_compiled_version(void); +/** + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + */ +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); -struct LDKStr _ldk_c_bindings_get_compiled_version(void); +/** + * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); /** - * Frees the data buffer, if data_is_owned is set and datalen > 0. + * Creates a new CResult_CVec_SignatureZNoneZ in the error state. */ -void Transaction_free(struct LDKTransaction _res); +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); /** - * Convenience function for constructing a new TxOut + * Checks if the given object is currently in the success state */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); /** - * Frees the data pointed to by script_pubkey. + * Frees any resources used by the CResult_CVec_SignatureZNoneZ. */ -void TxOut_free(struct LDKTxOut _res); +void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. */ -void Str_free(struct LDKStr _res); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); /** - * Creates a new CResult_SecretKeyErrorZ in the success state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_SecretKeyErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SecretKeyErrorZ. + * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. */ -void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); +void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); /** - * Creates a new CResult_PublicKeyErrorZ in the success state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyErrorZ in the error state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); /** - * Frees any resources used by the CResult_PublicKeyErrorZ. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); /** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + * Creates a new CResult_NoneErrorZ in the success state. */ -void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneErrorZ in the error state. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NoneErrorZ. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); /** - * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RouteHopDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); /** - * Creates a new CResult_TxCreationKeysErrorZ in the success state. + * Creates a new CResult_RouteHopDecodeErrorZ in the error state. */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_TxCreationKeysErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxCreationKeysErrorZ. + * Frees any resources used by the CResult_RouteHopDecodeErrorZ. */ -void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); +void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); /** - * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` + * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u32Z containing a u32 + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); /** - * Constructs a new COption_u32Z containing nothing + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_u32Z COption_u32Z_none(void); +void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); /** - * Frees any resources associated with the u32, if we are in the Some state + * Creates a new CResult_RouteDecodeErrorZ in the success state. */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); /** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RouteDecodeErrorZ in the error state. */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + * Frees any resources used by the CResult_RouteDecodeErrorZ. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); /** - * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. */ -void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + * Constructs a new COption_u64Z containing a u64 */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); /** - * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + * Constructs a new COption_u64Z containing nothing */ -void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); +struct LDKCOption_u64Z COption_u64Z_none(void); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Frees any resources associated with the u64, if we are in the Some state + */ +void COption_u64Z_free(struct LDKCOption_u64Z _res); + +/** + * Creates a new COption_u64Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PayeeDecodeErrorZ in the success state. */ -void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_PayeeDecodeErrorZ in the error state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_PayeeDecodeErrorZ. */ -void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); +void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_RouteHintDecodeErrorZ in the success state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); /** - * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + * Creates a new CResult_RouteHintDecodeErrorZ in the error state. */ -void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + * Frees any resources used by the CResult_RouteHintDecodeErrorZ. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * Creates a new CResult_RouteLightningErrorZ in the success state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * Creates a new CResult_RouteLightningErrorZ in the error state. */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Frees any resources used by the CResult_RouteLightningErrorZ. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_TxOutAccessErrorZ in the success state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Creates a new CResult_TxOutAccessErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Frees any resources used by the CResult_TxOutAccessErrorZ. */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Creates a new C2Tuple_usizeTransactionZ from the contained elements. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees any resources used by the C2Tuple_usizeTransactionZ. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); /** - * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); +void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing */ -void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); +struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void); /** - * Creates a new CResult_RouteDecodeErrorZ in the success state. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ in the error state. + * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteDecodeErrorZ. + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason */ -void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); /** - * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_ClosureReasonZ containing nothing */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); /** - * Constructs a new COption_u64Z containing a u64 + * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); /** - * Constructs a new COption_u64Z containing nothing + * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u64Z COption_u64Z_none(void); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); /** - * Frees any resources associated with the u64, if we are in the Some state + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); /** - * Creates a new COption_u64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Constructs a new COption_NetworkUpdateZ containing nothing */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * Creates a new COption_NetworkUpdateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxOutAccessErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); /** - * Creates a new CResult_TxOutAccessErrorZ in the error state. + * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Frees any resources used by the CResult_TxOutAccessErrorZ. + * Constructs a new COption_EventZ containing nothing */ -void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new COption_EventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_usizeTransactionZ from the contained elements. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Frees any resources used by the C2Tuple_usizeTransactionZ. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. */ -void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state. + * 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_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. + * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state. */ -void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); +struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state. */ -struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig); +struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ + * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ. */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o); +void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); /** - * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing + * Creates a new CResult_ScorerDecodeErrorZ in the success state. */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void); +struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state + * Creates a new CResult_ScorerDecodeErrorZ in the error state. */ -void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res); +struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig); +bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate + * Frees any resources used by the CResult_ScorerDecodeErrorZ. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); /** - * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_NetworkUpdateZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); /** * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. @@ -11076,40 +12562,55 @@ 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. */ void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); +void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); /** - * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. */ -void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + */ +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); /** * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. @@ -11121,6 +12622,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. */ @@ -11142,6 +12648,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. */ @@ -11163,6 +12674,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. */ @@ -11184,6 +12700,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. */ @@ -11221,6 +12742,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. */ @@ -11242,6 +12768,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. */ @@ -11263,6 +12794,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. */ @@ -11289,6 +12825,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. */ @@ -11315,6 +12856,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. */ @@ -11336,6 +12882,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. */ @@ -11362,6 +12913,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. */ @@ -11399,30 +12955,14 @@ struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tu struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); /** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. - */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); - -/** - * Creates a new CResult_PaymentIdDecodeErrorZ in the success state. - */ -struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o); - -/** - * Creates a new CResult_PaymentIdDecodeErrorZ in the error state. - */ -struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Frees any resources used by the CResult_PaymentIdDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res); +bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. */ -struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig); +void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); /** * Constructs a new COption_u16Z containing a u16 @@ -11455,6 +12995,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. */ @@ -11486,6 +13031,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. */ @@ -11500,13 +13050,18 @@ struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCR /** * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. */ 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. */ @@ -11528,6 +13083,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. */ @@ -11537,65 +13097,148 @@ void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailu * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + */ +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + */ +void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + */ +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + */ +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. + */ +void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + */ +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. + */ +void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + */ +void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. */ -void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); +bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PaymentSecretNoneZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentSecretNoneZ in the error state. */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); +bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + * Frees any resources used by the CResult_PaymentSecretNoneZ. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. + * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. @@ -11607,6 +13250,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. */ @@ -11618,6 +13266,32 @@ void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIError */ struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. + */ +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + */ +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. + */ +void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); + +/** + * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -11643,6 +13317,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. */ @@ -11658,6 +13337,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. */ @@ -11679,6 +13363,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. */ @@ -11715,11 +13404,42 @@ 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. */ void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); +/** + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + */ +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + */ +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. + */ +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); + +/** + * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_SiPrefixNoneZ in the success state. */ @@ -11730,6 +13450,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. */ @@ -11751,6 +13476,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. */ @@ -11772,6 +13502,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. */ @@ -11809,6 +13544,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. */ @@ -11835,6 +13575,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. */ @@ -11856,6 +13601,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. */ @@ -11877,6 +13627,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. */ @@ -11898,6 +13653,11 @@ struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok */ 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. */ @@ -11919,6 +13679,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. */ @@ -11940,6 +13705,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. */ @@ -11961,6 +13731,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. */ @@ -11976,6 +13751,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. */ @@ -11988,46 +13768,77 @@ void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMoni struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Constructs a new COption_MonitorEventZ containing nothing */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new COption_MonitorEventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +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. + */ +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig` + * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` @@ -12154,6 +13965,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. */ @@ -12169,6 +13985,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. */ @@ -12205,6 +14026,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. */ @@ -12257,6 +14083,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. */ @@ -12278,6 +14109,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. */ @@ -12299,6 +14135,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. */ @@ -12320,6 +14161,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. */ @@ -12331,6 +14177,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 */ @@ -12356,6 +14228,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. */ @@ -12377,6 +14254,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. */ @@ -12398,6 +14280,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. */ @@ -12419,6 +14306,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. */ @@ -12445,6 +14337,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. */ @@ -12466,6 +14363,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. */ @@ -12498,48 +14400,6 @@ void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); */ struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); -/** - * Creates a new CResult_NetAddressu8Z in the success state. - */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); - -/** - * Creates a new CResult_NetAddressu8Z in the error state. - */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e); - -/** - * Frees any resources used by the CResult_NetAddressu8Z. - */ -void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res); - -/** - * Creates a new CResult_NetAddressu8Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig); - -/** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state. - */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o); - -/** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state. - */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ. - */ -void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res); - -/** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_NetAddressDecodeErrorZ in the success state. */ @@ -12550,6 +14410,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. */ @@ -12591,6 +14456,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. */ @@ -12612,6 +14482,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. */ @@ -12633,6 +14508,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. */ @@ -12654,6 +14534,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. */ @@ -12675,6 +14560,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. */ @@ -12696,6 +14586,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. */ @@ -12717,6 +14612,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. */ @@ -12738,6 +14638,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. */ @@ -12757,7 +14662,12 @@ struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok /** * Creates a new CResult_FundingLockedDecodeErrorZ in the error state. */ -struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); +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. @@ -12780,6 +14690,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. */ @@ -12801,6 +14716,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. */ @@ -12822,6 +14742,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. */ @@ -12843,6 +14768,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. */ @@ -12864,6 +14794,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. */ @@ -12885,6 +14820,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. */ @@ -12906,6 +14846,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. */ @@ -12927,6 +14872,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. */ @@ -12948,6 +14898,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. */ @@ -12969,6 +14924,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. */ @@ -12990,6 +14950,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. */ @@ -13011,6 +14976,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. */ @@ -13032,6 +15002,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. */ @@ -13053,6 +15028,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. */ @@ -13074,6 +15054,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. */ @@ -13095,6 +15080,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. */ @@ -13116,6 +15106,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. */ @@ -13137,6 +15132,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. */ @@ -13158,6 +15158,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. */ @@ -13179,6 +15184,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. */ @@ -13200,6 +15210,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. */ @@ -13221,6 +15236,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. */ @@ -13242,6 +15262,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. */ @@ -13263,6 +15288,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. */ @@ -13299,6 +15329,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. */ @@ -13322,7 +15357,7 @@ struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NO /** * Utility method to constructs a new InvoicePayment-variant PaymentPurpose */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id); +struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose @@ -13359,6 +15394,11 @@ struct LDKClosureReason ClosureReason_cooperative_closure(void); */ struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); +/** + * Utility method to constructs a new FundingTimedOut-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_funding_timed_out(void); + /** * Utility method to constructs a new ProcessingError-variant ClosureReason */ @@ -13379,6 +15419,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 */ @@ -13402,12 +15447,17 @@ struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, ui /** * Utility method to constructs a new PaymentSent-variant Event */ -struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash); +struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); /** * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); +struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); + +/** + * Utility method to constructs a new PaymentFailed-variant Event + */ +struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); /** * Utility method to constructs a new PendingHTLCsForwardable-variant Event @@ -13434,11 +15484,21 @@ struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64 */ struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); +/** + * Utility method to constructs a new PaymentPathSuccessful-variant Event + */ +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + /** * Serialize the Event object into a byte array which can be read by Event_read */ 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 */ @@ -13622,6 +15682,11 @@ bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); */ enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); +/** + * Utility method to constructs a new Gossip-variant Level + */ +enum LDKLevel Level_gossip(void); + /** * Utility method to constructs a new Trace-variant Level */ @@ -13663,6 +15728,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 */ @@ -14287,10 +16412,22 @@ bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig */ void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +/** + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. + */ +bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. + */ +void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + /** * Constructs a new UserConfig given each field */ -MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg); +MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg); /** * Creates a copy of the UserConfig @@ -14478,6 +16615,28 @@ bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, cons */ void FeeEstimator_free(struct LDKFeeEstimator this_ptr); +/** + * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL. + */ +void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj); + +/** + * Creates a copy of the MonitorUpdateId + */ +struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig); + +/** + * Checks if two MonitorUpdateIds contain equal inner contents. + */ +uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o); + +/** + * Checks if two MonitorUpdateIds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b); + /** * Calls the free function if one is set */ @@ -14534,6 +16693,23 @@ MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monito */ MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +/** + * Indicates the persistence of a [`ChannelMonitor`] has completed after + * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation. + * + * Thus, the anticipated use is, at a high level: + * 1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the + * update to disk and begins updating any remote (e.g. watchtower/backup) copies, + * returning [`ChannelMonitorUpdateErr::TemporaryFailure`], + * 2) once all remote copies are updated, you call this function with the + * `completed_update_id` that completed, and once all pending updates have completed the + * channel will be re-enabled. + * + * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently + * registered [`ChannelMonitor`]s. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id); + /** * Constructs a new Listen which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is @@ -14608,16 +16784,6 @@ struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpda */ struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); -/** - * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL. - */ -void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); - -/** - * Creates a copy of the MonitorUpdateError - */ -struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); - /** * Frees any resources used by the MonitorEvent */ @@ -14638,6 +16804,26 @@ struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); */ struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a); +/** + * Utility method to constructs a new UpdateCompleted-variant MonitorEvent + */ +struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id); + +/** + * Utility method to constructs a new UpdateFailed-variant MonitorEvent + */ +struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a); + +/** + * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read + */ +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. */ @@ -14710,7 +16896,7 @@ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_ * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this @@ -15248,6 +17434,12 @@ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDK */ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +/** + * Whether anchors should be used. + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + /** * Sign the single input of spend_tx at index `input_idx` which spends the output * described by descriptor, returning the witness stack for the input. @@ -15347,38 +17539,6 @@ MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outp */ struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); -/** - * Frees any resources used by the PaymentId, if is_owned is set and inner is non-NULL. - */ -void PaymentId_free(struct LDKPaymentId this_obj); - -/** - * Checks if two PaymentIds contain equal inner contents. - */ -uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o); - -/** - * Creates a copy of the PaymentId - */ -struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig); - -/** - * Checks if two PaymentIds contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. - */ -bool PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b); - -/** - * Serialize the PaymentId object into a byte array which can be read by PaymentId_read - */ -struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj); - -/** - * Read a PaymentId from a byte array, created by PaymentId_write - */ -struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser); - /** * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ @@ -15660,12 +17820,42 @@ uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONN */ void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +/** + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] + */ +uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] + */ +void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * + * See also [`ChannelDetails::balance_msat`] + * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. @@ -15674,10 +17864,12 @@ uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetail /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * + * See also [`ChannelDetails::balance_msat`] + * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. @@ -15686,7 +17878,7 @@ void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new inbound HTLCs). * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. @@ -15699,7 +17891,7 @@ uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new inbound HTLCs). * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. @@ -15823,7 +18015,7 @@ void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr /** * Constructs a new ChannelDetails given each field */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); +MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); /** * Creates a copy of the ChannelDetails @@ -15858,7 +18050,7 @@ struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDK /** * Utility method to constructs a new PartialFailure-variant PaymentSendFailure */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a); +struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); /** * Constructs a new ChannelManager to hold several channels and route between them. @@ -16035,12 +18227,32 @@ MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_ * * Errors returned are a superset of those returned from [`send_payment`], so see * [`send_payment`] documentation for more details on errors. This method will also error if the - * retry amount puts the payment more than 10% over the payment's total amount, or if the payment - * for the given `payment_id` cannot be found (likely due to timeout or success). + * retry amount puts the payment more than 10% over the payment's total amount, if the payment + * for the given `payment_id` cannot be found (likely due to timeout or success), or if + * further retries have been disabled with [`abandon_payment`]. * * [`send_payment`]: [`ChannelManager::send_payment`] + * [`abandon_payment`]: [`ChannelManager::abandon_payment`] + */ +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); + +/** + * Signals that no further retries for the given payment will occur. + * + * After this method returns, any future calls to [`retry_payment`] for the given `payment_id` + * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated, + * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining + * pending HTLCs for this payment. + * + * Note that calling this method does *not* prevent a payment from succeeding. You must still + * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to + * determine the ultimate status of a payment. + * + * [`retry_payment`]: Self::retry_payment + * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`Event::PaymentSent`]: events::Event::PaymentSent */ -MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** * Send a spontaneous payment, which is a payment that does not require the recipient to have @@ -16068,7 +18280,8 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. * - * Panics if a funding transaction has already been provided for this channel. + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. * * May panic if the output found in the funding transaction is duplicative with some other * channel (note that this should be trivially prevented by using unique funding transaction @@ -16083,6 +18296,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ * create a new channel with a conflicting funding transaction. * * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction); @@ -16140,19 +18354,21 @@ void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_ MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * Provides a payment preimage in response to a PaymentReceived event, returning true and - * generating message events for the net layer to claim the payment, if possible. Thus, you - * should probably kick the net layer to go send messages if this returns true! + * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any + * [`MessageSendEvent`]s needed to claim the payment. * * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived` * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * - * May panic if called except in response to a PaymentReceived event. + * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now + * pending for processing via [`get_and_clear_pending_msg_events`]. * + * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); @@ -16161,36 +18377,12 @@ MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NON */ MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); -/** - * Restores a single, given channel to normal operation after a - * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update - * operation. - * - * All ChannelMonitor updates up to and including highest_applied_update_id must have been - * fully committed in every copy of the given channels' ChannelMonitors. - * - * Note that there is no effect to calling with a highest_applied_update_id other than the - * current latest ChannelMonitorUpdate and one call to this function after multiple - * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field - * exists largely only to prevent races between this and concurrent update_monitor calls. - * - * Thus, the anticipated use is, at a high level: - * 1) You register a chain::Watch with this ChannelManager, - * 2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of - * said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures - * any time it cannot do so instantly, - * 3) update(s) are applied to each remote copy of a ChannelMonitor, - * 4) once all remote copies are updated, you call this function with the update_id that - * completed, and once it is the latest the Channel will be re-enabled. - */ -void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id); - /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing * to pay us. * * This differs from [`create_inbound_payment_for_hash`] only in that it generates the - * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second. + * [`PaymentHash`] and [`PaymentPreimage`] for you. * * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be @@ -16198,12 +18390,33 @@ void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONN * * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * * [`claim_funds`]: Self::claim_funds * [`PaymentReceived`]: events::Event::PaymentReceived * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + +/** + * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. + * + * # Note + * This method is deprecated and will be removed soon. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + */ +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); /** * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is @@ -16213,14 +18426,9 @@ MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_i * payment secret fetched via this method or [`create_inbound_payment`], and which is at least * the `min_value_msat` provided here, if one is provided. * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This - * method may return an Err if another payment with the same payment_hash is still pending. - * - * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to - * allow tracking of which events correspond with which calls to this and - * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply - * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events - * with invoice metadata stored elsewhere. + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. * * `min_value_msat` should be set if the invoice being generated contains a value. Any payment * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` @@ -16239,20 +18447,44 @@ MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_i * If you need exact expiry semantics, you should enforce them upon receipt of * [`PaymentReceived`]. * - * Pending inbound payments are stored in memory and in serialized versions of this - * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and - * space is limited, you may wish to rate-limit inbound payment creation. - * * May panic if `invoice_expiry_delta_secs` is greater than one year. * - * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` - * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. + * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` + * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`PaymentReceived`]: events::Event::PaymentReceived + */ +MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + +/** + * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. + * + * # Note + * This method is deprecated and will be removed soon. + * + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + */ +MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + +/** + * Gets an LDK-generated payment preimage from a payment hash and payment secret that were + * previously returned from [`create_inbound_payment`]. * * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentReceived`]: events::Event::PaymentReceived - * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id */ -MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); +MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. @@ -16283,7 +18515,8 @@ struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONN * indicating whether persistence is necessary. Only one listener on * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken * up. - * Note that the feature `allow_wallclock_use` must be enabled to use this function. + * + * Note that this method is not available with the `no-std` feature. */ MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); @@ -16737,6 +18970,24 @@ uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR t */ void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); +/** + * The channel type that this channel will represent. If none is set, we derive the channel + * type from the intersection of our feature bits with our counterparty's feature bits from + * the Init message. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); + +/** + * The channel type that this channel will represent. If none is set, we derive the channel + * type from the intersection of our feature bits with our counterparty's feature bits from + * the Init message. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); + /** * Creates a copy of the OpenChannel */ @@ -17604,7 +19855,7 @@ struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port) /** * Utility method to constructs a new OnionV2-variant NetAddress */ -struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port); +struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); /** * Utility method to constructs a new OnionV3-variant NetAddress @@ -17616,11 +19867,6 @@ struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey */ struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); -/** - * Read a Result from a byte array, created by Result_write - */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); - /** * Read a NetAddress from a byte array, created by NetAddress_write */ @@ -18256,6 +20502,11 @@ struct LDKErrorAction ErrorAction_ignore_error(void); */ struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); +/** + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction + */ +struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); + /** * Utility method to constructs a new SendErrorMessage-variant ErrorAction */ @@ -18971,6 +21222,13 @@ void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR th */ void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); +/** + * Disconnects all currently-connected peers. This is useful on platforms where there may be + * an indication that TCP sockets have stalled even if we weren't around to time them out + * using regular ping/pongs. + */ +void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); + /** * Send pings to each peer and disconnect those which did not respond to the last round of * pings. @@ -18986,6 +21244,16 @@ void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR */ void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +/** + * Gets the weight for an HTLC-Success transaction. + */ +uint64_t htlc_success_tx_weight(bool opt_anchors); + +/** + * Gets the weight for an HTLC-Timeout transaction. + */ +uint64_t htlc_timeout_tx_weight(bool opt_anchors); + /** * Build the commitment secret from the seed and the commitment number */ @@ -19325,7 +21593,7 @@ struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc * does not need to have its previous_output_index filled. */ -struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** * Gets the redeemscript for a funding output from the two funding public keys. @@ -19342,7 +21610,17 @@ struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, st * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the * commitment transaction). */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + +/** + * Gets the witnessScript for an anchor output from the funding public key. + * The witness in the spending input must be: + * + * After 16 blocks of confirmation, an alternative satisfying witness could be: + * <> + * (empty vector required to satisfy compliance with MINIMALIF-standard rule) + */ +struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. @@ -19411,10 +21689,20 @@ struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struc */ void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); +/** + * Are anchors used for this channel. Boolean is serialization backwards-compatible + */ +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Are anchors used for this channel. Boolean is serialization backwards-compatible + */ +void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); + /** * Constructs a new ChannelTransactionParameters given each field */ -MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg); /** * Creates a copy of the ChannelTransactionParameters @@ -19531,6 +21819,11 @@ MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct */ MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +/** + * Whether to use anchors for this channel + */ +MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + /** * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. */ @@ -19641,6 +21934,16 @@ MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LD */ void ClosingTransaction_free(struct LDKClosingTransaction this_obj); +/** + * Creates a copy of the ClosingTransaction + */ +struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); + +/** + * Checks if two ClosingTransactions contain equal inner contents. + */ +uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); + /** * Construct an object of the class */ @@ -19789,6 +22092,11 @@ MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_b */ MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +/** + * Should anchors be used. + */ +MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + /** * Get a signature for each HTLC which was included in the commitment transaction (ie for * which HTLCOutputInCommitment::transaction_output_index.is_some()). @@ -19835,6 +22143,13 @@ bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const st */ bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); +/** + * Checks if two ChannelTypeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); + /** * Creates a copy of the InitFeatures */ @@ -19855,6 +22170,11 @@ struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures */ struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); +/** + * Creates a copy of the ChannelTypeFeatures + */ +struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); + /** * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ @@ -19875,6 +22195,11 @@ void ChannelFeatures_free(struct LDKChannelFeatures this_obj); */ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); +/** + * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. + */ +void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); + /** * Create a blank Features with no features set */ @@ -19940,19 +22265,20 @@ MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void); MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Returns whether the `payment_secret` feature is supported. + * Create a blank Features with no features set */ -MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); /** - * Returns whether the `payment_secret` feature is supported. + * Creates a Features with the bits set which are known by the implementation */ -MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void); /** - * Returns whether the `payment_secret` feature is supported. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read @@ -19960,9 +22286,9 @@ MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoic struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); /** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + * Read a InitFeatures from a byte array, created by InitFeatures_write */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); /** * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read @@ -19970,14 +22296,14 @@ struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); /** - * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write */ -struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); /** - * Read a InitFeatures from a byte array, created by InitFeatures_write + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); /** * Read a NodeFeatures from a byte array, created by NodeFeatures_write @@ -19985,15 +22311,25 @@ struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice s struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); /** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); +struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); /** * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write */ struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); +/** + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + */ +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); + +/** + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); + /** * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ @@ -20028,6 +22364,11 @@ void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_P */ MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); +/** + * Creates a copy of the InvalidShutdownScript + */ +struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); + /** * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read */ @@ -20089,11 +22430,6 @@ void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); */ void Type_free(struct LDKType this_ptr); -/** - * Calls the free function if one is set - */ -void Score_free(struct LDKScore this_ptr); - /** * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. */ @@ -20174,6 +22510,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 @@ -20185,16 +22526,6 @@ struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGra */ void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); -/** - * Representation of the payment channel network - */ -struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr); - -/** - * Representation of the payment channel network - */ -void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val); - /** * Creates a new tracker of the actual state of the network of channels and nodes, * assuming an existing Network Graph. @@ -20202,7 +22533,7 @@ void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_ * channel data is correct, and that the announcement is signed with * channel owners' keys. */ -MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); +MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); /** * Adds a provider used to check new announcements. Does not affect @@ -20423,11 +22754,6 @@ struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct */ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); -/** - * Constructs a new ChannelInfo given each field - */ -MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); - /** * Creates a copy of the ChannelInfo */ @@ -20737,6 +23063,20 @@ void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNUL */ void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); +/** + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. + * + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. + * + * This function takes the current unix time as an argument. For users with the `std` feature + * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable. + */ +void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); + /** * For an already known (from announcement) channel, update info about one of the directions * of the channel. @@ -20744,6 +23084,9 @@ void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); @@ -20751,6 +23094,9 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(c * For an already known (from announcement) channel, update info about one of the directions * of the channel without verifying the associated signatures. Because we aren't given the * associated signatures here we cannot relay the channel update to any of our peers. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); @@ -20856,93 +23202,280 @@ uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); +bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); + +/** + * Serialize the RouteHop object into a byte array which can be read by RouteHop_read + */ +struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); + +/** + * Read a RouteHop from a byte array, created by RouteHop_write + */ +struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. + */ +void Route_free(struct LDKRoute this_obj); + +/** + * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the + * last RouteHop in each path must be the same. + * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the + * destination. Thus, this must always be at least length one. While the maximum length of any + * given path is variable, keeping the length of any path to less than 20 should currently + * ensure it is viable. + */ +struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); + +/** + * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the + * last RouteHop in each path must be the same. + * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the + * destination. Thus, this must always be at least length one. While the maximum length of any + * given path is variable, keeping the length of any path to less than 20 should currently + * ensure it is viable. + */ +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); + +/** + * The `payee` parameter passed to [`find_route`]. + * This is used by `ChannelManager` to track information which may be required for retries, + * provided back to you via [`Event::PaymentPathFailed`]. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr); + +/** + * The `payee` parameter passed to [`find_route`]. + * This is used by `ChannelManager` to track information which may be required for retries, + * provided back to you via [`Event::PaymentPathFailed`]. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val); + +/** + * Constructs a new Route given each field + */ +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg); + +/** + * Creates a copy of the Route + */ +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); + +/** + * Checks if two Routes contain equal inner contents. + */ +uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); + +/** + * Checks if two Routes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); + +/** + * Returns the total amount of fees paid on this [`Route`]. + * + * This doesn't include any extra payment made to the recipient, which can happen in excess of + * the amount passed to [`find_route`]'s `params.final_value_msat`. + */ +MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); + +/** + * Returns the total amount paid on this [`Route`], excluding the fees. + */ +MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); + +/** + * Serialize the Route object into a byte array which can be read by Route_read + */ +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); + +/** + * Read a Route from a byte array, created by Route_write + */ +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. + */ +void RouteParameters_free(struct LDKRouteParameters this_obj); + +/** + * The recipient of the failed payment path. + */ +struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + +/** + * The recipient of the failed payment path. + */ +void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val); + +/** + * The amount in msats sent on the failed payment path. + */ +uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + +/** + * The amount in msats sent on the failed payment path. + */ +void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The CLTV on the final hop of the failed payment path. + */ +uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + +/** + * The CLTV on the final hop of the failed payment path. + */ +void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Constructs a new RouteParameters given each field + */ +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg); + +/** + * Creates a copy of the RouteParameters + */ +struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); + +/** + * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read + */ +struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); + +/** + * Read a RouteParameters from a byte array, created by RouteParameters_write + */ +struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL. + */ +void Payee_free(struct LDKPayee this_obj); + +/** + * The node id of the payee. + */ +struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr); + +/** + * The node id of the payee. + */ +void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Serialize the RouteHop object into a byte array which can be read by RouteHop_read + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); +void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); /** - * Read a RouteHop from a byte array, created by RouteHop_write + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); +struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -void Route_free(struct LDKRoute this_obj); +void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val); /** - * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the - * last RouteHop in each path must be the same. - * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the - * destination. Thus, this must always be at least length one. While the maximum length of any - * given path is variable, keeping the length of any path to less than 20 should currently - * ensure it is viable. + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the - * last RouteHop in each path must be the same. - * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the - * destination. Thus, this must always be at least length one. While the maximum length of any - * given path is variable, keeping the length of any path to less than 20 should currently - * ensure it is viable. + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); +void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new Route given each field + * Constructs a new Payee given each field */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); +MUST_USE_RES struct LDKPayee Payee_new(struct LDKPublicKey pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg); /** - * Creates a copy of the Route + * Creates a copy of the Payee */ -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); +struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); /** - * Checks if two Routes contain equal inner contents. + * Checks if two Payees contain equal inner contents. */ -uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); +uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); /** - * Checks if two Routes contain equal inner contents. + * Checks if two Payees contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); +bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); /** - * Returns the total amount of fees paid on this [`Route`]. - * - * This doesn't include any extra payment made to the recipient, which can happen in excess of - * the amount passed to [`get_route`]'s `final_value_msat`. + * Serialize the Payee object into a byte array which can be read by Payee_read */ -MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj); /** - * Returns the total amount paid on this [`Route`], excluding the fees. + * Read a Payee from a byte array, created by Payee_write */ -MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); +struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser); /** - * Serialize the Route object into a byte array which can be read by Route_read + * Creates a payee with the node id of the given `pubkey`. */ -struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); +MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey); /** - * Read a Route from a byte array, created by Route_write + * Creates a payee with the node id of the given `pubkey` to use for keysend payments. */ -struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey); /** * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. */ void RouteHint_free(struct LDKRouteHint this_obj); +struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); + +void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); + +/** + * Constructs a new RouteHint given each field + */ +MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); + /** * Creates a copy of the RouteHint */ @@ -20960,6 +23493,16 @@ uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); */ bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); +/** + * Serialize the RouteHint object into a byte array which can be read by RouteHint_read + */ +struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); + +/** + * Read a RouteHint from a byte array, created by RouteHint_write + */ +struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); + /** * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. */ @@ -21048,39 +23591,68 @@ uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); /** - * Gets a keysend route from us (payer) to the given target node (payee). This is needed because - * keysend payments do not have an invoice from which to pull the payee's supported features, which - * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`. - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read + */ +struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); + +/** + * Read a RouteHintHop from a byte array, created by RouteHintHop_write */ -struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); +struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); /** - * Gets a route from us (payer) to the given target node (payee). + * Finds a route from us (payer) to the given target node (payee). * - * If the payee provided features in their invoice, they should be provided via payee_features. + * If the payee provided features in their invoice, they should be provided via `params.payee`. * Without this, MPP will only be used if the payee's features are available in the network graph. * - * Private routing paths between a public node and the target may be included in `last_hops`. - * Currently, only the last hop in each path is considered. + * Private routing paths between a public node and the target may be included in `params.payee`. + * + * If some channels aren't announced, it may be useful to fill in `first_hops` with the results + * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local + * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used. + * + * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. + * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / + * `htlc_maximum_msat` *are* checked as they may change based on the receiving node. + * + * # Note + * + * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any + * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this + * function. * - * If some channels aren't announced, it may be useful to fill in a first_hops with the - * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our - * view of our local channels (from net_graph_msg_handler) will be ignored, and only those - * in first_hops will be used. + * # Panics * - * Panics if first_hops contains channels without short_channel_ids - * (ChannelManager::list_usable_channels will never include such channels). + * Panics if first_hops contains channels without short_channel_ids; + * [`ChannelManager::list_usable_channels`] will never include such channels. * - * The fees on channels from us to next-hops are ignored (as they are assumed to all be - * equal), however the enabled/disabled bit on such channels as well as the - * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node. + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed * - * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + +/** + * Calls the free function if one is set + */ +void Score_free(struct LDKScore this_ptr); + +/** + * Calls the free function if one is set + */ +void LockableScore_free(struct LDKLockableScore this_ptr); + +/** + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. + */ +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); + +/** + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + */ +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL. @@ -21088,21 +23660,166 @@ struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pu void Scorer_free(struct LDKScorer this_obj); /** - * Creates a new scorer using `base_penalty_msat` as the channel penalty. + * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL. + */ +void ScoringParameters_free(struct LDKScoringParameters this_obj); + +/** + * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat + */ +uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + +/** + * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat + */ +void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * A penalty in msats to apply to a channel upon failing to relay a payment. + * + * This accumulates for each failure but may be reduced over time based on + * [`failure_penalty_half_life`] or when successfully routing through a channel. + * + * Default value: 1,024,000 msat + * + * [`failure_penalty_half_life`]: Self::failure_penalty_half_life + */ +uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + +/** + * A penalty in msats to apply to a channel upon failing to relay a payment. + * + * This accumulates for each failure but may be reduced over time based on + * [`failure_penalty_half_life`] or when successfully routing through a channel. + * + * Default value: 1,024,000 msat + * + * [`failure_penalty_half_life`]: Self::failure_penalty_half_life + */ +void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * When the amount being sent over a channel is this many 1024ths of the total channel + * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. + * + * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) + * + * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + */ +uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + +/** + * When the amount being sent over a channel is this many 1024ths of the total channel + * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. + * + * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) + * + * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + */ +void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val); + +/** + * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent + * over the channel exceeds [`overuse_penalty_start_1024th`] by. + * + * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty + * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) + * + * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + */ +uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + +/** + * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent + * over the channel exceeds [`overuse_penalty_start_1024th`] by. + * + * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty + * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) + * + * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + */ +void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are + * cut in half. + * + * Successfully routing through a channel will immediately cut the penalty in half as well. + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will + * never decay. + * + * [`failure_penalty_msat`]: Self::failure_penalty_msat + */ +uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + +/** + * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are + * cut in half. + * + * Successfully routing through a channel will immediately cut the penalty in half as well. + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will + * never decay. + * + * [`failure_penalty_msat`]: Self::failure_penalty_msat + */ +void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ScoringParameters given each field + */ +MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg); + +/** + * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read + */ +struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); + +/** + * Read a ScoringParameters from a byte array, created by ScoringParameters_write + */ +struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser); + +/** + * Creates a new scorer using the given scoring parameters. */ -MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat); +MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params); /** * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used. */ MUST_USE_RES struct LDKScorer Scorer_default(void); +/** + * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void); + /** * Constructs a new Score which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg); +/** + * Serialize the Scorer object into a byte array which can be read by Scorer_read + */ +struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj); + +/** + * Read a Scorer from a byte array, created by Scorer_write + */ +struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser); + /** * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL. */ @@ -21172,7 +23889,7 @@ void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr); * functionality implemented by other handlers. * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures. * - * [top-level documentation]: Self + * [top-level documentation]: BackgroundProcessor * [`join`]: Self::join * [`stop`]: Self::stop * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager @@ -21459,6 +24176,15 @@ bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDK */ void PayeePubKey_free(struct LDKPayeePubKey this_obj); +struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr); + +void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new PayeePubKey given each field + */ +MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg); + /** * Creates a copy of the PayeePubKey */ @@ -21503,6 +24229,15 @@ bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKEx */ void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj); +uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr); + +void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new MinFinalCltvExpiry given each field + */ +MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg); + /** * Creates a copy of the MinFinalCltvExpiry */ @@ -21766,7 +24501,7 @@ MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice * /** * Get the payment secret if one was included in the invoice */ -MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg); +MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32]; /** * Get the invoice features if they were included in the invoice @@ -21785,6 +24520,11 @@ MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKI */ MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg); +/** + * Returns whether the invoice has expired. + */ +MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg); + /** * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. @@ -21807,9 +24547,9 @@ MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoi MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg); /** - * Returns the amount if specified in the invoice as pico . + * Returns the amount if specified in the invoice as millisatoshis. */ -MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg); /** * Creates a new `Description` if `description` is at most 1023 __bytes__ long, @@ -21883,6 +24623,11 @@ enum LDKCreationError CreationError_timestamp_out_of_bounds(void); */ enum LDKCreationError CreationError_expiry_time_out_of_bounds(void); +/** + * Utility method to constructs a new InvalidAmount-variant CreationError + */ +enum LDKCreationError CreationError_invalid_amount(void); + /** * Checks if two CreationErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -21991,6 +24736,127 @@ bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, */ struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); +/** + * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL. + */ +void InvoicePayer_free(struct LDKInvoicePayer this_obj); + +/** + * Calls the free function if one is set + */ +void Payer_free(struct LDKPayer this_ptr); + +/** + * Calls the free function if one is set + */ +void Router_free(struct LDKRouter this_ptr); + +/** + * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL. + */ +void RetryAttempts_free(struct LDKRetryAttempts this_obj); + +uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr); + +void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val); + +/** + * Constructs a new RetryAttempts given each field + */ +MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg); + +/** + * Creates a copy of the RetryAttempts + */ +struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig); + +/** + * Checks if two RetryAttemptss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b); + +/** + * Checks if two RetryAttemptss contain equal inner contents. + */ +uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o); + +/** + * Frees any resources used by the PaymentError + */ +void PaymentError_free(struct LDKPaymentError this_ptr); + +/** + * Creates a copy of the PaymentError + */ +struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Invoice-variant PaymentError + */ +struct LDKPaymentError PaymentError_invoice(struct LDKStr a); + +/** + * Utility method to constructs a new Routing-variant PaymentError + */ +struct LDKPaymentError PaymentError_routing(struct LDKLightningError a); + +/** + * Utility method to constructs a new Sending-variant PaymentError + */ +struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); + +/** + * Creates an invoice payer that retries failed payment paths. + * + * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once + * `retry_attempts` has been exceeded for a given [`Invoice`]. + */ +MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); + +/** + * Pays the given [`Invoice`], caching it for later use in case a retry is needed. + * + * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has + * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so + * for you. + */ +MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); + +/** + * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in + * case a retry is needed. + * + * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has + * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so + * for you. + */ +MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats); + +/** + * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in + * case a retry is needed. + * + * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never + * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. + */ +MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); + +/** + * Removes the payment cached by the given payment hash. + * + * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an + * [`EventHandler`]. Otherwise, calling this method is unnecessary. + */ +void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); + +/** + * 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 + */ +struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); + /** * Utility to construct an invoice. Generally, unless you want to do something like a custom * cltv_expiry, this is what you should be using to create an invoice. The reason being, this @@ -22000,6 +24866,28 @@ struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NO */ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description); +/** + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + */ +void DefaultRouter_free(struct LDKDefaultRouter this_obj); + +/** + * Creates a new router using the given [`NetworkGraph`] and [`Logger`]. + */ +MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); + +/** + * Constructs a new Router which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is + */ +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); + +/** + * Constructs a new Payer which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is + */ +struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg); + /** * Read a SiPrefix object from a string */