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=9529ff757c0d6da158cb10c1619fa62a6130bcbb;hb=dd5bf474af6c806b20c26f4f2b751f3226a94dfd;hpb=ed6eb46f7b4e0d4c869ad08dffc600b4e93e2129 diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 9529ff7..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 */ @@ -328,6 +358,11 @@ typedef enum LDKSemanticError { * The invoice contains multiple descriptions and/or description hashes which isn't allowed */ LDKSemanticError_MultipleDescriptions, + /** + * The invoice is missing the mandatory payment secret, which all modern lightning nodes + * should provide. + */ + LDKSemanticError_NoPaymentSecret, /** * The invoice contains multiple payment secrets */ @@ -344,6 +379,10 @@ typedef enum LDKSemanticError { * The invoice's signature is invalid */ LDKSemanticError_InvalidSignature, + /** + * The invoice's amount was not a whole number of millisatoshis + */ + LDKSemanticError_ImpreciseAmount, /** * Must be last for serialization purposes */ @@ -1040,7 +1079,64 @@ typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ { /** - * This class tracks the per-transaction information needed to build a commitment transaction and to + * A wrapper on ClosingTransaction indicating that the built bitcoin + * transaction is trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. + */ +typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeTrustedClosingTransaction *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; +} LDKTrustedClosingTransaction; + +/** + * The contents of CResult_TrustedClosingTransactionNoneZ + */ +typedef union LDKCResult_TrustedClosingTransactionNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTrustedClosingTransaction *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_TrustedClosingTransactionNoneZPtr; + +/** + * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_TrustedClosingTransactionNoneZ { + /** + * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TrustedClosingTransactionNoneZPtr contents; + /** + * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_TrustedClosingTransactionNoneZ; + + + +/** + * This class tracks the per-transaction information needed to build a commitment transaction and will * actually build it and sign. It is used for holder transactions that we sign only when needed * and for transactions we sign for the counterparty. * @@ -1463,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 */ @@ -1493,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 list of hops along a payment path terminating with a channel to the recipient. + * 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 MUST_USE_STRUCT LDKRouteHint { +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; + + + +/** + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + */ +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; @@ -1722,7 +2031,7 @@ typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr { /** * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure. + * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { @@ -1791,23 +2100,56 @@ typedef enum LDKMonitorEvent_Tag { */ LDKMonitorEvent_HTLCEvent, /** - * A monitor event that the Channel's commitment transaction was broadcasted. + * 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_CommitmentTxBroadcasted, + LDKMonitorEvent_UpdateFailed, /** * Must be last for serialization purposes */ LDKMonitorEvent_Sentinel, } LDKMonitorEvent_Tag; -typedef struct MUST_USE_STRUCT LDKMonitorEvent { - LDKMonitorEvent_Tag tag; - union { - struct { +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 { + struct { struct LDKHTLCUpdate htlc_event; }; struct { - struct LDKOutPoint commitment_tx_broadcasted; + struct LDKOutPoint commitment_tx_confirmed; + }; + LDKMonitorEvent_LDKUpdateCompleted_Body update_completed; + struct { + struct LDKOutPoint update_failed; }; }; } LDKMonitorEvent; @@ -1855,6 +2197,262 @@ typedef struct LDKCOption_C2Tuple_usizeTransactionZZ { }; } LDKCOption_C2Tuple_usizeTransactionZZ; +/** + * The reason the channel was closed. See individual variants more details. + */ +typedef enum LDKClosureReason_Tag { + /** + * Closure generated from receiving a peer error message. + * + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. + */ + LDKClosureReason_CounterpartyForceClosed, + /** + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + */ + LDKClosureReason_HolderForceClosed, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. Note the shutdown may have been initiated by us. + */ + LDKClosureReason_CooperativeClosure, + /** + * A commitment transaction was confirmed on chain, closing the channel. Most likely this + * commitment transaction came from our counterparty, but it may also have come from + * a copy of our own `ChannelMonitor`. + */ + LDKClosureReason_CommitmentTxConfirmed, + /** + * 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 + * [`NetworkGraph::fail_node`]. + */ + LDKNetworkUpdate_NodeFailure, + /** + * Must be last for serialization purposes + */ + LDKNetworkUpdate_Sentinel, +} LDKNetworkUpdate_Tag; + +typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { + /** + * The update to apply via [`NetworkGraph::update_channel`]. + */ + struct LDKChannelUpdate msg; +} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + +typedef struct LDKNetworkUpdate_LDKChannelClosed_Body { + /** + * The short channel id of the closed channel. + */ + uint64_t short_channel_id; + /** + * Whether the channel should be permanently removed or temporarily disabled until a new + * `channel_update` message is received. + */ + bool is_permanent; +} LDKNetworkUpdate_LDKChannelClosed_Body; + +typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { + /** + * The node id of the failed node. + */ + struct LDKPublicKey node_id; + /** + * Whether the node should be permanently removed from consideration or can be restored + * when a new `channel_update` message is received. + */ + bool is_permanent; +} LDKNetworkUpdate_LDKNodeFailure_Body; + +typedef struct MUST_USE_STRUCT LDKNetworkUpdate { + LDKNetworkUpdate_Tag tag; + union { + LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message; + LDKNetworkUpdate_LDKChannelClosed_Body channel_closed; + LDKNetworkUpdate_LDKNodeFailure_Body node_failure; + }; +} LDKNetworkUpdate; + +/** + * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not + */ +typedef enum LDKCOption_NetworkUpdateZ_Tag { + /** + * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate + */ + LDKCOption_NetworkUpdateZ_Some, + /** + * When we're in this state, this COption_NetworkUpdateZ contains nothing + */ + LDKCOption_NetworkUpdateZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NetworkUpdateZ_Sentinel, +} LDKCOption_NetworkUpdateZ_Tag; + +typedef struct LDKCOption_NetworkUpdateZ { + LDKCOption_NetworkUpdateZ_Tag tag; + union { + struct { + struct LDKNetworkUpdate some; + }; + }; +} LDKCOption_NetworkUpdateZ; + /** @@ -2000,818 +2598,1240 @@ 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 { +typedef struct LDKEvent_LDKPaymentReceived_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 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. */ - LDKnativeChannelReestablish *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 value, in thousandths of a satoshi, that this payment is for. */ - bool is_owned; -} LDKChannelReestablish; - - + uint64_t amt; + /** + * Information for claiming this received payment, based on whether the purpose of the + * payment is to pay an invoice or to send a spontaneous payment. + */ + struct LDKPaymentPurpose purpose; +} LDKEvent_LDKPaymentReceived_Body; -/** - * A channel_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { +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 */ - LDKnativeChannelAnnouncement *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; -} LDKChannelAnnouncement; - - - -/** - * A channel_update message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { + 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 */ - LDKnativeChannelUpdate *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; -} LDKChannelUpdate; - - + struct LDKCOption_u64Z fee_paid_msat; +} LDKEvent_LDKPaymentSent_Body; -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { +typedef struct LDKEvent_LDKPaymentPathFailed_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`] 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 */ - 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 hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - bool is_owned; -} LDKNodeAnnouncement; - - - -/** - * An error message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKErrorMessage { + 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. + * 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. */ - LDKnativeErrorMessage *inner; + bool rejected_by_dest; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * 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 */ - bool is_owned; -} LDKErrorMessage; - -/** - * Used to put an error message in a LightningError - */ -typedef enum LDKErrorAction_Tag { + struct LDKCOption_NetworkUpdateZ network_update; /** - * The peer took some action which made us think they were useless. Disconnect them. + * 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 */ - LDKErrorAction_DisconnectPeer, + bool all_paths_failed; /** - * The peer did something harmless that we weren't able to process, just log and ignore + * The payment path that failed. */ - LDKErrorAction_IgnoreError, + struct LDKCVec_RouteHopZ path; /** - * 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 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. */ - LDKErrorAction_IgnoreAndLog, + struct LDKCOption_u64Z short_channel_id; /** - * The peer did something incorrect. Tell them. + * 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 */ - LDKErrorAction_SendErrorMessage, + struct LDKRouteParameters retry; +} LDKEvent_LDKPaymentPathFailed_Body; + +typedef struct LDKEvent_LDKPaymentFailed_Body { /** - * Must be last for serialization purposes + * 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 */ - LDKErrorAction_Sentinel, -} LDKErrorAction_Tag; - -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { + struct LDKThirtyTwoBytes payment_id; /** - * An error message which we should make an effort to send before we disconnect. + * The hash that was given to [`ChannelManager::send_payment`]. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; + struct LDKThirtyTwoBytes payment_hash; +} LDKEvent_LDKPaymentFailed_Body; -typedef struct LDKErrorAction_LDKSendErrorMessage_Body { +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { /** - * The message to send. + * The minimum amount of time that should be waited prior to calling + * process_pending_htlc_forwards. To increase the effort required to correlate payments, + * you should wait a random amount of time in roughly the range (now + time_forwardable, + * now + 5*time_forwardable). */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; -typedef struct MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag tag; - union { - LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; - struct { - enum LDKLevel ignore_and_log; - }; - LDKErrorAction_LDKSendErrorMessage_Body send_error_message; - }; -} LDKErrorAction; +typedef struct LDKEvent_LDKSpendableOutputs_Body { + /** + * The outputs which you should store as spendable by you. + */ + struct LDKCVec_SpendableOutputDescriptorZ outputs; +} LDKEvent_LDKSpendableOutputs_Body; -/** - * The information we received from a peer along the route of a payment we originated. This is - * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into - * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map. - */ -typedef enum LDKHTLCFailChannelUpdate_Tag { +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; /** - * We received an error which included a full ChannelUpdate message. + * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain + * transaction. */ - LDKHTLCFailChannelUpdate_ChannelUpdateMessage, + bool claim_from_onchain_tx; +} LDKEvent_LDKPaymentForwarded_Body; + +typedef struct LDKEvent_LDKChannelClosed_Body { /** - * We received an error which indicated only that a channel has been closed + * The channel_id of the channel which has been closed. Note that on-chain transactions + * resolving the channel are likely still awaiting confirmation. */ - LDKHTLCFailChannelUpdate_ChannelClosed, + struct LDKThirtyTwoBytes channel_id; /** - * We received an error which indicated only that a node has failed + * 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 */ - LDKHTLCFailChannelUpdate_NodeFailure, + uint64_t user_channel_id; /** - * Must be last for serialization purposes + * The reason the channel was closed. */ - LDKHTLCFailChannelUpdate_Sentinel, -} LDKHTLCFailChannelUpdate_Tag; + struct LDKClosureReason reason; +} LDKEvent_LDKChannelClosed_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body { +typedef struct LDKEvent_LDKDiscardFunding_Body { /** - * The unwrapped message we received + * The channel_id of the channel which has been closed. */ - struct LDKChannelUpdate msg; -} LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body; + struct LDKThirtyTwoBytes channel_id; + /** + * The full transaction received from the user + */ + struct LDKTransaction transaction; +} LDKEvent_LDKDiscardFunding_Body; -typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body { +typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { /** - * The short_channel_id which has now closed. + * 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 */ - uint64_t short_channel_id; + struct LDKThirtyTwoBytes payment_id; /** - * when this true, this channel should be permanently removed from the - * consideration. Otherwise, this channel can be restored as new channel_update is received + * 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 */ - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKChannelClosed_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 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; -typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body { +/** + * An enum which can either contain a crate::lightning::util::events::Event or not + */ +typedef enum LDKCOption_EventZ_Tag { /** - * The node_id that has failed. + * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event */ - struct LDKPublicKey node_id; + LDKCOption_EventZ_Some, /** - * when this true, node should be permanently removed from the - * consideration. Otherwise, the channels connected to this node can be - * restored as new channel_update is received + * When we're in this state, this COption_EventZ contains nothing */ - bool is_permanent; -} LDKHTLCFailChannelUpdate_LDKNodeFailure_Body; + LDKCOption_EventZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_EventZ_Sentinel, +} LDKCOption_EventZ_Tag; -typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate { - LDKHTLCFailChannelUpdate_Tag tag; +typedef struct LDKCOption_EventZ { + LDKCOption_EventZ_Tag tag; union { - LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message; - LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed; - LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure; + struct { + struct LDKEvent some; + }; }; -} LDKHTLCFailChannelUpdate; +} LDKCOption_EventZ; + +/** + * The contents of CResult_COption_EventZDecodeErrorZ + */ +typedef union LDKCResult_COption_EventZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_EventZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_COption_EventZDecodeErrorZPtr; + +/** + * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_EventZDecodeErrorZ { + /** + * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_EventZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_EventZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_EventZDecodeErrorZ; /** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. + * An accept_channel message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { +typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryChannelRange *inner; + LDKnativeAcceptChannel *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKQueryChannelRange; +} LDKAcceptChannel; /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * An open_channel message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { +typedef struct MUST_USE_STRUCT LDKOpenChannel { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQueryShortChannelIds *inner; + LDKnativeOpenChannel *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKQueryShortChannelIds; +} LDKOpenChannel; /** - * A reply_channel_range message is a reply to a query_channel_range - * message. Multiple reply_channel_range messages can be sent in reply - * to a single query_channel_range message. The query recipient makes a - * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * A funding_created message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKReplyChannelRange { +typedef struct MUST_USE_STRUCT LDKFundingCreated { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeReplyChannelRange *inner; + LDKnativeFundingCreated *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKReplyChannelRange; +} LDKFundingCreated; + + /** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. + * A funding_signed message to be sent or received from a peer */ -typedef enum LDKMessageSendEvent_Tag { - /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. - */ - LDKMessageSendEvent_SendAcceptChannel, +typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * Used to indicate that we've initiated a channel open and should send the open_channel - * message provided to the given peer. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendOpenChannel, + LDKnativeFundingSigned *inner; /** - * Used to indicate that a funding_created message should be sent to the peer with the given node_id. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendFundingCreated, + bool is_owned; +} LDKFundingSigned; + + + +/** + * A funding_locked message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKFundingLocked { /** - * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMessageSendEvent_SendFundingSigned, + LDKnativeFundingLocked *inner; /** - * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMessageSendEvent_SendFundingLocked, + 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 an announcement_signatures 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_SendAnnouncementSignatures, + LDKnativeAnnouncementSignatures *inner; /** - * 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. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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_UpdateHTLCs, - /** - * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendRevokeAndACK, - /** - * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendClosingSigned, - /** - * Used to indicate that a shutdown message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendShutdown, - /** - * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. - */ - LDKMessageSendEvent_SendChannelReestablish, - /** - * Used to indicate that a channel_announcement and channel_update should be broadcast to all - * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). - * - * Note that after doing so, you very likely (unless you did so very recently) want to call - * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - * This ensures that any nodes which see our channel_announcement also have a relevant - * node_announcement, including relevant feature flags which may be important for routing - * through or to us. - */ - LDKMessageSendEvent_BroadcastChannelAnnouncement, - /** - * Used to indicate that a node_announcement should be broadcast to all peers. - */ - LDKMessageSendEvent_BroadcastNodeAnnouncement, + bool is_owned; +} LDKAnnouncementSignatures; + + + +/** + * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * transaction updates if they were pending. + */ +typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { /** - * Used to indicate that a channel_update 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_BroadcastChannelUpdate, + LDKnativeCommitmentUpdate *inner; /** - * 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. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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_SendChannelUpdate, + bool is_owned; +} LDKCommitmentUpdate; + + + +/** + * A revoke_and_ack message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** - * Broadcast an error downstream to be handled + * A pointer to the opaque Rust object. + * Nearly everywhere, 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_HandleError, + LDKnativeRevokeAndACK *inner; /** - * When a payment fails we may receive updates back from the hop where it failed. In such - * cases this event is generated so that we can inform the network graph of this information. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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_PaymentFailureNetworkUpdate, + bool is_owned; +} LDKRevokeAndACK; + + + +/** + * A closing_signed message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * 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, + LDKnativeClosingSigned *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; +} LDKClosingSigned; + + + +/** + * A shutdown message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKShutdown { /** - * 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, + LDKnativeShutdown *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; +} LDKShutdown; -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { + + +/** + * A channel_reestablish message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * 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; + LDKnativeChannelReestablish *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; +} LDKChannelReestablish; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { + + +/** + * A channel_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** - * The node_id of the node which should receive this message + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey node_id; + LDKnativeChannelAnnouncement *inner; /** - * The message which should be sent. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKOpenChannel msg; -} LDKMessageSendEvent_LDKSendOpenChannel_Body; + bool is_owned; +} LDKChannelAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendFundingCreated_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 LDKFundingCreated msg; -} LDKMessageSendEvent_LDKSendFundingCreated_Body; + bool is_owned; +} LDKNodeAnnouncement; -typedef struct LDKMessageSendEvent_LDKSendFundingSigned_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 LDKFundingSigned msg; -} LDKMessageSendEvent_LDKSendFundingSigned_Body; + bool is_owned; +} LDKErrorMessage; -typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { +/** + * Used to put an error message in a LightningError + */ +typedef enum LDKErrorAction_Tag { /** - * The node_id of the node which should receive these message(s) + * The peer took some action which made us think they were useless. Disconnect them. */ - struct LDKPublicKey node_id; + LDKErrorAction_DisconnectPeer, /** - * The funding_locked message which should be sent. + * The peer did something harmless that we weren't able to process, just log and ignore */ - struct LDKFundingLocked msg; -} LDKMessageSendEvent_LDKSendFundingLocked_Body; - -typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + LDKErrorAction_IgnoreError, /** - * The node_id of the node which should receive these message(s) + * The peer did something harmless that we weren't able to meaningfully process. + * If the error is logged, log it at the given level. */ - struct LDKPublicKey node_id; + LDKErrorAction_IgnoreAndLog, /** - * The announcement_signatures 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 LDKAnnouncementSignatures msg; -} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; - -typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_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 update messages which should be sent. ALL messages in the struct should be sent! + * Must be last for serialization purposes */ - struct LDKCommitmentUpdate updates; -} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; -typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { - /** - * The node_id of the node which should receive this message - */ - struct LDKPublicKey node_id; +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { /** - * The message which should be sent. + * An error message which we should make an effort to send before we disconnect. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKRevokeAndACK msg; -} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; -typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { /** - * The node_id of the node which should receive this message + * The message to send. */ - struct LDKPublicKey node_id; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; + +typedef struct MUST_USE_STRUCT LDKErrorAction { + LDKErrorAction_Tag tag; + union { + LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; + struct { + enum LDKLevel ignore_and_log; + }; + LDKErrorAction_LDKSendErrorMessage_Body send_error_message; + }; +} LDKErrorAction; + + + +/** + * A query_channel_range message is used to query a peer for channel + * UTXOs in a range of blocks. The recipient of a query makes a best + * effort to reply to the query using one or more reply_channel_range + * messages. + */ +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** - * The message which should be sent. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKClosingSigned msg; -} LDKMessageSendEvent_LDKSendClosingSigned_Body; + LDKnativeQueryChannelRange *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKQueryChannelRange; -typedef struct LDKMessageSendEvent_LDKSendShutdown_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 LDKShutdown msg; -} LDKMessageSendEvent_LDKSendShutdown_Body; + bool is_owned; +} LDKQueryShortChannelIds; -typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_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 LDKChannelReestablish msg; -} LDKMessageSendEvent_LDKSendChannelReestablish_Body; + bool is_owned; +} LDKReplyChannelRange; -typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_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 channel_announcement which should be sent. + * Used to indicate that we've accepted a channel open and should send the accept_channel + * message provided to the given peer. */ - struct LDKChannelAnnouncement msg; + LDKMessageSendEvent_SendAcceptChannel, /** - * The followup channel_update 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 LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { + LDKMessageSendEvent_SendOpenChannel, /** - * The node_announcement which should be sent. + * Used to indicate that a funding_created message should be sent to the peer with the given node_id. */ - struct LDKNodeAnnouncement msg; -} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { + LDKMessageSendEvent_SendFundingCreated, /** - * The channel_update which should be sent. + * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; + LDKMessageSendEvent_SendFundingSigned, + /** + * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendFundingLocked, + /** + * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendAnnouncementSignatures, + /** + * Used to indicate that a series of HTLC update messages, as well as a commitment_signed + * message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_UpdateHTLCs, + /** + * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendRevokeAndACK, + /** + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendClosingSigned, + /** + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendShutdown, + /** + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + */ + LDKMessageSendEvent_SendChannelReestablish, + /** + * Used to indicate that a channel_announcement and channel_update should be broadcast to all + * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * + * Note that after doing so, you very likely (unless you did so very recently) want to call + * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. + * This ensures that any nodes which see our channel_announcement also have a relevant + * node_announcement, including relevant feature flags which may be important for routing + * through or to us. + */ + LDKMessageSendEvent_BroadcastChannelAnnouncement, + /** + * Used to indicate that a node_announcement should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastNodeAnnouncement, + /** + * Used to indicate that a channel_update should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastChannelUpdate, + /** + * Used to indicate that a channel_update should be sent to a single peer. + * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a + * private channel and we shouldn't be informing all of our peers of channel parameters. + */ + LDKMessageSendEvent_SendChannelUpdate, + /** + * Broadcast an error downstream to be handled + */ + LDKMessageSendEvent_HandleError, + /** + * Query a peer for channels with funding transaction UTXOs in a block range. + */ + LDKMessageSendEvent_SendChannelRangeQuery, + /** + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. + */ + LDKMessageSendEvent_SendShortIdsQuery, + /** + * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events + * emitted during processing of the query. + */ + LDKMessageSendEvent_SendReplyChannelRange, + /** + * Must be last for serialization purposes + */ + LDKMessageSendEvent_Sentinel, +} LDKMessageSendEvent_Tag; -typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { /** * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The channel_update which should be sent. + * The message which should be sent. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKSendChannelUpdate_Body; + struct LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; -typedef struct LDKMessageSendEvent_LDKHandleError_Body { +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { /** * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The action which should be taken. + * The message which should be sent. */ - struct LDKErrorAction action; -} LDKMessageSendEvent_LDKHandleError_Body; + struct LDKOpenChannel msg; +} LDKMessageSendEvent_LDKSendOpenChannel_Body; -typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; /** - * The channel/node update which should be sent to NetGraphMsgHandler + * The message which should be sent. */ - struct LDKHTLCFailChannelUpdate update; -} LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body; + struct LDKFundingCreated msg; +} LDKMessageSendEvent_LDKSendFundingCreated_Body; -typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive this message */ struct LDKPublicKey node_id; /** - * The query_channel_range which should be sent. + * The message which should be sent. */ - struct LDKQueryChannelRange msg; -} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; + struct LDKFundingSigned msg; +} LDKMessageSendEvent_LDKSendFundingSigned_Body; -typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { +typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive these message(s) */ struct LDKPublicKey node_id; /** - * The query_short_channel_ids which should be sent. + * The funding_locked message which should be sent. */ - struct LDKQueryShortChannelIds msg; -} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; + struct LDKFundingLocked msg; +} LDKMessageSendEvent_LDKSendFundingLocked_Body; -typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { +typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { /** - * The node_id of this message recipient + * The node_id of the node which should receive these message(s) */ struct LDKPublicKey node_id; /** - * The reply_channel_range which should be sent. + * The announcement_signatures message which should be sent. */ - struct LDKReplyChannelRange msg; -} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + struct LDKAnnouncementSignatures msg; +} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; -typedef struct MUST_USE_STRUCT LDKMessageSendEvent { +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; @@ -2830,7 +3850,6 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update; LDKMessageSendEvent_LDKHandleError_Body handle_error; - LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update; LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query; LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range; @@ -2856,108 +3875,168 @@ 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 an `init` message. + */ +typedef struct MUST_USE_STRUCT LDKInitFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInitFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInitFeatures; + +/** + * The contents of CResult_InitFeaturesDecodeErrorZ + */ +typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInitFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_InitFeaturesDecodeErrorZPtr; + +/** + * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::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_InitFeaturesDecodeErrorZ { + /** + * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InitFeaturesDecodeErrorZ; @@ -3015,58 +4094,173 @@ typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { /** - * Features used within an invoice. + * Features used within a `node_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKInvoiceFeatures { +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. */ - LDKnativeInvoiceFeatures *inner; + 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; -} LDKInvoiceFeatures; +} LDKNodeFeatures; /** - * The contents of CResult_InvoiceFeaturesDecodeErrorZ + * The contents of CResult_NodeFeaturesDecodeErrorZ */ -typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr { +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 LDKInvoiceFeatures *result; + 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_InvoiceFeaturesDecodeErrorZPtr; +} LDKCResult_NodeFeaturesDecodeErrorZPtr; /** - * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::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_InvoiceFeaturesDecodeErrorZ { +typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { /** - * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either + * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents; + union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state. + * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceFeaturesDecodeErrorZ; +} LDKCResult_NodeFeaturesDecodeErrorZ; + + /** - * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ + * 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 + */ +typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceFeatures *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_InvoiceFeaturesDecodeErrorZPtr; + +/** + * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::InvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ { + /** + * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state. + */ + 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 */ typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { /** @@ -3164,6 +4358,37 @@ typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ { bool result_ok; } LDKCResult_SpendableOutputDescriptorDecodeErrorZ; +/** + * The contents of CResult_NoneNoneZ + */ +typedef union LDKCResult_NoneNoneZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_NoneNoneZPtr; + +/** + * A CResult_NoneNoneZ represents the result of a fallible operation, + * containing a () on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneNoneZ { + /** + * The contents of this CResult_NoneNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneNoneZPtr contents; + /** + * Whether this CResult_NoneNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneNoneZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -3244,6 +4469,30 @@ typedef struct LDKCResult_SignatureNoneZ { +/** + * This class tracks the per-transaction information needed to build a closing transaction and will + * actually build it and sign. + * + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. + */ +typedef struct MUST_USE_STRUCT LDKClosingTransaction { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeClosingTransaction *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; +} LDKClosingTransaction; + + + /** * The unsigned part of a channel_announcement */ @@ -3304,6 +4553,15 @@ typedef struct LDKBaseSign { * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. */ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); + /** + * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. + * + * This is required in order for the signer to make sure that releasing a commitment + * secret won't leave us without a broadcastable holder transaction. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + */ + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx); /** * Gets the holder's channel public keys and basepoints */ @@ -3324,8 +4582,18 @@ typedef struct LDKBaseSign { * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * * Note that if signing fails or is rejected, the channel will be force-closed. + * + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. */ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx); + /** + * Validate the counterparty's revocation. + * + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. + */ + struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. * This will only ever be called with a non-revoked commitment_tx. This will be called with the @@ -3403,7 +4671,7 @@ typedef struct LDKBaseSign { * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have * chosen to forgo their output as dust. */ - struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx); + struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** * Signs a channel announcement message with our funding key, proving it comes from one * of the channel participants. @@ -3984,6 +5252,39 @@ typedef struct LDKCVec_APIErrorZ { uintptr_t datalen; } LDKCVec_APIErrorZ; +/** + * The contents of CResult__u832APIErrorZ + */ +typedef union LDKCResult__u832APIErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKAPIError *err; +} LDKCResult__u832APIErrorZPtr; + +/** + * A CResult__u832APIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult__u832APIErrorZ { + /** + * The contents of this CResult__u832APIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult__u832APIErrorZPtr contents; + /** + * Whether this CResult__u832APIErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult__u832APIErrorZ; + /** * If a payment fails to send, it can be in one of several states. This enum is returned as the * Err() type describing which state the payment is in, see the description of individual enum @@ -4033,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 { @@ -4045,12 +5365,43 @@ 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; +/** + * The contents of CResult_PaymentIdPaymentSendFailureZ + */ +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 LDKThirtyTwoBytes *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKPaymentSendFailure *err; +} LDKCResult_PaymentIdPaymentSendFailureZPtr; + +/** + * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentIdPaymentSendFailureZ { + /** + * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; + /** + * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentIdPaymentSendFailureZ; + /** * The contents of CResult_NonePaymentSendFailureZ */ @@ -4084,37 +5435,51 @@ typedef struct LDKCResult_NonePaymentSendFailureZ { } LDKCResult_NonePaymentSendFailureZ; /** - * The contents of CResult_PaymentHashPaymentSendFailureZ + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { + /** + * The element at position 0 + */ + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_PaymentHashPaymentIdZ; + +/** + * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ */ -typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKC2Tuple_PaymentHashPaymentIdZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentHashPaymentSendFailureZPtr; +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; /** - * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { /** - * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentHashPaymentSendFailureZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; /** - * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentHashPaymentSendFailureZ; +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; /** * A 4-byte byte array. @@ -4137,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 @@ -4160,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, /** @@ -4196,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 @@ -4231,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; @@ -4267,59 +5626,189 @@ 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 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { + /** + * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents; + /** + * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state. + */ + 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 { /** @@ -4355,9 +5844,7 @@ typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle * multiple instances. * - * [`ChannelMonitor`]: channelmonitor::ChannelMonitor - * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr - * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure + * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure */ typedef struct LDKWatch { /** @@ -4372,6 +5859,9 @@ typedef struct LDKWatch { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * + * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if + * the given `funding_txo` has previously been registered via `watch_channel`. + * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected @@ -4384,12 +5874,18 @@ typedef struct LDKWatch { * [`ChannelMonitorUpdateErr`] for invariants around returning an error. * * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr */ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); /** * 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); /** @@ -4494,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. @@ -4517,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); /** @@ -4532,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 */ @@ -4544,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. @@ -4741,6 +6264,166 @@ typedef struct LDKCResult_OutPointDecodeErrorZ { bool result_ok; } LDKCResult_OutPointDecodeErrorZ; +/** + * Defines a type identifier for sending messages over the wire. + * + * Messages implementing this trait specify a type and must be [`Writeable`]. + */ +typedef struct LDKType { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the type identifying the message payload. + */ + uint16_t (*type_id)(const void *this_arg); + /** + * Return a human-readable "debug" string describing this object + */ + struct LDKStr (*debug_str)(const void *this_arg); + /** + * 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); +} LDKType; + +/** + * An enum which can either contain a crate::lightning::ln::wire::Type or not + */ +typedef enum LDKCOption_TypeZ_Tag { + /** + * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type + */ + LDKCOption_TypeZ_Some, + /** + * When we're in this state, this COption_TypeZ contains nothing + */ + LDKCOption_TypeZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_TypeZ_Sentinel, +} LDKCOption_TypeZ_Tag; + +typedef struct LDKCOption_TypeZ { + LDKCOption_TypeZ_Tag tag; + union { + struct { + struct LDKType some; + }; + }; +} LDKCOption_TypeZ; + +/** + * The contents of CResult_COption_TypeZDecodeErrorZ + */ +typedef union LDKCResult_COption_TypeZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_TypeZ *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_TypeZDecodeErrorZPtr; + +/** + * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_TypeZDecodeErrorZ { + /** + * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_TypeZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + */ + 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 */ @@ -5379,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. @@ -5542,374 +7229,304 @@ 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 { - /** - * Information for receiving a payment that we generated an invoice for. - */ - LDKPaymentPurpose_InvoicePayment, +typedef struct LDKCVec_EventZ { /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKPaymentPurpose_SpontaneousPayment, + struct LDKEvent *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - 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; /** - * An Event which you should probably take some action in response to. - * - * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use - * them directly as they don't round-trip exactly (for example FundingGenerationReady is never - * written as it makes no sense to respond to it after reconnecting to peers). + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKEvent_Tag { +typedef struct LDKC2Tuple_u32TxOutZ { /** - * 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 element at position 0 */ - LDKEvent_FundingGenerationReady, + uint32_t a; /** - * 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 or the amount paid is incorrect, you should call - * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid - * network congestion. - * The amount paid should be considered 'incorrect' when it is less than or more than twice - * the amount expected. - * 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. + * The element at position 1 */ - LDKEvent_PaymentReceived, + 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 { /** - * Indicates an outbound payment we made succeeded (ie it made it all the way to its target - * and we got back the payment preimage for it). + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKEvent_PaymentSent, + struct LDKC2Tuple_u32TxOutZ *data; /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. + * The number of elements pointed to by `data`. */ - LDKEvent_PaymentFailed, + 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 { /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. + * The element at position 0 */ - LDKEvent_PendingHTLCsForwardable, + struct LDKThirtyTwoBytes a; /** - * 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 element at position 1 */ - LDKEvent_SpendableOutputs, + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + +/** + * 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 { /** - * This event is generated when a payment has been successfully forwarded through us and a - * forwarding fee earned. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKEvent_PaymentForwarded, + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKEvent_Sentinel, -} LDKEvent_Tag; + uintptr_t datalen; +} LDKCVec_TransactionOutputsZ; -typedef struct LDKEvent_LDKFundingGenerationReady_Body { +/** + * 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. + */ +typedef enum LDKBalance_Tag { /** - * The random channel_id we picked which you'll need to pass into - * ChannelManager::funding_transaction_generated. + * 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. */ - struct LDKThirtyTwoBytes temporary_channel_id; + LDKBalance_ClaimableOnChannelClose, /** - * The value, in satoshis, that the output should have. + * The channel has been closed, and the given balance is ours but awaiting confirmations until + * we consider it spendable. */ - uint64_t channel_value_satoshis; + LDKBalance_ClaimableAwaitingConfirmations, /** - * The script which should be used in the transaction output. + * 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`]. */ - struct LDKCVec_u8Z output_script; + LDKBalance_ContentiousClaimable, /** - * The value passed in to ChannelManager::create_channel + * 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. */ - uint64_t user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; - -typedef struct LDKEvent_LDKPaymentReceived_Body { + LDKBalance_MaybeClaimableHTLCAwaitingTimeout, /** - * The hash for which the preimage should be handed to the ChannelManager. + * Must be last for serialization purposes */ - struct LDKThirtyTwoBytes payment_hash; + LDKBalance_Sentinel, +} LDKBalance_Tag; + +typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * The value, in thousandths of a satoshi, that this payment is for. Note that you must - * compare this to the expected value before accepting the payment (as otherwise you are - * providing proof-of-payment for less than the value you expected!). + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - uint64_t amt; + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKClaimableOnChannelClose_Body; + +typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { /** - * 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. + * The amount available to claim, in satoshis, possibly excluding the on-chain fees which + * were spent in broadcasting the transaction. */ - struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentReceived_Body; - -typedef struct LDKEvent_LDKPaymentSent_Body { + uint64_t claimable_amount_satoshis; /** - * 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 height at which an [`Event::SpendableOutputs`] event will be generated for this + * amount. */ - struct LDKThirtyTwoBytes payment_preimage; -} LDKEvent_LDKPaymentSent_Body; + uint32_t confirmation_height; +} LDKBalance_LDKClaimableAwaitingConfirmations_Body; -typedef struct LDKEvent_LDKPaymentFailed_Body { +typedef struct LDKBalance_LDKContentiousClaimable_Body { /** - * The hash which was given to ChannelManager::send_payment. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - struct LDKThirtyTwoBytes payment_hash; + uint64_t claimable_amount_satoshis; /** - * 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. + * The height at which the counterparty may be able to claim the balance if we have not + * done so. */ - bool rejected_by_dest; -} LDKEvent_LDKPaymentFailed_Body; + uint32_t timeout_height; +} LDKBalance_LDKContentiousClaimable_Body; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { +typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_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). + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; - -typedef struct LDKEvent_LDKSpendableOutputs_Body { + uint64_t claimable_amount_satoshis; /** - * The outputs which you should store as spendable by you. + * The height at which we will be able to claim the balance if our counterparty has not + * done so. */ - struct LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; + uint32_t claimable_height; +} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body; -typedef struct LDKEvent_LDKPaymentForwarded_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 fee, in milli-satoshis, which was earned as a result of the payment. - * - * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC - * was pending, the amount the next hop claimed will have been rounded down to the nearest - * whole satoshi. Thus, the fee calculated here may be higher than expected as we still - * claimed the full value in millisatoshis from the source. In this case, - * `claim_from_onchain_tx` will be set. - * - * If the channel which sent us the payment has been force-closed, we will claim the funds - * via an on-chain transaction. In that case we do not yet know the on-chain transaction - * fees which we will spend and will instead set this to `None`. It is possible duplicate - * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is - * `None`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCOption_u64Z fee_earned_msat; + struct LDKBalance *data; /** - * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain - * transaction. + * The number of elements pointed to by `data`. */ - bool claim_from_onchain_tx; -} LDKEvent_LDKPaymentForwarded_Body; - -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_LDKPaymentFailed_Body payment_failed; - LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; - LDKEvent_LDKSpendableOutputs_Body spendable_outputs; - LDKEvent_LDKPaymentForwarded_Body payment_forwarded; - }; -} LDKEvent; + uintptr_t datalen; +} LDKCVec_BalanceZ; /** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ */ -typedef struct LDKCVec_EventZ { +typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { /** - * 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 LDKEvent *data; + struct LDKC2Tuple_BlockHashChannelMonitorZ *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_EventZ; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_TransactionZ { +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { /** - * 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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKTransaction *data; + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_TransactionZ; + bool result_ok; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_NoneLightningErrorZ */ -typedef struct LDKC2Tuple_u32TxOutZ { +typedef union LDKCResult_NoneLightningErrorZPtr { /** - * The element at position 0 + * Note that this value is always NULL, as there are no contents in the OK variant */ - uint32_t a; + void *result; /** - * The element at position 1 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKTxOut b; -} LDKC2Tuple_u32TxOutZ; + struct LDKLightningError *err; +} LDKCResult_NoneLightningErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_C2Tuple_u32TxOutZZ { +typedef struct LDKCResult_NoneLightningErrorZ { /** - * 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_NoneLightningErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKC2Tuple_u32TxOutZ *data; + union LDKCResult_NoneLightningErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_NoneLightningErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_u32TxOutZZ; + bool result_ok; +} LDKCResult_NoneLightningErrorZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef struct LDKC2Tuple_PublicKeyTypeZ { /** * The element at position 0 */ - struct LDKThirtyTwoBytes a; + struct LDKPublicKey a; /** * The element at position 1 */ - struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + struct LDKType b; +} LDKC2Tuple_PublicKeyTypeZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_TransactionOutputsZ { +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_TxidCVec_C2Tuple_u32TxOutZZZ *data; + struct LDKC2Tuple_PublicKeyTypeZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_TransactionOutputsZ; - -/** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ - */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { - /** - * 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; - /** - * 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; - -/** - * 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 contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; - /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCVec_C2Tuple_PublicKeyTypeZZ; /** * The contents of CResult_boolLightningErrorZ @@ -5994,38 +7611,6 @@ typedef struct LDKCVec_NodeAnnouncementZ { uintptr_t datalen; } LDKCVec_NodeAnnouncementZ; -/** - * The contents of CResult_NoneLightningErrorZ - */ -typedef union LDKCResult_NoneLightningErrorZPtr { - /** - * 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 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 { - /** - * The contents of this CResult_NoneLightningErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NoneLightningErrorZPtr contents; - /** - * Whether this CResult_NoneLightningErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_NoneLightningErrorZ; - /** * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. * This corresponds to std::vector in C++ @@ -6165,130 +7750,268 @@ typedef struct LDKCResult_boolPeerHandleErrorZ { /** - * Details about one direction of a channel. Received - * within a channel update. + * Represents the compressed public key of a node */ -typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { +typedef struct MUST_USE_STRUCT LDKNodeId { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeNodeId *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; +} LDKNodeId; /** - * The contents of CResult_DirectionalChannelInfoDecodeErrorZ + * The contents of CResult_NodeIdDecodeErrorZ */ -typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr { +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 LDKDirectionalChannelInfo *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_DirectionalChannelInfoDecodeErrorZPtr; +} LDKCResult_NodeIdDecodeErrorZPtr; /** - * 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_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_DirectionalChannelInfoDecodeErrorZ { +typedef struct LDKCResult_NodeIdDecodeErrorZ { /** - * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either + * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents; + union LDKCResult_NodeIdDecodeErrorZPtr contents; /** - * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state. + * Whether this CResult_NodeIdDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_DirectionalChannelInfoDecodeErrorZ; - - - -/** - * Details about a channel (both directions). - * Received within a channel announcement. - */ -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. - */ - 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; -} LDKChannelInfo; +} LDKCResult_NodeIdDecodeErrorZ; /** - * The contents of CResult_ChannelInfoDecodeErrorZ + * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ */ -typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { +typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelInfo *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 LDKDecodeError *err; -} LDKCResult_ChannelInfoDecodeErrorZPtr; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr; /** - * 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_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_ChannelInfoDecodeErrorZ { +typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { /** - * The contents of this CResult_ChannelInfoDecodeErrorZ, 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_ChannelInfoDecodeErrorZPtr contents; + union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelInfoDecodeErrorZ; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; + +/** + * 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; + +/** + * An enum which can either contain a crate::lightning::chain::Access or not + */ +typedef enum LDKCOption_AccessZ_Tag { + /** + * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access + */ + LDKCOption_AccessZ_Some, + /** + * When we're in this state, this COption_AccessZ contains nothing + */ + LDKCOption_AccessZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_AccessZ_Sentinel, +} LDKCOption_AccessZ_Tag; + +typedef struct LDKCOption_AccessZ { + LDKCOption_AccessZ_Tag tag; + union { + struct { + struct LDKAccess some; + }; + }; +} LDKCOption_AccessZ; /** - * Fees for routing via a given channel or a node + * Details about one direction of a channel. Received + * within a channel update. */ -typedef struct MUST_USE_STRUCT LDKRoutingFees { +typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRoutingFees *inner; + LDKnativeDirectionalChannelInfo *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; -} LDKRoutingFees; +} LDKDirectionalChannelInfo; + +/** + * The contents of CResult_DirectionalChannelInfoDecodeErrorZ + */ +typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDirectionalChannelInfo *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; + +/** + * 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 LDKCResult_DirectionalChannelInfoDecodeErrorZ { + /** + * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_DirectionalChannelInfoDecodeErrorZ; + + + +/** + * Details about a channel (both directions). + * Received within a channel announcement. + */ +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. + */ + 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; +} LDKChannelInfo; + +/** + * The contents of CResult_ChannelInfoDecodeErrorZ + */ +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 LDKChannelInfo *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; + +/** + * 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_ChannelInfoDecodeErrorZ { + /** + * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelInfoDecodeErrorZ; + + + +/** + * Fees for routing via a given channel or a node + */ +typedef struct MUST_USE_STRUCT LDKRoutingFees { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRoutingFees *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; +} LDKRoutingFees; /** * The contents of CResult_RoutingFeesDecodeErrorZ @@ -6499,70 +8222,31 @@ typedef struct LDKCResult_NetworkGraphDecodeErrorZ { } LDKCResult_NetworkGraphDecodeErrorZ; /** - * The contents of CResult_NetAddressu8Z - */ -typedef union LDKCResult_NetAddressu8ZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKNetAddress *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; - -/** - * A CResult_NetAddressu8Z represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not */ -typedef struct LDKCResult_NetAddressu8Z { - /** - * The contents of this CResult_NetAddressu8Z, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NetAddressu8ZPtr contents; +typedef enum LDKCOption_CVec_NetAddressZZ_Tag { /** - * Whether this CResult_NetAddressu8Z represents a success state. + * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ */ - bool result_ok; -} LDKCResult_NetAddressu8Z; - -/** - * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ - */ -typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr { + LDKCOption_CVec_NetAddressZZ_Some, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * When we're in this state, this COption_CVec_NetAddressZZ contains nothing */ - struct LDKCResult_NetAddressu8Z *result; + LDKCOption_CVec_NetAddressZZ_None, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Must be last for serialization purposes */ - struct LDKDecodeError *err; -} LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr; + LDKCOption_CVec_NetAddressZZ_Sentinel, +} LDKCOption_CVec_NetAddressZZ_Tag; -/** - * 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. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ { - /** - * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents; - /** - * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_CResult_NetAddressu8ZDecodeErrorZ; +typedef struct LDKCOption_CVec_NetAddressZZ { + LDKCOption_CVec_NetAddressZZ_Tag tag; + union { + struct { + struct LDKCVec_NetAddressZ some; + }; + }; +} LDKCOption_CVec_NetAddressZZ; /** * The contents of CResult_NetAddressDecodeErrorZ @@ -8065,86 +9749,266 @@ typedef struct LDKCResult_InvoiceSignOrCreationErrorZ { bool result_ok; } LDKCResult_InvoiceSignOrCreationErrorZ; + + /** - * A trait indicating an object may generate message send events + * A transaction output watched by a [`ChannelMonitor`] for spends on-chain. + * + * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction + * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via + * the return value of [`Filter::register_output`]. + * + * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and + * may have been spent there. See [`Filter::register_output`] for details. + * + * [`ChannelMonitor`]: channelmonitor::ChannelMonitor + * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected */ -typedef struct LDKMessageSendEventsProvider { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef struct MUST_USE_STRUCT LDKWatchedOutput { /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + LDKnativeWatchedOutput *inner; /** - * 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. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - void (*free)(void *this_arg); -} LDKMessageSendEventsProvider; + bool is_owned; +} LDKWatchedOutput; /** - * A trait implemented for objects handling events from [`EventsProvider`]. + * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to + * channels. + * + * This is useful in order to have a [`Watch`] implementation convey to a chain source which + * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in + * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If + * receiving full blocks from a chain source, any further filtering is unnecessary. + * + * After an output has been registered, subsequent block retrievals from the chain source must not + * exclude any transactions matching the new criteria nor any in-block descendants of such + * transactions. + * + * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` + * should not block on I/O. Implementations should instead queue the newly monitored data to be + * processed later. Then, in order to block until the data has been processed, any [`Watch`] + * invocation that has called the `Filter` must return [`TemporaryFailure`]. + * + * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure + * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki + * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki */ -typedef struct LDKEventHandler { +typedef struct LDKFilter { /** * 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; /** - * Handles the given [`Event`]. + * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as + * a spending condition. + */ + void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey); + /** + * Registers interest in spends of a transaction output. * - * See [`EventsProvider`] for details that must be considered when implementing this method. + * Optionally, when `output.block_hash` is set, should return any transaction spending the + * output that is found in the corresponding block along with its index. + * + * This return value is useful for Electrum clients in order to supply in-block descendant + * transactions which otherwise were not included. This is not necessary for other clients if + * such descendant transactions were already included (e.g., when a BIP 157 client provides the + * full block). */ - void (*handle_event)(const void *this_arg, struct LDKEvent event); + struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output); /** * 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); -} LDKEventHandler; +} LDKFilter; /** - * A trait indicating an object may generate events. - * - * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. - * - * # Requirements - * - * See [`process_pending_events`] for requirements around event processing. - * - * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending - * event since the last invocation. The handler must either act upon the event immediately - * or preserve it for later handling. - * - * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to - * consult the provider's documentation on the implication of processing events and how a handler - * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and - * [`ChainMonitor::process_pending_events`]). - * - * (C-not implementable) As there is likely no reason for a user to implement this trait on their - * own type(s). - * - * [`process_pending_events`]: Self::process_pending_events - * [`handle_event`]: EventHandler::handle_event - * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events - * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + * An enum which can either contain a crate::lightning::chain::Filter or not */ -typedef struct LDKEventsProvider { +typedef enum LDKCOption_FilterZ_Tag { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter */ - void *this_arg; + LDKCOption_FilterZ_Some, /** - * Processes any events generated since the last call using the given event handler. - * - * Subsequent calls must only process new events. However, handlers must be capable of handling - * duplicate events across process restarts. This may occur if the provider was recovered from + * When we're in this state, this COption_FilterZ contains nothing + */ + LDKCOption_FilterZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_FilterZ_Sentinel, +} LDKCOption_FilterZ_Tag; + +typedef struct LDKCOption_FilterZ { + LDKCOption_FilterZ_Tag tag; + union { + struct { + struct LDKFilter some; + }; + }; +} LDKCOption_FilterZ; + + + +/** + * A read-only reference to a current ChannelMonitor. + * + * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is + * released. + */ +typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeLockedChannelMonitor *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; +} LDKLockedChannelMonitor; + +/** + * The contents of CResult_LockedChannelMonitorNoneZ + */ +typedef union LDKCResult_LockedChannelMonitorNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKLockedChannelMonitor *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_LockedChannelMonitorNoneZPtr; + +/** + * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation, + * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_LockedChannelMonitorNoneZ { + /** + * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_LockedChannelMonitorNoneZPtr contents; + /** + * Whether this CResult_LockedChannelMonitorNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_LockedChannelMonitorNoneZ; + +/** + * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_OutPointZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKOutPoint *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_OutPointZ; + +/** + * A trait indicating an object may generate message send events + */ +typedef struct LDKMessageSendEventsProvider { + /** + * 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; + /** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + */ + struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKMessageSendEventsProvider; + +/** + * A trait implemented for objects handling events from [`EventsProvider`]. + */ +typedef struct LDKEventHandler { + /** + * 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; + /** + * Handles the given [`Event`]. + * + * See [`EventsProvider`] for details that must be considered when implementing this method. + */ + void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event); + /** + * 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); +} LDKEventHandler; + +/** + * A trait indicating an object may generate events. + * + * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. + * + * # Requirements + * + * See [`process_pending_events`] for requirements around event processing. + * + * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending + * event since the last invocation. The handler must either act upon the event immediately + * or preserve it for later handling. + * + * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to + * consult the provider's documentation on the implication of processing events and how a handler + * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and + * [`ChainMonitor::process_pending_events`]). + * + * (C-not implementable) As there is likely no reason for a user to implement this trait on their + * own type(s). + * + * [`process_pending_events`]: Self::process_pending_events + * [`handle_event`]: EventHandler::handle_event + * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events + * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + */ +typedef struct LDKEventsProvider { + /** + * 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; + /** + * Processes any events generated since the last call using the given event handler. + * + * Subsequent calls must only process new events. However, handlers must be capable of handling + * duplicate events across process restarts. This may occur if the provider was recovered from * an old state (i.e., it hadn't been successfully persisted after processing pending events). */ void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); @@ -8250,31 +10114,6 @@ typedef struct MUST_USE_STRUCT LDKBestBlock { bool is_owned; } LDKBestBlock; -/** - * 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; - /** * The `Listen` trait is used to notify when blocks have been connected or disconnected from the * chain. @@ -8405,122 +10244,81 @@ typedef struct LDKConfirm { /** - * A transaction output watched by a [`ChannelMonitor`] for spends on-chain. - * - * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction - * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via - * the return value of [`Filter::register_output`]. - * - * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and - * may have been spent there. See [`Filter::register_output`] for details. - * - * [`ChannelMonitor`]: channelmonitor::ChannelMonitor - * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected + * An opaque identifier describing a specific [`Persist`] method call. */ -typedef struct MUST_USE_STRUCT LDKWatchedOutput { +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. */ - LDKnativeWatchedOutput *inner; + 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; -} LDKWatchedOutput; +} LDKMonitorUpdateId; /** - * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to - * channels. - * - * This is useful in order to have a [`Watch`] implementation convey to a chain source which - * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in - * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If - * receiving full blocks from a chain source, any further filtering is unnecessary. + * `Persist` defines behavior for persisting channel monitors: this could mean + * writing once to disk, and/or uploading to one or more backup services. * - * After an output has been registered, subsequent block retrievals from the chain source must not - * exclude any transactions matching the new criteria nor any in-block descendants of such - * transactions. + * 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 use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter` - * should not block on I/O. Implementations should instead queue the newly monitored data to be - * processed later. Then, in order to block until the data has been processed, any [`Watch`] - * invocation that has called the `Filter` must return [`TemporaryFailure`]. + * Note that unlike the direct [`chain::Watch`] interface, + * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. * - * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure - * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki - * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki + * * 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 LDKFilter { +typedef struct LDKPersist { /** * 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; /** - * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as - * a spending condition. - */ - void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey); - /** - * Registers interest in spends of a transaction output. + * 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. * - * Optionally, when `output.block_hash` is set, should return any transaction spending the - * output that is found in the corresponding block along with its index. + * 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. * - * This return value is useful for Electrum clients in order to supply in-block descendant - * transactions which otherwise were not included. This is not necessary for other clients if - * such descendant transactions were already included (e.g., when a BIP 157 client provides the - * full block). - */ - struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output); - /** - * 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); -} LDKFilter; - -/** - * `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. - */ -typedef struct LDKPersist { - /** - * 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; - /** - * 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. + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`]. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, + * 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* @@ -8534,11 +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)`. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, - * [`ChannelMonitorUpdate::write`] for writing out an update, and + * 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. @@ -8626,6 +10431,26 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { +/** + * Information needed for constructing an invoice route hint for this channel. + */ +typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCounterpartyForwardingInfo *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKCounterpartyForwardingInfo; + + + /** * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] * to better separate parameters. @@ -8768,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 @@ -8789,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 { /** @@ -8858,10 +10690,6 @@ typedef struct LDKRoutingMessageHandler { * false or returning an Err otherwise. */ struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); - /** - * Handle some updates to the route graph that we learned due to an outbound failed payment. - */ - void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update); /** * Gets a subset of the channel announcements and updates required to dump our routing table * to a remote node, starting at the short_channel_id indicated by starting_point and @@ -8917,6 +10745,62 @@ typedef struct LDKRoutingMessageHandler { void (*free)(void *this_arg); } LDKRoutingMessageHandler; +/** + * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) + * decoders. + */ +typedef struct LDKCustomMessageReader { + /** + * 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; + /** + * Decodes a custom message to `CustomMessageType`. If the given message type is known to the + * implementation and the message could be decoded, must return `Ok(Some(message))`. If the + * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error + * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. + */ + struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer); + /** + * 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); +} LDKCustomMessageReader; + +/** + * Handler for BOLT1-compliant messages. + */ +typedef struct LDKCustomMessageHandler { + /** + * 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; + /** + * Called with the message type that was received and the buffer to be read. + * Can return a `MessageHandlingError` if the message could not be handled. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id); + /** + * Gets the list of pending messages which were generated by the custom message + * handler, clearing the list in the process. The first tuple element must + * correspond to the intended recipients node ids. If no connection to one of the + * specified node does not exist, the message is simply not sent to it. + */ + struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg); + /** + * Implementation of CustomMessageReader for this object. + */ + struct LDKCustomMessageReader CustomMessageReader; + /** + * 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); +} LDKCustomMessageHandler; + /** @@ -9113,68 +10997,141 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { /** - * A channel descriptor for a hop along a payment path. + * A read-only view of [`NetworkGraph`]. */ -typedef struct MUST_USE_STRUCT LDKRouteHintHop { +typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeReadOnlyNetworkGraph *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; +} LDKReadOnlyNetworkGraph; /** - * A simple newtype for RwLockReadGuard<'a, NetworkGraph>. - * This exists only to make accessing a RwLock possible from - * the C bindings, as it can be done directly in Rust code. + * Receives and validates network updates from peers, + * stores authentic and relevant data as a network graph. + * This network graph is then used for routing payments. + * Provides interface to help with initial routing sync by + * serving historical announcements. + * + * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the + * [`NetworkGraph`]. */ -typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph { +typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeLockedNetworkGraph *inner; + LDKnativeNetGraphMsgHandler *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; -} LDKLockedNetworkGraph; +} LDKNetGraphMsgHandler; + +/** + * 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 `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. + */ + 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. + * + * 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. + * + * [`find_route`]: crate::routing::router::find_route + */ +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; /** - * Receives and validates network updates from peers, - * stores authentic and relevant data as a network graph. - * This network graph is then used for routing payments. - * Provides interface to help with initial routing sync by - * serving historical announcements. + * A concrete implementation of [`LockableScore`] which supports multi-threading. */ -typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { +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. */ - LDKnativeNetGraphMsgHandler *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; -} LDKNetGraphMsgHandler; +} LDKMultiThreadedLockableScore; @@ -9210,20 +11167,30 @@ typedef struct MUST_USE_STRUCT LDKFilesystemPersister { /** - * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep + * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep * Rust-Lightning running properly, and (2) either can or should be run in the background. Its * responsibilities are: - * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so, + * * Processing [`Event`]s with a user-provided [`EventHandler`]. + * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, * writing it to disk/backups by invoking the callback given to it at startup. - * ChannelManager persistence should be done in the background. - * * Calling `ChannelManager::timer_tick_occurred()` and - * `PeerManager::timer_tick_occurred()` every minute (can be done in the - * background). - * - * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date, - * then there is a risk of channels force-closing on startup when the manager realizes it's - * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used - * for unilateral chain closure fees are at risk. + * [`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. + * + * # Note + * + * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then + * there is a risk of channels force-closing on startup when the manager realizes it's outdated. + * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for + * unilateral chain closure fees are at risk. + * + * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor + * [`Event`]: lightning::util::events::Event *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. */ typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { @@ -9374,6 +11341,138 @@ typedef struct MUST_USE_STRUCT LDKFallback { }; } 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; @@ -9443,6 +11542,14 @@ struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); */ void Str_free(struct LDKStr _res); +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif + /** * Creates a new CResult_SecretKeyErrorZ in the success state. */ @@ -9453,6 +11560,11 @@ struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey */ struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_SecretKeyErrorZ. */ @@ -9468,6 +11580,11 @@ struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey */ struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_PublicKeyErrorZ. */ @@ -9489,6 +11606,11 @@ struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ */ struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. */ @@ -9510,6 +11632,11 @@ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeE */ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. */ @@ -9531,6 +11658,11 @@ struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LD */ struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxCreationKeysErrorZ. */ @@ -9573,6 +11705,11 @@ struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitm */ struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. */ @@ -9584,6 +11721,21 @@ void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutpu */ 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. */ @@ -9594,6 +11746,11 @@ struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_C */ struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. */ @@ -9615,6 +11772,11 @@ struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransa */ struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. */ @@ -9641,6 +11803,11 @@ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitme */ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. */ @@ -9662,6 +11829,11 @@ struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitment */ struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. */ @@ -9673,6 +11845,26 @@ void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_Built */ struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); + +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + */ +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); + /** * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. */ @@ -9683,6 +11875,11 @@ struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactio */ struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. */ @@ -9704,6 +11901,11 @@ struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTra */ struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. */ @@ -9719,6 +11921,11 @@ struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LD */ struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_CVec_SignatureZNoneZ. */ @@ -9740,6 +11947,11 @@ struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ */ struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. */ @@ -9761,11 +11973,22 @@ struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInv */ struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. */ void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); + /** * Creates a new CResult_NoneErrorZ in the success state. */ @@ -9776,6 +11999,11 @@ struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); */ struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneErrorZ. */ @@ -9797,6 +12025,11 @@ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LD */ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteHopDecodeErrorZ. */ @@ -9828,6 +12061,11 @@ struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute */ struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteDecodeErrorZ. */ @@ -9839,6 +12077,37 @@ void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); */ struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); + +/** + * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + */ +void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); + /** * Constructs a new COption_u64Z containing a u64 */ @@ -9860,15 +12129,93 @@ void COption_u64Z_free(struct LDKCOption_u64Z _res); */ struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +/** + * Creates a new CResult_PayeeDecodeErrorZ in the success state. + */ +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_ok(struct LDKPayee o); + +/** + * Creates a new CResult_PayeeDecodeErrorZ in the error state. + */ +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PayeeDecodeErrorZ_is_ok(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PayeeDecodeErrorZ. + */ +void CResult_PayeeDecodeErrorZ_free(struct LDKCResult_PayeeDecodeErrorZ _res); + +/** + * Creates a new CResult_PayeeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PayeeDecodeErrorZ CResult_PayeeDecodeErrorZ_clone(const struct LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + */ +void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + */ +void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); /** * Creates a new CResult_RouteLightningErrorZ in the success state. @@ -9880,6 +12227,11 @@ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LD */ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_RouteLightningErrorZ. */ @@ -9901,6 +12253,11 @@ struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut */ struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_TxOutAccessErrorZ. */ @@ -9948,6 +12305,11 @@ struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateE */ struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o); + /** * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. */ @@ -9986,8428 +12348,10764 @@ void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTran struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ClosureReasonZ containing nothing */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Constructs a new COption_NetworkUpdateZ containing nothing */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new COption_NetworkUpdateZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + * Constructs a new COption_EventZ containing nothing */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. + * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state */ -void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ 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 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + */ +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); /** - * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state. */ -void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); +struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ 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_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); +void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); /** - * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. + * Creates a new CResult_ScorerDecodeErrorZ in the success state. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); +struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); /** - * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. + * Creates a new CResult_ScorerDecodeErrorZ in the error state. */ -void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); +struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); +bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. + * Frees any resources used by the CResult_ScorerDecodeErrorZ. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. */ -void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_SignatureNoneZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_SignatureNoneZ in the error state. + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); /** - * Frees any resources used by the CResult_SignatureNoneZ. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. */ -void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); /** - * Creates a new CResult_SignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_SignDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_SignDecodeErrorZ in the error state. + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); /** - * Frees any resources used by the CResult_SignDecodeErrorZ. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. */ -void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); /** - * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_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_u8Z_free(struct LDKCVec_u8Z _res); +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RecoverableSignatureNoneZ 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_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. */ -void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); +void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); +bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); +void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TransactionNoneZ in the success state. + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); /** - * Creates a new CResult_TransactionNoneZ in the error state. + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_TransactionNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); +bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_TransactionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); +void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); /** - * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. */ -void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. */ -void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); +bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. + * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); /** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing a u16 + * Creates a new CResult_NoneNoneZ in the success state. */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); /** - * Constructs a new COption_u16Z containing nothing + * Creates a new CResult_NoneNoneZ in the error state. */ -struct LDKCOption_u16Z COption_u16Z_none(void); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); /** - * Frees any resources associated with the u16, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); /** - * Creates a new COption_u16Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NoneNoneZ. */ -struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); /** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. */ -void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SignatureNoneZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. + * Creates a new CResult_SignatureNoneZ in the error state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. + * Frees any resources used by the CResult_SignatureNoneZ. */ -void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); +void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_SignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SignDecodeErrorZ in the success state. */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SignDecodeErrorZ in the error state. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. + * Frees any resources used by the CResult_SignDecodeErrorZ. */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); +void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. + * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); +void CVec_u8Z_free(struct LDKCVec_u8Z _res); /** - * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** - * 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_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); +bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); /** - * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); /** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixNoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o); +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * Creates a new CResult_SiPrefixNoneZ in the error state. + * Creates a new CResult_TransactionNoneZ in the success state. */ -struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); /** - * Frees any resources used by the CResult_SiPrefixNoneZ. + * Creates a new CResult_TransactionNoneZ in the error state. */ -void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); /** - * Creates a new CResult_SiPrefixNoneZ 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_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig); +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_InvoiceNoneZ in the success state. + * Frees any resources used by the CResult_TransactionNoneZ. */ -struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o); +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); /** - * Creates a new CResult_InvoiceNoneZ in the error state. + * Creates a new CResult_TransactionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InvoiceNoneZ. + * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. */ -void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res); +struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Creates a new CResult_InvoiceNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. */ -struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig); +void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); /** - * Creates a new CResult_SignedRawInvoiceNoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o); +void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); /** - * Creates a new CResult_SignedRawInvoiceNoneZ in the error state. + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. */ -struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); /** - * Frees any resources used by the CResult_SignedRawInvoiceNoneZ. + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. */ -void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); /** - * Creates a new CResult_SignedRawInvoiceNoneZ 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_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig); +bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); /** - * Creates a new tuple 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 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); +void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); /** - * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. + * Constructs a new COption_u16Z containing a u16 */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); /** - * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. + * Constructs a new COption_u16Z containing nothing */ -void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); +struct LDKCOption_u16Z COption_u16Z_none(void); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Frees any resources associated with the u16, if we are in the Some state */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +void COption_u16Z_free(struct LDKCOption_u16Z _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Creates a new CResult_NoneAPIErrorZ in the success state. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneAPIErrorZ in the error state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError 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_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Frees any resources used by the CResult_NoneAPIErrorZ. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ 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_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); /** - * Creates a new CResult_NoneSemanticErrorZ in the success state. + * Creates a new CResult__u832APIErrorZ in the success state. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_NoneSemanticErrorZ in the error state. + * Creates a new CResult__u832APIErrorZ in the error state. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); /** - * Frees any resources used by the CResult_NoneSemanticErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); +bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult__u832APIErrorZ. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); +void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the success state. + * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the error state. + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees any resources used by the CResult_InvoiceSemanticErrorZ. + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. */ -void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Creates a new CResult_InvoiceSemanticErrorZ 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_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); +bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Creates a new CResult_NonePaymentSendFailureZ in the success state. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NonePaymentSendFailureZ in the error state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o); +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); /** - * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state. + * Frees any resources used by the CResult_NonePaymentSendFailureZ. */ -struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e); +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); /** - * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ. + * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig` + * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Creates a new CResult_StringErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); /** - * Creates a new CResult_StringErrorZ in the error state. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); /** - * Frees any resources used by the CResult_StringErrorZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); /** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + */ +void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ 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 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); /** - * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res); +bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. */ -struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig); +void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new CResult_PaymentSecretNoneZ in the success state. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees any resources used by the C2Tuple_OutPointScriptZ. + * Creates a new CResult_PaymentSecretNoneZ in the error state. */ -void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _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_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Frees any resources used by the CResult_PaymentSecretNoneZ. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); +void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. */ -void CVec_EventZ_free(struct LDKCVec_EventZ _res); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); /** - * 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_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. + * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); /** - * Frees any resources used by the C2Tuple_u32TxOutZ. + * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +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. */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); /** - * Creates a new CResult_boolLightningErrorZ in the success state. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_boolLightningErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolLightningErrorZ. + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ -void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); /** - * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + * Checks if the given object is currently in the success state */ -void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ -void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneLightningErrorZ in the success state. + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); /** - * Creates a new CResult_NoneLightningErrorZ in the error state. + * Constructs a new COption_TypeZ containing nothing */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +struct LDKCOption_TypeZ COption_TypeZ_none(void); /** - * Frees any resources used by the CResult_NoneLightningErrorZ. + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state */ -void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); /** - * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SiPrefixNoneZ in the success state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Creates a new CResult_SiPrefixNoneZ in the error state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Frees any resources used by the CResult_SiPrefixNoneZ. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state. + * Creates a new CResult_InvoiceNoneZ in the success state. */ -struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o); +struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state. + * Creates a new CResult_InvoiceNoneZ in the error state. */ -struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void); /** - * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res); +bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig` + * Frees any resources used by the CResult_InvoiceNoneZ. + */ +void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res); + +/** + * Creates a new CResult_InvoiceNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + * Creates a new CResult_SignedRawInvoiceNoneZ in the success state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); +struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + * Creates a new CResult_SignedRawInvoiceNoneZ in the error state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void); /** - * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` + * Frees any resources used by the CResult_SignedRawInvoiceNoneZ. + */ +void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res); + +/** + * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ 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_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); /** - * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. */ -void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); +void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PayeePubKeyErrorZ in the success state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. + * Creates a new CResult_PayeePubKeyErrorZ in the error state. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ -void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); +void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_u64Z_free(struct LDKCVec_u64Z _res); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); /** - * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + * Creates a new CResult_NoneSemanticErrorZ in the success state. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); /** - * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. + * Creates a new CResult_NoneSemanticErrorZ in the error state. */ -void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ 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_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); +bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NetAddressu8Z in the success state. + * Frees any resources used by the CResult_NoneSemanticErrorZ. */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); +void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); /** - * Creates a new CResult_NetAddressu8Z in the error state. + * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NetAddressu8Z. + * Creates a new CResult_InvoiceSemanticErrorZ in the success state. */ -void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_NetAddressu8Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InvoiceSemanticErrorZ in the error state. */ -struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); /** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o); +bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state. + * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); /** - * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ. + * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NetAddressDecodeErrorZ. + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state. */ -void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); +struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state. */ -void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); +struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError 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_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); +bool CResult_ExpiryTimeCreationErrorZ_is_ok(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ. */ -void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); +void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. + * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); +struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ 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_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. + * Creates a new CResult_StringErrorZ in the success state. */ -void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_StringErrorZ in the error state. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); +bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. + * Frees any resources used by the CResult_StringErrorZ. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); /** - * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. */ -void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); /** - * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. + * Constructs a new COption_MonitorEventZ containing nothing */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. + * Creates a new COption_MonitorEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. */ -void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. + * Creates a new C2Tuple_OutPointScriptZ from the contained elements. */ -void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_OutPointScriptZ. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); /** - * Creates a new CResult_FundingLockedDecodeErrorZ 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_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingLockedDecodeErrorZ in the error state. + * Creates a new C2Tuple_u32ScriptZ from the contained elements. */ -struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the CResult_FundingLockedDecodeErrorZ. + * Frees any resources used by the C2Tuple_u32ScriptZ. */ -void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); +void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); /** - * Creates a new CResult_FundingLockedDecodeErrorZ 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_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); /** - * Creates a new CResult_InitDecodeErrorZ 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_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_InitDecodeErrorZ in the error state. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); /** - * Frees any resources used by the CResult_InitDecodeErrorZ. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. */ -void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); +void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); /** - * Creates a new CResult_InitDecodeErrorZ 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_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); +void CVec_EventZ_free(struct LDKCVec_EventZ _res); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); /** - * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_u32TxOutZ from the contained elements. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_u32TxOutZ. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); /** - * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); /** - * Frees any resources used by the CResult_ShutdownDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. */ -void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneLightningErrorZ in the success state. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. + * Creates a new CResult_NoneLightningErrorZ in the error state. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. + * Frees any resources used by the CResult_NoneLightningErrorZ. */ -void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); /** - * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_boolLightningErrorZ in the success state. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. + * Creates a new CResult_boolLightningErrorZ in the error state. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. + * Frees any resources used by the CResult_boolLightningErrorZ. */ -void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ 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_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. + * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); /** - * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. + * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. */ -void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ 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_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); +void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); /** - * Creates a new CResult_PingDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); +void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res); /** - * Creates a new CResult_PingDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); /** - * Frees any resources used by the CResult_PingDecodeErrorZ. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. */ -void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); /** - * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Creates a new CResult_PongDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PongDecodeErrorZ in the error state. + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); /** - * Frees any resources used by the CResult_PongDecodeErrorZ. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NonePeerHandleErrorZ in the success state. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + * Creates a new CResult_NonePeerHandleErrorZ in the error state. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + * Frees any resources used by the CResult_NonePeerHandleErrorZ. */ -void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. + * Creates a new CResult_boolPeerHandleErrorZ in the success state. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + * Creates a new CResult_boolPeerHandleErrorZ in the error state. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_boolPeerHandleErrorZ. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + * Creates a new CResult_NodeIdDecodeErrorZ in the success state. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); /** - * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. + * Creates a new CResult_NodeIdDecodeErrorZ in the error state. */ -void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ 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_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. + * Frees any resources used by the CResult_NodeIdDecodeErrorZ. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); +void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. */ -void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + * Constructs a new COption_AccessZ containing nothing */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); +struct LDKCOption_AccessZ COption_AccessZ_none(void); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +void COption_AccessZ_free(struct LDKCOption_AccessZ _res); /** - * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. + * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state. */ -void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); +bool CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res); /** - * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. + * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. */ -void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); /** - * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. */ -void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ 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_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); +void CVec_u64Z_free(struct LDKCVec_u64Z _res); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. + * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. */ -void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res); +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Frees any resources used by the PaymentPurpose + * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a copy of the PaymentPurpose + * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ */ -struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); /** - * Utility method to constructs a new InvoicePayment-variant PaymentPurpose + * Constructs a new COption_CVec_NetAddressZZ containing nothing */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); /** - * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state */ -struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); /** - * Frees any resources used by the Event + * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void Event_free(struct LDKEvent this_ptr); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); /** - * Creates a copy of the Event + * Creates a new CResult_NetAddressDecodeErrorZ in the success state. */ -struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); /** - * Utility method to constructs a new FundingGenerationReady-variant Event + * Creates a new CResult_NetAddressDecodeErrorZ in the error state. */ -struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new PaymentReceived-variant Event + * Checks if the given object is currently in the success state */ -struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose); +bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new PaymentSent-variant Event + * Frees any resources used by the CResult_NetAddressDecodeErrorZ. */ -struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage); +void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); /** - * Utility method to constructs a new PaymentFailed-variant Event + * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new PendingHTLCsForwardable-variant Event + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); /** - * Utility method to constructs a new SpendableOutputs-variant Event + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); /** - * Utility method to constructs a new PaymentForwarded-variant Event + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx); +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); /** - * Serialize the Event object into a byte array which can be read by Event_read + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); /** - * Frees any resources used by the MessageSendEvent + * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. */ -void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); /** - * Creates a copy of the MessageSendEvent + * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. */ -struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent + * Checks if the given object is currently in the success state */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); +bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent + * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); +void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); /** - * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent + * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); /** - * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent + * Checks if the given object is currently in the success state */ -struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); +bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent + * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. */ -struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); /** - * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. */ -struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); /** - * Utility method to constructs a new SendShutdown-variant MessageSendEvent + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. */ -struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent + * Checks if the given object is currently in the success state */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); +bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); /** - * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent + * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); /** - * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent + * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new HandleError-variant MessageSendEvent + * Checks if the given object is currently in the success state */ -struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); +bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new PaymentFailureNetworkUpdate-variant MessageSendEvent + * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. */ -struct LDKMessageSendEvent MessageSendEvent_payment_failure_network_update(struct LDKHTLCFailChannelUpdate update); +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); /** - * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent + * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. */ -struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); /** - * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. */ -struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Calls the free function if one is set + * Checks if the given object is currently in the success state */ -void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); +bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); /** - * Calls the free function if one is set + * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. */ -void EventsProvider_free(struct LDKEventsProvider this_ptr); +void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); /** - * Calls the free function if one is set + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void EventHandler_free(struct LDKEventHandler this_ptr); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the APIError + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. */ -void APIError_free(struct LDKAPIError this_ptr); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); /** - * Creates a copy of the APIError + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. */ -struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new APIMisuseError-variant APIError + * Checks if the given object is currently in the success state */ -struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); +bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new FeeRateTooHigh-variant APIError + * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. */ -struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); /** - * Utility method to constructs a new RouteError-variant APIError + * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKAPIError APIError_route_error(struct LDKStr err); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new ChannelUnavailable-variant APIError + * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. */ -struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); /** - * Utility method to constructs a new MonitorUpdateFailed-variant APIError + * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. */ -struct LDKAPIError APIError_monitor_update_failed(void); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new IncompatibleShutdownScript-variant APIError + * Checks if the given object is currently in the success state */ -struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); +bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a digital signature of a message given a SecretKey, like the node's secret. - * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. - * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. + * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. */ -struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); /** - * Recovers the PublicKey of the signer of the message given the message and the signature. + * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); /** - * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, - * and the PublicKey. + * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. */ -bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); /** - * Creates a copy of the Level + * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. */ -enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Utility method to constructs a new Trace-variant Level + * Checks if the given object is currently in the success state */ -enum LDKLevel Level_trace(void); +bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Utility method to constructs a new Debug-variant Level + * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. */ -enum LDKLevel Level_debug(void); +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); /** - * Utility method to constructs a new Info-variant Level + * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -enum LDKLevel Level_info(void); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Utility method to constructs a new Warn-variant Level + * Creates a new CResult_FundingLockedDecodeErrorZ in the success state. */ -enum LDKLevel Level_warn(void); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); /** - * Utility method to constructs a new Error-variant Level + * Creates a new CResult_FundingLockedDecodeErrorZ in the error state. */ -enum LDKLevel Level_error(void); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Checks if two Levels contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if the given object is currently in the success state */ -bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); +bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o); /** - * Checks if two Levels contain equal inner contents. + * Frees any resources used by the CResult_FundingLockedDecodeErrorZ. */ -uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); +void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); /** - * Returns the most verbose logging level. + * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -MUST_USE_RES enum LDKLevel Level_max(void); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Creates a new CResult_InitDecodeErrorZ in the success state. */ -void Logger_free(struct LDKLogger this_ptr); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); /** - * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. + * Creates a new CResult_InitDecodeErrorZ in the error state. */ -void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the - * equivalent limit applied to outbound channels). - * - * Default value: 6. + * Checks if the given object is currently in the success state */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the - * equivalent limit applied to outbound channels). - * - * Default value: 6. + * Frees any resources used by the CResult_InitDecodeErrorZ. */ -void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less. + * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less. + * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. */ -void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required - * by the protocol. + * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required - * by the protocol. + * Checks if the given object is currently in the success state */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); +bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new ChannelHandshakeConfig given each field + * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg); +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); /** - * Creates a copy of the ChannelHandshakeConfig + * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); /** - * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. */ -void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); /** - * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 0. + * Checks if the given object is currently in the success state */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); /** - * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 0. + * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. */ -void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. - * - * Default value: u64::max_value. + * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. - * - * Default value: u64::max_value. + * Creates a new CResult_ShutdownDecodeErrorZ in the success state. */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. - * - * Default value: 0. + * Creates a new CResult_ShutdownDecodeErrorZ in the error state. */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. - * - * Default value: 0. + * Checks if the given object is currently in the success state */ -void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). - * - * Default value: u64::max_value. + * Frees any resources used by the CResult_ShutdownDecodeErrorZ. */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). - * - * Default value: u64::max_value. + * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. - * - * Default value: 0. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. - * - * Default value: 0. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: 144, or roughly one day and only applies to outbound channels. + * Checks if the given object is currently in the success state */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: 144, or roughly one day and only applies to outbound channels. + * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. */ -void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. - * - * Default value: true. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. - * - * Default value: true. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: 2016, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: 2016, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * Checks if the given object is currently in the success state */ -void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new ChannelHandshakeLimits given each field + * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); /** - * Creates a copy of the ChannelHandshakeLimits + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. + * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); /** - * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. + * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. */ -void ChannelConfig_free(struct LDKChannelConfig this_obj); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * Default value: 0. + * Checks if the given object is currently in the success state */ -uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * Default value: 0. + * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. */ -void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: 1000. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: 1000. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. */ -void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. */ -uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * Checks if the given object is currently in the success state */ -void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); +bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. + * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. */ -bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. */ -bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. */ -void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too - * small to claim on-chain. - * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be sustantial if there are many dust HTLCs present when the - * channel is force-closed. - * - * This limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. Setting this too low may prevent the + * 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. + */ +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PingDecodeErrorZ in the success state. + */ +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); + +/** + * Creates a new CResult_PingDecodeErrorZ in the error state. + */ +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. + */ +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); + +/** + * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PongDecodeErrorZ in the success state. + */ +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); + +/** + * Creates a new CResult_PongDecodeErrorZ in the error state. + */ +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. + */ +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); + +/** + * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + */ +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. + */ +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + */ +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. + */ +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + */ +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. + */ +void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + */ +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. + */ +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + */ +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + */ +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. + */ +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. + */ +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + */ +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + */ +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. + */ +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + */ +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + */ +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. + */ +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + */ +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + */ +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. + */ +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state. + */ +struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o); + +/** + * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state. + */ +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. + */ +void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res); + +/** + * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter + */ +struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); + +/** + * Constructs a new COption_FilterZ containing nothing + */ +struct LDKCOption_FilterZ COption_FilterZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state + */ +void COption_FilterZ_free(struct LDKCOption_FilterZ _res); + +/** + * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. + */ +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); + +/** + * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. + */ +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. + */ +void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); + +/** + * Frees any resources used by the PaymentPurpose + */ +void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); + +/** + * Creates a copy of the PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); + +/** + * Utility method to constructs a new InvoicePayment-variant PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); + +/** + * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); + +/** + * Frees any resources used by the ClosureReason + */ +void ClosureReason_free(struct LDKClosureReason this_ptr); + +/** + * Creates a copy of the ClosureReason + */ +struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); + +/** + * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg); + +/** + * Utility method to constructs a new HolderForceClosed-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_holder_force_closed(void); + +/** + * Utility method to constructs a new CooperativeClosure-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_cooperative_closure(void); + +/** + * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason + */ +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 + */ +struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); + +/** + * Utility method to constructs a new DisconnectedPeer-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_disconnected_peer(void); + +/** + * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_outdated_channel_manager(void); + +/** + * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + */ +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 + */ +void Event_free(struct LDKEvent this_ptr); + +/** + * Creates a copy of the Event + */ +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); + +/** + * Utility method to constructs a new FundingGenerationReady-variant Event + */ +struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id); + +/** + * Utility method to constructs a new PaymentReceived-variant Event + */ +struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose); + +/** + * Utility method to constructs a new PaymentSent-variant Event + */ +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_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 + */ +struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); + +/** + * Utility method to constructs a new SpendableOutputs-variant Event + */ +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); + +/** + * Utility method to constructs a new PaymentForwarded-variant Event + */ +struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx); + +/** + * Utility method to constructs a new ChannelClosed-variant Event + */ +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason); + +/** + * Utility method to constructs a new DiscardFunding-variant Event + */ +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 + */ +void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); + +/** + * Creates a copy of the MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); + +/** + * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); + +/** + * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); + +/** + * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); + +/** + * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); + +/** + * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg); + +/** + * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); + +/** + * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); + +/** + * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); + +/** + * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); + +/** + * Utility method to constructs a new SendShutdown-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); + +/** + * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); + +/** + * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); + +/** + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); + +/** + * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); + +/** + * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); + +/** + * Utility method to constructs a new HandleError-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); + +/** + * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); + +/** + * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); + +/** + * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); + +/** + * Calls the free function if one is set + */ +void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); + +/** + * Calls the free function if one is set + */ +void EventsProvider_free(struct LDKEventsProvider this_ptr); + +/** + * Calls the free function if one is set + */ +void EventHandler_free(struct LDKEventHandler this_ptr); + +/** + * Frees any resources used by the APIError + */ +void APIError_free(struct LDKAPIError this_ptr); + +/** + * Creates a copy of the APIError + */ +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new APIMisuseError-variant APIError + */ +struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); + +/** + * Utility method to constructs a new FeeRateTooHigh-variant APIError + */ +struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); + +/** + * Utility method to constructs a new RouteError-variant APIError + */ +struct LDKAPIError APIError_route_error(struct LDKStr err); + +/** + * Utility method to constructs a new ChannelUnavailable-variant APIError + */ +struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); + +/** + * Utility method to constructs a new MonitorUpdateFailed-variant APIError + */ +struct LDKAPIError APIError_monitor_update_failed(void); + +/** + * Utility method to constructs a new IncompatibleShutdownScript-variant APIError + */ +struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); + +/** + * Creates a digital signature of a message given a SecretKey, like the node's secret. + * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. + * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. + */ +struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); + +/** + * Recovers the PublicKey of the signer of the message given the message and the signature. + */ +struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); + +/** + * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, + * and the PublicKey. + */ +bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); + +/** + * Creates a copy of the Level + */ +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 + */ +enum LDKLevel Level_trace(void); + +/** + * Utility method to constructs a new Debug-variant Level + */ +enum LDKLevel Level_debug(void); + +/** + * Utility method to constructs a new Info-variant Level + */ +enum LDKLevel Level_info(void); + +/** + * Utility method to constructs a new Warn-variant Level + */ +enum LDKLevel Level_warn(void); + +/** + * Utility method to constructs a new Error-variant Level + */ +enum LDKLevel Level_error(void); + +/** + * Checks if two Levels contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); + +/** + * Checks if two Levels contain equal inner contents. + */ +uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); + +/** + * Returns the most verbose logging level. + */ +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 + */ +void Logger_free(struct LDKLogger this_ptr); + +/** + * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. + */ +void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); + +/** + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the + * equivalent limit applied to outbound channels). + * + * Default value: 6. + */ +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the + * equivalent limit applied to outbound channels). + * + * Default value: 6. + */ +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. + */ +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. + */ +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required + * by the protocol. + */ +uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required + * by the protocol. + */ +void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ChannelHandshakeConfig given each field + */ +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg); + +/** + * Creates a copy of the ChannelHandshakeConfig + */ +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); + +/** + * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); + +/** + * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. + */ +void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); + +/** + * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 0. + */ +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 0. + */ +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: u64::max_value. + */ +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: u64::max_value. + */ +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: 0. + */ +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: 0. + */ +void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: u64::max_value. + */ +uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: u64::max_value. + */ +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: 0. + */ +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: 0. + */ +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: 144, or roughly one day and only applies to outbound channels. + */ +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: 144, or roughly one day and only applies to outbound channels. + */ +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelConfig::announced_channel`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: true. + */ +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelConfig::announced_channel`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: true. + */ +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); + +/** + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: 2016, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) + */ +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: 2016, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) + */ +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Constructs a new ChannelHandshakeLimits given each field + */ +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); + +/** + * Creates a copy of the ChannelHandshakeLimits + */ +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); + +/** + * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); + +/** + * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. + */ +void ChannelConfig_free(struct LDKChannelConfig this_obj); + +/** + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: 0. + */ +uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: 0. + */ +void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + */ +uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + */ +void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ +uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + */ +void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * This cannot be changed after the initial channel handshake. + * + * Default value: false. + */ +bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * This cannot be changed after the initial channel handshake. + * + * Default value: false. + */ +void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * This cannot be changed after a channel has been initialized. + * + * Default value: true. + */ +bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * This cannot be changed after a channel has been initialized. + * + * Default value: true. + */ +void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); + +/** + * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too + * small to claim on-chain. + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be sustantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * This limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. Setting this too low may prevent the + * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very + * important to prevent stealing of dust HTLCs by miners. + * + * Default value: 5_000_000 msat. + */ +uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too + * small to claim on-chain. + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be sustantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * This limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. Setting this too low may prevent the * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very * important to prevent stealing of dust HTLCs by miners. * - * Default value: 5_000_000 msat. + * Default value: 5_000_000 msat. + */ +void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: 1000 satoshis. + * + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + */ +uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); + +/** + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: 1000 satoshis. + * + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + */ +void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ChannelConfig given each field + */ +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); + +/** + * Creates a copy of the ChannelConfig + */ +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); + +/** + * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); + +/** + * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read + */ +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); + +/** + * Read a ChannelConfig from a byte array, created by ChannelConfig_write + */ +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. + */ +void UserConfig_free(struct LDKUserConfig this_obj); + +/** + * Channel config that we propose to our counterparty. + */ +struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * Channel config that we propose to our counterparty. + */ +void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); + +/** + * Limits applied to our counterparty's proposed channel config settings. + */ +struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * Limits applied to our counterparty's proposed channel config settings. + */ +void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); + +/** + * Channel config which affects behavior during channel lifetime. + */ +struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * Channel config which affects behavior during channel lifetime. + */ +void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); + +/** + * If this is set to false, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Default value: false. + */ +bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * If this is set to false, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Default value: false. + */ +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, bool accept_inbound_channels_arg); + +/** + * Creates a copy of the UserConfig + */ +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); + +/** + * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKUserConfig UserConfig_default(void); + +/** + * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. + */ +void BestBlock_free(struct LDKBestBlock this_obj); + +/** + * Creates a copy of the BestBlock + */ +struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); + +/** + * Constructs a `BestBlock` that represents the genesis block at height 0 of the given + * network. + */ +MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network); + +/** + * Returns a `BestBlock` as identified by the given block hash and height. + */ +MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); + +/** + * Returns the best block hash. + */ +MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg); + +/** + * Returns the best block height. + */ +MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); + +/** + * Creates a copy of the AccessError + */ +enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new UnknownChain-variant AccessError + */ +enum LDKAccessError AccessError_unknown_chain(void); + +/** + * Utility method to constructs a new UnknownTx-variant AccessError + */ +enum LDKAccessError AccessError_unknown_tx(void); + +/** + * Calls the free function if one is set + */ +void Access_free(struct LDKAccess this_ptr); + +/** + * Calls the free function if one is set + */ +void Listen_free(struct LDKListen this_ptr); + +/** + * Calls the free function if one is set + */ +void Confirm_free(struct LDKConfirm this_ptr); + +/** + * Creates a copy of the ChannelMonitorUpdateErr + */ +enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); + +/** + * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr + */ +enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); + +/** + * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr + */ +enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); + +/** + * Calls the free function if one is set + */ +void Watch_free(struct LDKWatch this_ptr); + +/** + * Calls the free function if one is set + */ +void Filter_free(struct LDKFilter this_ptr); + +/** + * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. + */ +void WatchedOutput_free(struct LDKWatchedOutput this_obj); + +/** + * First block where the transaction output may have been spent. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); + +/** + * First block where the transaction output may have been spent. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Outpoint identifying the transaction output. + */ +struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); + +/** + * Outpoint identifying the transaction output. + */ +void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * Spending condition of the transaction output. + */ +struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); + +/** + * Spending condition of the transaction output. + */ +void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new WatchedOutput given each field + */ +MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); + +/** + * Creates a copy of the WatchedOutput + */ +struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); + +/** + * Checks if two WatchedOutputs contain equal inner contents. + */ +uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); + +/** + * Calls the free function if one is set + */ +void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); + +/** + * Creates a copy of the ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Background-variant ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_background(void); + +/** + * Utility method to constructs a new Normal-variant ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_normal(void); + +/** + * Utility method to constructs a new HighPriority-variant ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); + +/** + * Checks if two ConfirmationTargets contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); + +/** + * Calls the free function if one is set + */ +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 + */ +void Persist_free(struct LDKPersist this_ptr); + +/** + * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL. + */ +void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); + +/** + * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. + */ +void ChainMonitor_free(struct LDKChainMonitor this_obj); + +/** + * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. + * + * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor + * will call back to it indicating transactions and outputs of interest. This allows clients to + * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may + * always need to fetch full blocks absent another means for determining which blocks contain + * transactions relevant to the watched channels. + */ +MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); + +/** + * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or + * claims which are awaiting confirmation. + * + * Includes the balances from each [`ChannelMonitor`] *except* those included in + * `ignored_channels`, allowing you to filter out balances from channels which are still open + * (and whose balance should likely be pulled from the [`ChannelDetails`]). + * + * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for + * inclusion in the return value. + */ +MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels); + +/** + * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no + * such [`ChannelMonitor`] is currently being monitored for. + * + * Note that the result holds a mutex over our monitor set, and should not be held + * indefinitely. + */ +MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); + +/** + * Lists the funding outpoint of each [`ChannelMonitor`] being monitored. + * + * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always + * monitoring for on-chain state resolutions. + */ +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 + */ +struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); + +/** + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + */ +struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); + +/** + * Constructs a new Watch which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is + */ +struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); + +/** + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + */ +struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. + */ +void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); + +/** + * The sequence number of this update. Updates *must* be replayed in-order according to this + * sequence number (and updates may panic if they are not). The update_id values are strictly + * increasing and increase by one for each new update, with one exception specified below. + * + * This sequence number is also used to track up to which points updates which returned + * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given + * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * + * The only instance where update_id values are not strictly increasing is the case where we + * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See + * its docs for more details. + */ +uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); + +/** + * The sequence number of this update. Updates *must* be replayed in-order according to this + * sequence number (and updates may panic if they are not). The update_id values are strictly + * increasing and increase by one for each new update, with one exception specified below. + * + * This sequence number is also used to track up to which points updates which returned + * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given + * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * + * The only instance where update_id values are not strictly increasing is the case where we + * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See + * its docs for more details. + */ +void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Creates a copy of the ChannelMonitorUpdate + */ +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); + +/** + * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read + */ +struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); + +/** + * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write + */ +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the MonitorEvent + */ +void MonitorEvent_free(struct LDKMonitorEvent this_ptr); + +/** + * Creates a copy of the MonitorEvent + */ +struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); + +/** + * Utility method to constructs a new HTLCEvent-variant MonitorEvent + */ +struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); + +/** + * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent + */ +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. + */ +void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); + +/** + * Creates a copy of the HTLCUpdate + */ +struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); + +/** + * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read + */ +struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); + +/** + * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write + */ +struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the Balance + */ +void Balance_free(struct LDKBalance this_ptr); + +/** + * Creates a copy of the Balance + */ +struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig); + +/** + * Utility method to constructs a new ClaimableOnChannelClose-variant Balance + */ +struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis); + +/** + * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance + */ +struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height); + +/** + * Utility method to constructs a new ContentiousClaimable-variant Balance + */ +struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height); + +/** + * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance + */ +struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height); + +/** + * Checks if two Balances contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b); + +/** + * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. + */ +void ChannelMonitor_free(struct LDKChannelMonitor this_obj); + +/** + * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read + */ +struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); + +/** + * Updates a ChannelMonitor on the basis of some new information provided by the Channel + * itself. + * + * panics if the given update is not the next update by update_id. + */ +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 + * ChannelMonitor. + */ +MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. + */ +MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets a list of txids, with their output scripts (in the order they appear in the + * transaction), which we must learn about spends of via block_connected(). + */ +MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly + * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs + * have been registered. + */ +void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter); + +/** + * Get the list of HTLCs who's status has been updated on chain. This should be called by + * ChannelManager via [`chain::Watch::release_pending_monitor_events`]. + */ +MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + * + * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to + * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do + * no internal locking in ChannelMonitors. + */ +MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of + * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of + * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows + * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these + * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to + * broadcast them if counterparty don't close channel with his higher commitment transaction after a + * substantial amount of time (a month or even a year) to get back funds. Best may be to contact + * out-of-band the other node operator to coordinate with him if option is available to you. + * In any-case, choice is up to the user. + */ +MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); + +/** + * Processes transactions in a newly connected block, which may result in any of the following: + * - update the monitor's state against resolved HTLCs + * - punish the counterparty in the case of seeing a revoked commitment transaction + * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration + * - detect settled outputs for later spending + * - schedule and bump any in-flight claims + * + * Returns any new outputs to watch from `txdata`; after called, these are also included in + * [`get_outputs_to_watch`]. + * + * [`get_outputs_to_watch`]: #method.get_outputs_to_watch + */ +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); + +/** + * Determines if the disconnected block contained any transactions of interest and updates + * appropriately. + */ +void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); + +/** + * Processes transactions confirmed in a block with the given header and height, returning new + * outputs to watch. See [`block_connected`] for details. + * + * Used instead of [`block_connected`] by clients that are notified of transactions rather than + * blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_connected`]: Self::block_connected + */ +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); + +/** + * Processes a transaction that was reorganized out of the chain. + * + * Used instead of [`block_disconnected`] by clients that are notified of transactions rather + * than blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_disconnected`]: Self::block_disconnected + */ +void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); + +/** + * Updates the monitor with the current best chain tip, returning new outputs to watch. See + * [`block_connected`] for details. + * + * Used instead of [`block_connected`] by clients that are notified of transactions rather than + * blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_connected`]: Self::block_connected + */ +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); + +/** + * Returns the set of txids that should be monitored for re-organization out of the chain. + */ +MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. + */ +MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets the balances in this channel which are either claimable by us if we were to + * force-close the channel now or which are claimable on-chain (possibly awaiting + * confirmation). + * + * Any balances in the channel which are available on-chain (excluding on-chain fees) are + * included here until an [`Event::SpendableOutputs`] event has been generated for the + * balance, or until our counterparty has claimed the balance and accrued several + * confirmations on the claim transaction. + * + * Note that the balances available when you or your counterparty have broadcasted revoked + * state(s) may not be fully captured here. + * + * See [`Balance`] for additional details on the types of claimable balances which + * may be returned here and their meanings. + */ +MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write + */ +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); + +/** + * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. + */ +void OutPoint_free(struct LDKOutPoint this_obj); + +/** + * The referenced transaction's txid. + */ +const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; + +/** + * The referenced transaction's txid. + */ +void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The index of the referenced output in its transaction's vout. + */ +uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); + +/** + * The index of the referenced output in its transaction's vout. + */ +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Constructs a new OutPoint given each field + */ +MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); + +/** + * Creates a copy of the OutPoint + */ +struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); + +/** + * Checks if two OutPoints 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 OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); + +/** + * Checks if two OutPoints contain equal inner contents. + */ +uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); + +/** + * Convert an `OutPoint` to a lightning channel id. + */ +MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); + +/** + * Serialize the OutPoint object into a byte array which can be read by OutPoint_read + */ +struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); + +/** + * Read a OutPoint from a byte array, created by OutPoint_write + */ +struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + */ +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * Per commitment point to derive delayed_payment_key by key holder + */ +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * the witness_script. + */ +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); + +/** + * The output which is referenced by the given outpoint + */ +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. + */ +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The value of the channel which this output originated from, possibly indirectly. + */ +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new DelayedPaymentOutputDescriptor given each field + */ +MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + +/** + * Creates a copy of the DelayedPaymentOutputDescriptor + */ +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); + +/** + * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read + */ +struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); + +/** + * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + */ +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); + +/** + * The outpoint which is spendable + */ +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The outpoint which is spendable + */ +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + +/** + * The output which is referenced by the given outpoint + */ +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + +/** + * Arbitrary identification information returned by a call to + * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in + * the channel to spend the output. + */ +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The value of the channel which this transactions spends. + */ +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The value of the channel which this transactions spends. + */ +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new StaticPaymentOutputDescriptor given each field + */ +MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + +/** + * Creates a copy of the StaticPaymentOutputDescriptor + */ +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); + +/** + * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read + */ +struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); + +/** + * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the SpendableOutputDescriptor + */ +void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); + +/** + * Creates a copy of the SpendableOutputDescriptor + */ +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); + +/** + * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor + */ +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); + +/** + * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor + */ +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); + +/** + * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor + */ +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); + +/** + * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + */ +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); + +/** + * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write */ -uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); /** - * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too - * small to claim on-chain. - * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be sustantial if there are many dust HTLCs present when the - * channel is force-closed. - * - * This limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. Setting this too low may prevent the - * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very - * important to prevent stealing of dust HTLCs by miners. - * - * Default value: 5_000_000 msat. + * Calls the free function if one is set */ -void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +void BaseSign_free(struct LDKBaseSign this_ptr); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. - * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. - * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. - * - * Default value: 1000 satoshis. - * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * Creates a copy of a Sign */ -uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. - * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. + * Calls the free function if one is set + */ +void Sign_free(struct LDKSign this_ptr); + +/** + * Calls the free function if one is set + */ +void KeysInterface_free(struct LDKKeysInterface this_ptr); + +/** + * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. + */ +void InMemorySigner_free(struct LDKInMemorySigner this_obj); + +/** + * Private key of anchor tx + */ +const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Private key of anchor tx + */ +void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + +/** + * Holder secret key for blinded revocation pubkey + */ +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Holder secret key for blinded revocation pubkey + */ +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + +/** + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + */ +const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + */ +void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + +/** + * Holder secret key used in HTLC tx + */ +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Holder secret key used in HTLC tx + */ +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + +/** + * Holder htlc secret key used in commitment tx htlc outputs + */ +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Holder htlc secret key used in commitment tx htlc outputs + */ +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + +/** + * Commitment seed + */ +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + +/** + * Commitment seed + */ +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Creates a copy of the InMemorySigner + */ +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); + +/** + * Create a new InMemorySigner + */ +MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + +/** + * Counterparty pubkeys. + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * The contest_delay value specified by our counterparty and applied on holder-broadcastable + * transactions, ie the amount of time that we have to wait to recover our funds if we + * broadcast a transaction. + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * The contest_delay value specified by us and applied on transactions broadcastable + * by our counterparty, ie the amount of time that they have to wait to recover their funds + * if they broadcast a transaction. + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Whether the holder is the initiator + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Funding outpoint + * Will panic if ready_channel wasn't called. + */ +MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or + * building transactions. * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. + * Will panic if ready_channel wasn't called. + */ +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. * - * Default value: 1000 satoshis. + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * or is not spending the outpoint described by `descriptor.outpoint`. + */ +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); + +/** + * 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. * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, + * is not spending the outpoint described by `descriptor.outpoint`, or does not have a + * sequence set to `descriptor.to_self_delay`. */ -void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * Constructs a new ChannelConfig given each field + * Constructs a new BaseSign which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); +struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelConfig + * Constructs a new Sign which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is */ -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); +struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. + * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); +struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); /** - * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read + * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ -struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); /** - * Read a ChannelConfig from a byte array, created by ChannelConfig_write + * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); +void KeysManager_free(struct LDKKeysManager this_obj); /** - * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. + * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your + * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). + * starting_time isn't strictly required to actually be a time, but it must absolutely, + * without a doubt, be unique to this instance. ie if you start multiple times with the same + * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to + * simply use the current time (with very high precision). + * + * The seed MUST be backed up safely prior to use so that the keys can be re-created, however, + * obviously, starting_time should be unique every time you reload the library - it is only + * used to generate new ephemeral key data (which will be stored by the individual channel if + * necessary). + * + * Note that the seed is required to recover certain on-chain funds independent of + * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any + * channel, and some on-chain during-closing funds. + * + * Note that until the 0.1 release there is no guarantee of backward compatibility between + * versions. Once the library is more fully supported, the docs will be updated to include a + * detailed description of the guarantee. + */ +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); + +/** + * Derive an old Sign containing per-channel secrets based on a key derivation parameters. + * + * Key derivation parameters are accessible through a per-channel secrets + * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of + * onchain output detection for which a corresponding delayed_payment_key must be derived. */ -void UserConfig_free(struct LDKUserConfig this_obj); +MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); /** - * Channel config that we propose to our counterparty. + * Creates a Transaction which spends the given descriptors to the given outputs, plus an + * output to the given change destination (if sufficient change value remains). The + * transaction will have a feerate, at least, of the given value. + * + * Returns `Err(())` if the output value is greater than the input value minus required fee or + * if a descriptor was duplicated. + * + * We do not enforce that outputs meet the dust limit or that any output scripts are standard. + * + * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used + * this KeysManager or one of the `InMemorySigner` created by this KeysManager. */ -struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); /** - * Channel config that we propose to our counterparty. + * Constructs a new KeysInterface which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is */ -void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Limits applied to our counterparty's proposed channel config settings. + * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ -struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void ChannelManager_free(struct LDKChannelManager this_obj); /** - * Limits applied to our counterparty's proposed channel config settings. + * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. */ -void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +void ChainParameters_free(struct LDKChainParameters this_obj); /** - * Channel config which affects behavior during channel lifetime. + * The network for determining the `chain_hash` in Lightning messages. */ -struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); +enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * Channel config which affects behavior during channel lifetime. + * The network for determining the `chain_hash` in Lightning messages. */ -void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); /** - * If this is set to false, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. + * The hash and height of the latest block successfully connected. * - * Default value: false. + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * If this is set to false, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. + * The hash and height of the latest block successfully connected. * - * Default value: false. + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); /** - * Constructs a new UserConfig given each field + * Constructs a new ChainParameters 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 LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); /** - * Creates a copy of the UserConfig + * Creates a copy of the ChainParameters */ -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); +struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); /** - * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKUserConfig UserConfig_default(void); +void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); /** - * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. + * Base routing fee in millisatoshis. */ -void BestBlock_free(struct LDKBestBlock this_obj); +uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the BestBlock + * Base routing fee in millisatoshis. */ -struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); +void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Constructs a `BestBlock` that represents the genesis block at height 0 of the given - * network. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network); +uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Returns a `BestBlock` as identified by the given block hash and height. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); +void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Returns the best block hash. + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg); +uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Returns the best block height. + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); +void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a copy of the AccessError + * Constructs a new CounterpartyForwardingInfo given each field */ -enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); +MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); /** - * Utility method to constructs a new UnknownChain-variant AccessError + * Creates a copy of the CounterpartyForwardingInfo */ -enum LDKAccessError AccessError_unknown_chain(void); +struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); /** - * Utility method to constructs a new UnknownTx-variant AccessError + * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. */ -enum LDKAccessError AccessError_unknown_tx(void); +void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); /** - * Calls the free function if one is set + * The node_id of our counterparty */ -void Access_free(struct LDKAccess this_ptr); +struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The node_id of our counterparty */ -void Listen_free(struct LDKListen this_ptr); +void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Calls the free function if one is set + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -void Confirm_free(struct LDKConfirm this_ptr); +struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -void Watch_free(struct LDKWatch this_ptr); +void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Calls the free function if one is set + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -void Filter_free(struct LDKFilter this_ptr); +uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -void WatchedOutput_free(struct LDKWatchedOutput this_obj); +void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); /** - * First block where the transaction output may have been spent. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * First block where the transaction output may have been spent. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - -/** - * Outpoint identifying the transaction output. - */ -struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); - -/** - * Outpoint identifying the transaction output. - */ -void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); /** - * Spending condition of the transaction output. + * Constructs a new ChannelCounterparty given each field */ -struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg); /** - * Spending condition of the transaction output. + * Creates a copy of the ChannelCounterparty */ -void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); /** - * Constructs a new WatchedOutput given each field + * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); +void ChannelDetails_free(struct LDKChannelDetails this_obj); /** - * Creates a copy of the WatchedOutput + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); +const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; /** - * Checks if two WatchedOutputs contain equal inner contents. + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Calls the free function if one is set + * Parameters which apply to our counterparty. See individual fields for more information. */ -void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); +struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the ConfirmationTarget + * Parameters which apply to our counterparty. See individual fields for more information. */ -enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); +void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); /** - * Utility method to constructs a new Background-variant ConfirmationTarget + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * Note that, if this has been set, `channel_id` will be equivalent to + * `funding_txo.unwrap().to_channel_id()`. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKConfirmationTarget ConfirmationTarget_background(void); +struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Normal-variant ConfirmationTarget + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * Note that, if this has been set, `channel_id` will be equivalent to + * `funding_txo.unwrap().to_channel_id()`. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKConfirmationTarget ConfirmationTarget_normal(void); +void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Utility method to constructs a new HighPriority-variant ConfirmationTarget + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. */ -enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); +struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two ConfirmationTargets contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. */ -bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); +void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Calls the free function if one is set + * The value, in satoshis, of this channel as appears in the funding output */ -void FeeEstimator_free(struct LDKFeeEstimator this_ptr); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. + * The value, in satoshis, of this channel as appears in the funding output */ -void ChainMonitor_free(struct LDKChainMonitor this_obj); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. * - * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor - * will call back to it indicating transactions and outputs of interest. This allows clients to - * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may - * always need to fetch full blocks absent another means for determining which blocks contain - * transactions relevant to the watched channels. + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. * - * Note that chain_source (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); - -/** - * 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 - */ -struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); - -/** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); +struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new Watch which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); +void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. */ -struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); +uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. + * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. */ -void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with one exception specified below. + * 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 sequence number is also used to track up to which points updates which returned - * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given - * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * 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. * - * The only instance where update_id values are not strictly increasing is the case where we - * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See - * its docs for more details. + * See also [`ChannelDetails::outbound_capacity_msat`] */ -uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); +uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with one exception specified below. + * 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 sequence number is also used to track up to which points updates which returned - * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given - * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * 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. * - * The only instance where update_id values are not strictly increasing is the case where we - * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See - * its docs for more details. + * See also [`ChannelDetails::outbound_capacity_msat`] */ -void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the ChannelMonitorUpdate + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. + * + * See also [`ChannelDetails::balance_msat`] + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. */ -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. + * + * See also [`ChannelDetails::balance_msat`] + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. */ -struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelMonitorUpdateErr + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); +struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); +struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the MonitorUpdateError + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); +void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Frees any resources used by the MonitorEvent + * True if the channel was initiated (and thus funded) by us. */ -void MonitorEvent_free(struct LDKMonitorEvent this_ptr); +bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the MonitorEvent + * True if the channel was initiated (and thus funded) by us. */ -struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); +void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Utility method to constructs a new HTLCEvent-variant MonitorEvent + * True if the channel is confirmed, funding_locked messages have been exchanged, and the + * channel is not currently being shut down. `funding_locked` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); +bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new CommitmentTxBroadcasted-variant MonitorEvent + * True if the channel is confirmed, funding_locked messages have been exchanged, and the + * channel is not currently being shut down. `funding_locked` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -struct LDKMonitorEvent MonitorEvent_commitment_tx_broadcasted(struct LDKOutPoint a); +void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. + * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_funding_locked`. */ -void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); +bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the HTLCUpdate + * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_funding_locked`. */ -struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); +void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read + * True if this channel is (or will be) publicly-announced. */ -struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); +bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write + * True if this channel is (or will be) publicly-announced. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); +void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. + * Constructs a new ChannelDetails given each field */ -void ChannelMonitor_free(struct LDKChannelMonitor this_obj); +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); /** - * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read + * Creates a copy of the ChannelDetails */ -struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** - * Updates a ChannelMonitor on the basis of some new information provided by the Channel - * itself. - * - * panics if the given update is not the next update by update_id. + * Frees any resources used by the PaymentSendFailure */ -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); +void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); /** - * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this - * ChannelMonitor. + * Creates a copy of the PaymentSendFailure */ -MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); /** - * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. + * Utility method to constructs a new ParameterError-variant PaymentSendFailure */ -MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); /** - * Gets a list of txids, with their output scripts (in the order they appear in the - * transaction), which we must learn about spends of via block_connected(). + * Utility method to constructs a new PathParameterError-variant PaymentSendFailure */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); /** - * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly - * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs - * have been registered. + * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure */ -void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter); +struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a); /** - * Get the list of HTLCs who's status has been updated on chain. This should be called by - * ChannelManager via [`chain::Watch::release_pending_monitor_events`]. + * Utility method to constructs a new PartialFailure-variant PaymentSendFailure */ -MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * Constructs a new ChannelManager to hold several channels and route between them. * - * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to - * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do - * no internal locking in ChannelMonitors. + * This is the main \"logic hub\" for all channel-related actions, and implements + * ChannelMessageHandler. + * + * Non-proportional fees are fixed according to our risk using the provided fee estimator. + * + * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`! + * + * Users need to notify the new ChannelManager when a new block is connected or + * disconnected using its `block_connected` and `block_disconnected` methods, starting + * from after `params.latest_hash`. */ -MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); /** - * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of - * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of - * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows - * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these - * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to - * broadcast them if counterparty don't close channel with his higher commitment transaction after a - * substantial amount of time (a month or even a year) to get back funds. Best may be to contact - * out-of-band the other node operator to coordinate with him if option is available to you. - * In any-case, choice is up to the user. + * Gets the current configuration applied to all new channels, as */ -MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Processes transactions in a newly connected block, which may result in any of the following: - * - update the monitor's state against resolved HTLCs - * - punish the counterparty in the case of seeing a revoked commitment transaction - * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration - * - detect settled outputs for later spending - * - schedule and bump any in-flight claims + * Creates a new outbound channel to the given remote node and with the given value. + * + * `user_channel_id` will be provided back as in + * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0 + * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here. + * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise + * ignored. + * + * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is + * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. + * + * Note that we do not check if you are currently connected to the given peer. If no + * connection is available, the outbound `open_channel` message may fail to send, resulting in + * the channel eventually being silently forgotten (dropped on reload). * - * Returns any new outputs to watch from `txdata`; after called, these are also included in - * [`get_outputs_to_watch`]. + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for + * one derived from the funding transaction's TXID. If the counterparty rejects the channel + * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. * - * [`get_outputs_to_watch`]: #method.get_outputs_to_watch + * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id + * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id + * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id + * + * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config); /** - * Determines if the disconnected block contained any transactions of interest and updates - * appropriately. + * Gets the list of open channels, in random order. See ChannelDetail field documentation for + * more information. */ -void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Processes transactions confirmed in a block with the given header and height, returning new - * outputs to watch. See [`block_connected`] for details. - * - * Used instead of [`block_connected`] by clients that are notified of transactions rather than - * blocks. See [`chain::Confirm`] for calling expectations. + * Gets the list of usable channels, in random order. Useful as an argument to + * get_route to ensure non-announced channels are used. * - * [`block_connected`]: Self::block_connected + * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the + * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria + * are. */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Processes a transaction that was reorganized out of the chain. + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. * - * Used instead of [`block_disconnected`] by clients that are notified of transactions rather - * than blocks. See [`chain::Confirm`] for calling expectations. + * * If we are the channel initiator, we will pay between our [`Background`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee + * estimate. + * * If our counterparty is the channel initiator, we will require a channel closing + * transaction feerate of at least our [`Background`] feerate or the feerate which + * would appear on a force-closure transaction, whichever is lower. We will allow our + * counterparty to pay as much fee as they'd like, however. * - * [`block_disconnected`]: Self::block_disconnected + * May generate a SendShutdown message event on success, which should be relayed. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal */ -void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** - * Updates the monitor with the current best chain tip, returning new outputs to watch. See - * [`block_connected`] for details. + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. * - * Used instead of [`block_connected`] by clients that are notified of transactions rather than - * blocks. See [`chain::Confirm`] for calling expectations. + * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated + * the channel being closed or not: + * * If we are the channel initiator, we will pay at least this feerate on the closing + * transaction. The upper-bound is set by + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee + * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * * If our counterparty is the channel initiator, we will refuse to accept a channel closure + * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which + * will appear on a force-closure transaction, whichever is lower). * - * [`block_connected`]: Self::block_connected + * May generate a SendShutdown message event on success, which should be relayed. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight); /** - * Returns the set of txids that should be monitored for re-organization out of the chain. + * Force closes a channel, immediately broadcasting the latest local commitment transaction to + * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. */ -MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * Force close all channels, immediately broadcasting the latest local commitment transaction + * for each to the chain and rejecting new HTLCs on each. */ -MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Sends a payment along a given route. + * + * Value parameters are provided via the last hop in route, see documentation for RouteHop + * fields for more info. + * + * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative + * payment), we don't do anything to stop you! We always try to ensure that if the provided + * next hop knows the preimage to payment_hash they can claim an additional amount as + * specified in the last hop in the route! Thus, you should probably do your own + * payment_preimage tracking (which you should already be doing as they represent \"proof of + * payment\") and prevent double-sends yourself. + * + * May generate SendHTLCs message(s) event on success, which should be relayed. + * + * Each path may have a different return value, and PaymentSendValue may return a Vec with + * each entry matching the corresponding-index entry in the route paths, see + * PaymentSendFailure for more info. + * + * In general, a path may raise: + * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee, + * node public key) is specified. + * * APIError::ChannelUnavailable if the next-hop channel is not available for updates + * (including due to previous monitor update failure or new permanent monitor update + * failure). + * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the + * relevant updates. + * + * Note that depending on the type of the PaymentSendFailure the HTLC may have been + * irrevocably committed to on our end. In such a case, do NOT retry the payment with a + * different route unless you intend to pay twice! + * + * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate + * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For + * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route + * must not contain multiple paths as multi-path payments require a recipient-provided + * payment_secret. + * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature + * bit set (either as required or as available). If multiple paths are present in the Route, + * we assume the invoice had the basic_mpp feature set. + * + * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Persist_free(struct LDKPersist this_ptr); +MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** - * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write + * Retries a payment along the given [`Route`]. + * + * 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, 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`] */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); +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); /** - * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. + * 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 */ -void OutPoint_free(struct LDKOutPoint this_obj); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** - * The referenced transaction's txid. + * Send a spontaneous payment, which is a payment that does not require the recipient to have + * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify + * the preimage, it must be a cryptographically secure random value that no intermediate node + * would be able to guess -- otherwise, an intermediate node may claim the payment and it will + * never reach the recipient. + * + * See [`send_payment`] documentation for more details on the return value of this function. + * + * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See + * [`send_payment`] for more information about the risks of duplicate preimage usage. + * + * Note that `route` must have exactly one path. + * + * [`send_payment`]: Self::send_payment + * + * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); /** - * The referenced transaction's txid. + * Call this upon creation of a funding transaction for the given channel. + * + * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs + * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. + * + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. + * + * May panic if the output found in the funding transaction is duplicative with some other + * channel (note that this should be trivially prevented by using unique funding transaction + * keys per-channel). + * + * Do NOT broadcast the funding transaction yourself. When we have safely received our + * counterparty's signature the funding transaction will automatically be broadcast via the + * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. + * + * Note that this includes RBF or similar transaction replacement strategies - lightning does + * not currently support replacing a funding transaction on an existing channel. Instead, + * create a new channel with a conflicting funding transaction. + * + * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed */ -void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +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); /** - * The index of the referenced output in its transaction's vout. + * Regenerates channel_announcements and generates a signed node_announcement from the given + * arguments, providing them in corresponding events via + * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed + * on-chain. This effectively re-broadcasts all channel announcements and sends our node + * announcement to ensure that the lightning P2P network is aware of the channels we have and + * our network addresses. + * + * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this + * node to humans. They carry no in-protocol meaning. + * + * `addresses` represent the set (possibly empty) of socket addresses on which this node + * accepts incoming connections. These will be included in the node_announcement, publicly + * tying these addresses together and to this node. If you wish to preserve user privacy, + * addresses should likely contain only Tor Onion addresses. + * + * Panics if `addresses` is absurdly large (more than 500). + * + * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ -uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); +void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); /** - * The index of the referenced output in its transaction's vout. + * Processes HTLCs which are pending waiting on random forward delay. + * + * Should only really ever be called in response to a PendingHTLCsForwardable event. + * Will likely generate further events. */ -void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new OutPoint given each field + * Performs actions which should happen on startup and roughly once per minute thereafter. + * + * This currently includes: + * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, + * * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more + * than a minute, informing the network that they should no longer attempt to route over + * the channel. + * + * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate + * estimate fetches. */ -MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); +void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the OutPoint + * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect + * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources + * along the path (including in our own channel on which we received it). + * Returns false if no payment was found to fail backwards, true if the process of failing the + * HTLC backwards has been started. */ -struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); +MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * Checks if two OutPoints 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. + * 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. + * + * 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 */ -bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); +MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Checks if two OutPoints contain equal inner contents. + * Gets the node_id held by this ChannelManager */ -uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Convert an `OutPoint` to a lightning channel 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. + * + * 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 + * passed directly to [`claim_funds`]. + * + * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * [`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 LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); +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); /** - * Serialize the OutPoint object into a byte array which can be read by OutPoint_read + * 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 */ -struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); +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); /** - * Read a OutPoint from a byte array, created by OutPoint_write + * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is + * stored external to LDK. + * + * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a + * payment secret fetched via this method or [`create_inbound_payment`], and which is at least + * the `min_value_msat` provided here, if one is provided. + * + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. + * + * `min_value_msat` should be set if the invoice being generated contains a value. Any payment + * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` + * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the + * sender \"proof-of-payment\" unless they have paid the required amount. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. This should roughly match the expiry time set in the invoice. + * After this many seconds, we will remove the inbound payment, resulting in any attempts to + * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for + * invoices when no timeout is set. + * + * Note that we use block header time to time-out pending inbound payments (with some margin + * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will + * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry. + * If you need exact expiry semantics, you should enforce them upon receipt of + * [`PaymentReceived`]. + * + * 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 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 */ -struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +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); /** - * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * 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 */ -void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); +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); /** - * The outpoint which is spendable + * 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 */ -struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +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); /** - * The outpoint which is spendable + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Per commitment point to derive delayed_payment_key by key holder + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Per commitment point to derive delayed_payment_key by key holder + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in - * the witness_script. + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in - * the witness_script. + * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool + * 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 this method is not available with the `no-std` feature. */ -void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); /** - * The output which is referenced by the given outpoint + * Blocks until ChannelManager needs to be persisted. Only one listener on + * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken + * up. */ -void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ -const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. */ -void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); /** - * The value of the channel which this output originated from, possibly indirectly. + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The value of the channel which this output originated from, possibly indirectly. + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel + * signing data. */ -void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); /** - * Constructs a new DelayedPaymentOutputDescriptor given each field + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a copy of the DelayedPaymentOutputDescriptor + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** - * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** - * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** - * The outpoint which is spendable + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The output which is referenced by the given outpoint + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** - * The value of the channel which this transactions spends. + * Simple utility function to create a ChannelManagerReadArgs which creates the monitor + * HashMap for you. This is primarily useful for C bindings where it is not practical to + * populate a HashMap directly from C. */ -uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); /** - * The value of the channel which this transactions spends. + * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write */ -void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** - * Constructs a new StaticPaymentOutputDescriptor given each field + * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); +void DecodeError_free(struct LDKDecodeError this_obj); /** - * Creates a copy of the StaticPaymentOutputDescriptor + * Creates a copy of the DecodeError */ -struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); /** - * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read + * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); +void Init_free(struct LDKInit this_obj); /** - * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write + * The relevant features which the sender supports */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Frees any resources used by the SpendableOutputDescriptor + * The relevant features which the sender supports */ -void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Creates a copy of the SpendableOutputDescriptor + * Constructs a new Init given each field */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); /** - * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor + * Creates a copy of the Init */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); /** - * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor + * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); +void ErrorMessage_free(struct LDKErrorMessage this_obj); /** - * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor + * The channel ID involved in the error */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; /** - * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + * The channel ID involved in the error */ -struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write + * A possibly human-readable error description. + * 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 trigger a security + * vulnerability in the terminal emulator or the logging subsystem. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * A possibly human-readable error description. + * 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 trigger a security + * vulnerability in the terminal emulator or the logging subsystem. */ -void BaseSign_free(struct LDKBaseSign this_ptr); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a copy of a Sign + * Constructs a new ErrorMessage given each field */ -struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); +MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); /** - * Calls the free function if one is set + * Creates a copy of the ErrorMessage */ -void Sign_free(struct LDKSign this_ptr); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. */ -void KeysInterface_free(struct LDKKeysInterface this_ptr); +void Ping_free(struct LDKPing this_obj); /** - * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. + * The desired response length */ -void InMemorySigner_free(struct LDKInMemorySigner this_obj); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * Private key of anchor tx + * The desired response length */ -const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Private key of anchor tx + * The ping packet size. + * This field is not sent on the wire. byteslen zeros are sent. */ -void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * Holder secret key for blinded revocation pubkey + * The ping packet size. + * This field is not sent on the wire. byteslen zeros are sent. */ -const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Holder secret key for blinded revocation pubkey + * Constructs a new Ping given each field */ -void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Creates a copy of the Ping */ -const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. */ -void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void Pong_free(struct LDKPong this_obj); /** - * Holder secret key used in HTLC tx + * The pong packet size. + * This field is not sent on the wire. byteslen zeros are sent. */ -const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** - * Holder secret key used in HTLC tx + * The pong packet size. + * This field is not sent on the wire. byteslen zeros are sent. */ -void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); /** - * Holder htlc secret key used in commitment tx htlc outputs + * Constructs a new Pong given each field */ -const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); /** - * Holder htlc secret key used in commitment tx htlc outputs + * Creates a copy of the Pong */ -void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); /** - * Commitment seed + * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void OpenChannel_free(struct LDKOpenChannel this_obj); /** - * Commitment seed + * The genesis hash of the blockchain where the channel is to be opened */ -void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the InMemorySigner + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); +void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Create a new InMemorySigner + * A temporary channel ID, until the funding outpoint is announced */ -MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); +const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** - * Counterparty pubkeys. - * Will panic if ready_channel wasn't called. + * A temporary channel ID, until the funding outpoint is announced */ -MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The contest_delay value specified by our counterparty and applied on holder-broadcastable - * transactions, ie the amount of time that we have to wait to recover our funds if we - * broadcast a transaction. - * Will panic if ready_channel wasn't called. + * The channel value */ -MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The contest_delay value specified by us and applied on transactions broadcastable - * by our counterparty, ie the amount of time that they have to wait to recover their funds - * if they broadcast a transaction. - * Will panic if ready_channel wasn't called. + * The channel value */ -MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Whether the holder is the initiator - * Will panic if ready_channel wasn't called. + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Funding outpoint - * Will panic if ready_channel wasn't called. + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or - * building transactions. - * - * Will panic if ready_channel wasn't called. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * 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. - * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * or is not spending the outpoint described by `descriptor.outpoint`. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); +void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. - * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, or does not have a - * sequence set to `descriptor.to_self_delay`. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); +uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Constructs a new BaseSign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new Sign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a InMemorySigner from a byte array, created by InMemorySigner_write + * The minimum HTLC size incoming to sender, in milli-satoshi */ -struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); +uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void KeysManager_free(struct LDKKeysManager this_obj); +void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your - * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). - * starting_time isn't strictly required to actually be a time, but it must absolutely, - * without a doubt, be unique to this instance. ie if you start multiple times with the same - * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to - * simply use the current time (with very high precision). - * - * The seed MUST be backed up safely prior to use so that the keys can be re-created, however, - * obviously, starting_time should be unique every time you reload the library - it is only - * used to generate new ephemeral key data (which will be stored by the individual channel if - * necessary). - * - * Note that the seed is required to recover certain on-chain funds independent of - * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any - * channel, and some on-chain during-closing funds. - * - * Note that until the 0.1 release there is no guarantee of backward compatibility between - * versions. Once the library is more fully supported, the docs will be updated to include a - * detailed description of the guarantee. + * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); +uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Derive an old Sign containing per-channel secrets based on a key derivation parameters. - * - * Key derivation parameters are accessible through a per-channel secrets - * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of - * onchain output detection for which a corresponding delayed_payment_key must be derived. + * The feerate per 1000-weight of sender generated transactions, until updated by update_fee */ -MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a Transaction which spends the given descriptors to the given outputs, plus an - * output to the given change destination (if sufficient change value remains). The - * transaction will have a feerate, at least, of the given value. - * - * Returns `Err(())` if the output value is greater than the input value minus required fee or - * if a descriptor was duplicated. - * - * We do not enforce that outputs meet the dust limit or that any output scripts are standard. - * - * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used - * this KeysManager or one of the `InMemorySigner` created by this KeysManager. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); +uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); +void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. + * The maximum number of inbound HTLCs towards sender */ -void ChannelManager_free(struct LDKChannelManager this_obj); +uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. + * The maximum number of inbound HTLCs towards sender */ -void ChainParameters_free(struct LDKChainParameters this_obj); +void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * The network for determining the `chain_hash` in Lightning messages. + * The sender's key controlling the funding transaction */ -enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); +struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The network for determining the `chain_hash` in Lightning messages. + * The sender's key controlling the funding transaction */ -void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); +void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * Used to derive a revocation key for transactions broadcast by counterparty */ -struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); +struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * Used to derive a revocation key for transactions broadcast by counterparty */ -void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); +void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new ChainParameters given each field + * A payment key to sender for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); +struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChainParameters + * A payment key to sender for transactions broadcast by counterparty */ -struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); +void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. + * Used to derive a payment key to sender for transactions broadcast by sender */ -void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); +struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The node_id of our counterparty + * Used to derive a payment key to sender for transactions broadcast by sender */ -struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The node_id of our counterparty + * Used to derive an HTLC payment key to sender */ -void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); - -/** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. +struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); + +/** + * Used to derive an HTLC payment key to sender */ -struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * The first to-be-broadcast-by-sender transaction's per commitment point */ -void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. - * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * The first to-be-broadcast-by-sender transaction's per commitment point */ -uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. - * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * Channel flags */ -void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); +uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelCounterparty + * Channel flags */ -struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); +void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); /** - * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. + * 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 */ -void ChannelDetails_free(struct LDKChannelDetails this_obj); +struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * 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 */ -const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; +void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * Creates a copy of the OpenChannel */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. */ -struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_free(struct LDKAcceptChannel this_obj); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * A temporary channel ID, until the funding outpoint is announced */ -void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); +const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * A temporary channel ID, until the funding outpoint is announced */ -struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); +uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The value, in satoshis, of this channel as appears in the funding output + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The value, in satoshis, of this channel as appears in the funding output + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The user_id passed in to create_channel, or 0 if the channel was inbound. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The user_id passed in to create_channel, or 0 if the channel was inbound. + * Minimum depth of the funding transaction before the channel is considered open */ -void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * 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 - * 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 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. + * Minimum depth of the funding transaction before the channel is considered open */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_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 - * 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 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. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * 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 - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * The maximum number of inbound HTLCs towards sender */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * The maximum number of inbound HTLCs towards sender */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * The sender's key controlling the funding transaction */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The sender's key controlling the funding transaction */ -struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * Used to derive a revocation key for transactions broadcast by counterparty */ -void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * True if the channel was initiated (and thus funded) by us. + * Used to derive a revocation key for transactions broadcast by counterparty */ -bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * True if the channel was initiated (and thus funded) by us. + * A payment key to sender for transactions broadcast by counterparty */ -void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * True if the channel is confirmed, funding_locked messages have been exchanged, and the - * channel is not currently being shut down. `funding_locked` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * A payment key to sender for transactions broadcast by counterparty */ -bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * True if the channel is confirmed, funding_locked messages have been exchanged, and the - * channel is not currently being shut down. `funding_locked` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * Used to derive a payment key to sender for transactions broadcast by sender */ -void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_funding_locked`. + * Used to derive a payment key to sender for transactions broadcast by sender */ -bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_funding_locked`. + * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * True if this channel is (or will be) publicly-announced. + * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * True if this channel is (or will be) publicly-announced. + * The first to-be-broadcast-by-sender transaction's per commitment point */ -void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelDetails given each field + * The first to-be-broadcast-by-sender transaction's per commitment point */ -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_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); +void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the ChannelDetails + * Creates a copy of the AcceptChannel */ -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); /** - * Frees any resources used by the PaymentSendFailure + * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. */ -void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); +void FundingCreated_free(struct LDKFundingCreated this_obj); /** - * Creates a copy of the PaymentSendFailure + * A temporary channel ID, until the funding is established */ -struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); +const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new ParameterError-variant PaymentSendFailure + * A temporary channel ID, until the funding is established */ -struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new PathParameterError-variant PaymentSendFailure + * The funding transaction ID */ -struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure + * The funding transaction ID */ -struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new PartialFailure-variant PaymentSendFailure + * The specific output index funding this channel */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a); +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelManager to hold several channels and route between them. - * - * This is the main \"logic hub\" for all channel-related actions, and implements - * ChannelMessageHandler. - * - * Non-proportional fees are fixed according to our risk using the provided fee estimator. - * - * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`! - * - * Users need to notify the new ChannelManager when a new block is connected or - * disconnected using its `block_connected` and `block_disconnected` methods, starting - * from after `params.latest_hash`. + * The specific output index funding this channel */ -MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); /** - * Gets the current configuration applied to all new channels, as + * The signature of the channel initiator (funder) on the initial commitment transaction */ -MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Creates a new outbound channel to the given remote node and with the given value. - * - * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow - * tracking of which events correspond with which create_channel call. Note that the - * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for - * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and - * otherwise ignored. - * - * If successful, will generate a SendOpenChannel message event, so you should probably poll - * PeerManager::process_events afterwards. - * - * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is - * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000. - * - * Note that we do not check if you are currently connected to the given peer. If no - * connection is available, the outbound `open_channel` message may fail to send, resulting in - * the channel eventually being silently forgotten. - * - * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None + * The signature of the channel initiator (funder) on the initial commitment transaction */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Gets the list of open channels, in random order. See ChannelDetail field documentation for - * more information. + * Constructs a new FundingCreated given each field */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); /** - * Gets the list of usable channels, in random order. Useful as an argument to - * get_route to ensure non-announced channels are used. - * - * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the - * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria - * are. + * Creates a copy of the FundingCreated */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * * If we are the channel initiator, we will pay between our [`Background`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate. - * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`Background`] feerate or the feerate which - * would appear on a force-closure transaction, whichever is lower. We will allow our - * counterparty to pay as much fee as they'd like, however. - * - * May generate a SendShutdown message event on success, which should be relayed. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +void FundingSigned_free(struct LDKFundingSigned this_obj); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated - * the channel being closed or not: - * * If we are the channel initiator, we will pay at least this feerate on the closing - * transaction. The upper-bound is set by - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). - * * If our counterparty is the channel initiator, we will refuse to accept a channel closure - * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which - * will appear on a force-closure transaction, whichever is lower). - * - * May generate a SendShutdown message event on success, which should be relayed. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * The channel ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight); +const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; /** - * Force closes a channel, immediately broadcasting the latest local commitment transaction to - * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. + * The channel ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Force close all channels, immediately broadcasting the latest local commitment transaction - * for each to the chain and rejecting new HTLCs on each. + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * Sends a payment along a given route. - * - * Value parameters are provided via the last hop in route, see documentation for RouteHop - * fields for more info. - * - * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative - * payment), we don't do anything to stop you! We always try to ensure that if the provided - * next hop knows the preimage to payment_hash they can claim an additional amount as - * specified in the last hop in the route! Thus, you should probably do your own - * payment_preimage tracking (which you should already be doing as they represent \"proof of - * payment\") and prevent double-sends yourself. - * - * May generate SendHTLCs message(s) event on success, which should be relayed. - * - * Each path may have a different return value, and PaymentSendValue may return a Vec with - * each entry matching the corresponding-index entry in the route paths, see - * PaymentSendFailure for more info. - * - * In general, a path may raise: - * * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee, - * node public key) is specified. - * * APIError::ChannelUnavailable if the next-hop channel is not available for updates - * (including due to previous monitor update failure or new permanent monitor update - * failure). - * * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the - * relevant updates. - * - * Note that depending on the type of the PaymentSendFailure the HTLC may have been - * irrevocably committed to on our end. In such a case, do NOT retry the payment with a - * different route unless you intend to pay twice! - * - * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate - * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For - * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route - * must not contain multiple paths as multi-path payments require a recipient-provided - * payment_secret. - * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature - * bit set (either as required or as available). If multiple paths are present in the Route, - * we assume the invoice had the basic_mpp feature set. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Send a spontaneous payment, which is a payment that does not require the recipient to have - * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify - * the preimage, it must be a cryptographically secure random value that no intermediate node - * would be able to guess -- otherwise, an intermediate node may claim the payment and it will - * never reach the recipient. - * - * See [`send_payment`] documentation for more details on the return value of this function. - * - * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See - * [`send_payment`] for more information about the risks of duplicate preimage usage. - * - * Note that `route` must have exactly one path. - * - * [`send_payment`]: Self::send_payment - * - * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new FundingSigned given each field */ -MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); /** - * Call this upon creation of a funding transaction for the given channel. - * - * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs - * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. - * - * Panics if a funding transaction has already been provided for this channel. - * - * May panic if the output found in the funding transaction is duplicative with some other - * channel (note that this should be trivially prevented by using unique funding transaction - * keys per-channel). - * - * Do NOT broadcast the funding transaction yourself. When we have safely received our - * counterparty's signature the funding transaction will automatically be broadcast via the - * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. - * - * Note that this includes RBF or similar transaction replacement strategies - lightning does - * not currently support replacing a funding transaction on an existing channel. Instead, - * create a new channel with a conflicting funding transaction. - * - * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady + * Creates a copy of the FundingSigned */ -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); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** - * Regenerates channel_announcements and generates a signed node_announcement from the given - * arguments, providing them in corresponding events via - * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed - * on-chain. This effectively re-broadcasts all channel announcements and sends our node - * announcement to ensure that the lightning P2P network is aware of the channels we have and - * our network addresses. - * - * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this - * node to humans. They carry no in-protocol meaning. - * - * `addresses` represent the set (possibly empty) of socket addresses on which this node - * accepts incoming connections. These will be included in the node_announcement, publicly - * tying these addresses together and to this node. If you wish to preserve user privacy, - * addresses should likely contain only Tor Onion addresses. - * - * Panics if `addresses` is absurdly large (more than 500). - * - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events + * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL. */ -void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +void FundingLocked_free(struct LDKFundingLocked this_obj); /** - * Processes HTLCs which are pending waiting on random forward delay. - * - * Should only really ever be called in response to a PendingHTLCsForwardable event. - * Will likely generate further events. + * The channel ID */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; /** - * Performs actions which should happen on startup and roughly once per minute thereafter. - * - * This currently includes: - * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, - * * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more - * than a minute, informing the network that they should no longer attempt to route over - * the channel. - * - * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate - * estimate fetches. + * The channel ID */ -void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); +void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect - * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources - * along the path (including in our own channel on which we received it). - * Returns false if no payment was found to fail backwards, true if the process of failing the - * HTLC backwards has been started. + * The per-commitment point of the second commitment transaction */ -MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr); /** - * 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! - * - * 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. - * - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * The per-commitment point of the second commitment transaction */ -MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Gets the node_id held by this ChannelManager + * Constructs a new FundingLocked given each field */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_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. + * Creates a copy of the FundingLocked */ -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); +struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); /** - * 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. - * - * 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 - * passed directly to [`claim_funds`]. - * - * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. - * - * [`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 + * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. */ -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); +void Shutdown_free(struct LDKShutdown this_obj); /** - * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is - * stored external to LDK. - * - * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a - * payment secret fetched via this method or [`create_inbound_payment`], and which is at least - * the `min_value_msat` provided here, if one is provided. - * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) 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. - * - * `min_value_msat` should be set if the invoice being generated contains a value. Any payment - * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the - * sender \"proof-of-payment\" unless they have paid the required amount. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. This should roughly match the expiry time set in the invoice. - * After this many seconds, we will remove the inbound payment, resulting in any attempts to - * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for - * invoices when no timeout is set. - * - * Note that we use block header time to time-out pending inbound payments (with some margin - * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry. - * 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`]. - * - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentReceived`]: events::Event::PaymentReceived - * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id + * The channel 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); +const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The channel ID */ -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * The destination of this peer's funds on closing. + * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * The destination of this peer's funds on closing. + * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. */ -struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * Constructs a new Shutdown given each field */ -struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); /** - * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool - * 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. + * Creates a copy of the Shutdown */ -MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); /** - * Blocks until ChannelManager needs to be persisted. Only one listener on - * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken - * up. + * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. */ -void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); +void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * Constructs a new ClosingSignedFeeRange given each field */ -const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * Creates a copy of the ClosingSignedFeeRange */ -void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); +struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ClosingSigned_free(struct LDKClosingSigned this_obj); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * The channel ID */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); +const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * The channel ID */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * The proposed total fee for the closing transaction */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * The proposed total fee for the closing transaction */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * A signature on the closing transaction */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * A signature on the closing transaction */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); +struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * Constructs a new ClosingSigned given each field */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** - * Simple utility function to create a ChannelManagerReadArgs which creates the monitor - * HashMap for you. This is primarily useful for C bindings where it is not practical to - * populate a HashMap directly from C. + * Creates a copy of the ClosingSigned */ -MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); /** - * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write + * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); /** - * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL. + * The channel ID */ -void DecodeError_free(struct LDKDecodeError this_obj); +const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the DecodeError + * The channel ID */ -struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. + * The HTLC ID */ -void Init_free(struct LDKInit this_obj); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * The relevant features which the sender supports + * The HTLC ID */ -struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * The relevant features which the sender supports + * The HTLC value in milli-satoshi */ -void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new Init given each field + * The HTLC value in milli-satoshi */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); +void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the Init + * The payment hash, the pre-image of which controls HTLC redemption */ -struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); +const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. + * The payment hash, the pre-image of which controls HTLC redemption */ -void ErrorMessage_free(struct LDKErrorMessage this_obj); +void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The channel ID involved in the error + * The expiry height of the HTLC */ -const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * The channel ID involved in the error + * The expiry height of the HTLC */ -void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); /** - * A possibly human-readable error description. - * 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 trigger a security - * vulnerability in the terminal emulator or the logging subsystem. + * Creates a copy of the UpdateAddHTLC */ -struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); /** - * A possibly human-readable error description. - * 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 trigger a security - * vulnerability in the terminal emulator or the logging subsystem. + * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. */ -void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); /** - * Constructs a new ErrorMessage given each field + * The channel ID */ -MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); +const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the ErrorMessage + * The channel ID */ -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. + * The HTLC ID */ -void Ping_free(struct LDKPing this_obj); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * The desired response length + * The HTLC ID */ -uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * The desired response length + * The pre-image of the payment hash, allowing HTLC redemption */ -void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * The ping packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * The pre-image of the payment hash, allowing HTLC redemption */ -uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The ping packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * Constructs a new UpdateFulfillHTLC given each field */ -void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); /** - * Constructs a new Ping given each field + * Creates a copy of the UpdateFulfillHTLC */ -MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); /** - * Creates a copy of the Ping + * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); /** - * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. + * The channel ID */ -void Pong_free(struct LDKPong this_obj); +const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; /** - * The pong packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * The channel ID */ -uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The pong packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * The HTLC ID */ -void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new Pong given each field + * The HTLC ID */ -MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the Pong + * Creates a copy of the UpdateFailHTLC */ -struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); /** - * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. + * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. */ -void OpenChannel_free(struct LDKOpenChannel this_obj); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); /** - * The genesis hash of the blockchain where the channel is to be opened + * The channel ID */ -const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; /** - * The genesis hash of the blockchain where the channel is to be opened + * The channel ID */ -void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * A temporary channel ID, until the funding outpoint is announced + * The HTLC ID */ -const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * A temporary channel ID, until the funding outpoint is announced + * The HTLC ID */ -void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel value + * The failure code */ -uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * The channel value + * The failure code */ -void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * Creates a copy of the UpdateFailMalformedHTLC */ -uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. */ -void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The channel ID */ -uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The channel ID */ -void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * A signature on the commitment transaction */ -uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * A signature on the commitment transaction */ -void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Signatures on the HTLC transactions */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Constructs a new CommitmentSigned given each field */ -void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Creates a copy of the CommitmentSigned */ -uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. */ -void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The channel ID */ -uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The channel ID */ -void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The secret corresponding to the per-commitment point */ -uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The secret corresponding to the per-commitment point */ -void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The maximum number of inbound HTLCs towards sender + * The next sender-broadcast commitment transaction's per-commitment point */ -uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards sender + * The next sender-broadcast commitment transaction's per-commitment point */ -void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The sender's key controlling the funding transaction + * Constructs a new RevokeAndACK given each field */ -struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); /** - * The sender's key controlling the funding transaction + * Creates a copy of the RevokeAndACK */ -void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UpdateFee_free(struct LDKUpdateFee this_obj); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * The channel ID */ -void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; /** - * A payment key to sender for transactions broadcast by counterparty + * The channel ID */ -struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * A payment key to sender for transactions broadcast by counterparty + * Fee rate per 1000-weight of the transaction */ -void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Fee rate per 1000-weight of the transaction */ -struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Constructs a new UpdateFee given each field */ -void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); /** - * Used to derive an HTLC payment key to sender + * Creates a copy of the UpdateFee */ -struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); /** - * Used to derive an HTLC payment key to sender + * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL. */ -void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void DataLossProtect_free(struct LDKDataLossProtect this_obj); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Channel flags + * The sender's per-commitment point for their current commitment transaction */ -uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); /** - * Channel flags + * The sender's per-commitment point for their current commitment transaction */ -void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); +void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the OpenChannel + * Constructs a new DataLossProtect given each field */ -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); /** - * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. + * Creates a copy of the DataLossProtect */ -void AcceptChannel_free(struct LDKAcceptChannel this_obj); +struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); /** - * A temporary channel ID, until the funding outpoint is announced + * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. */ -const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; +void ChannelReestablish_free(struct LDKChannelReestablish this_obj); /** - * A temporary channel ID, until the funding outpoint is announced + * The channel ID */ -void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The channel ID */ -uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The next commitment number for the sender */ -void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The next commitment number for the sender */ -uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The next commitment number for the recipient */ -void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The next commitment number for the recipient */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Creates a copy of the ChannelReestablish */ -void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. */ -uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The channel ID */ -void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; /** - * Minimum depth of the funding transaction before the channel is considered open + * The channel ID */ -uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Minimum depth of the funding transaction before the channel is considered open + * The short channel ID */ -void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The short channel ID */ -uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * A signature by the node key */ -void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards sender + * A signature by the node key */ -uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The maximum number of inbound HTLCs towards sender + * A signature by the funding key */ -void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * The sender's key controlling the funding transaction + * A signature by the funding key */ -struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The sender's key controlling the funding transaction + * Constructs a new AnnouncementSignatures given each field */ -void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Creates a copy of the AnnouncementSignatures */ -struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Frees any resources used by the NetAddress */ -void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void NetAddress_free(struct LDKNetAddress this_ptr); /** - * A payment key to sender for transactions broadcast by counterparty + * Creates a copy of the NetAddress */ -struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); /** - * A payment key to sender for transactions broadcast by counterparty + * Utility method to constructs a new IPv4-variant NetAddress */ -void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Utility method to constructs a new IPv6-variant NetAddress */ -struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Utility method to constructs a new OnionV2-variant NetAddress */ -void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * Utility method to constructs a new OnionV3-variant NetAddress */ -struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * Serialize the NetAddress object into a byte array which can be read by NetAddress_read */ -void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Read a NetAddress from a byte array, created by NetAddress_write */ -struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. */ -void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); /** - * Creates a copy of the AcceptChannel + * The advertised features */ -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. + * The advertised features */ -void FundingCreated_free(struct LDKFundingCreated this_obj); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * A temporary channel ID, until the funding is established + * A strictly monotonic announcement counter, with gaps allowed */ -const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * A temporary channel ID, until the funding is established + * A strictly monotonic announcement counter, with gaps allowed */ -void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** - * The funding transaction ID + * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * to this node). */ -const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The funding transaction ID + * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * to this node). */ -void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The specific output index funding this channel + * An RGB color for UI purposes */ -uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** - * The specific output index funding this channel + * An RGB color for UI purposes */ -void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * The signature of the channel initiator (funder) on the funding transaction + * An alias, for UI purposes. This should be sanitized before use. There is no guarantee + * of uniqueness. */ -struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * The signature of the channel initiator (funder) on the funding transaction + * An alias, for UI purposes. This should be sanitized before use. There is no guarantee + * of uniqueness. */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new FundingCreated given each field + * List of addresses on which this node is reachable */ -MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); /** - * Creates a copy of the FundingCreated + * Creates a copy of the UnsignedNodeAnnouncement */ -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); /** - * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. + * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. */ -void FundingSigned_free(struct LDKFundingSigned this_obj); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** - * The channel ID + * The signature by the node key */ -const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; +struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The channel ID + * The signature by the node key */ -void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The signature of the channel acceptor (fundee) on the funding transaction + * The actual content of the announcement */ -struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The signature of the channel acceptor (fundee) on the funding transaction + * The actual content of the announcement */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); /** - * Constructs a new FundingSigned given each field + * Constructs a new NodeAnnouncement given each field */ -MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** - * Creates a copy of the FundingSigned + * Creates a copy of the NodeAnnouncement */ -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); /** - * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL. + * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -void FundingLocked_free(struct LDKFundingLocked this_obj); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); /** - * The channel ID + * The advertised channel features */ -const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The channel ID + * The advertised channel features */ -void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * The per-commitment point of the second commitment transaction + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr); +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * The per-commitment point of the second commitment transaction + * The genesis hash of the blockchain where the channel is to be opened */ -void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new FundingLocked given each field + * The short channel ID */ -MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Creates a copy of the FundingLocked + * The short channel ID */ -struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. + * One of the two node_ids which are endpoints of this channel */ -void Shutdown_free(struct LDKShutdown this_obj); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The channel ID + * One of the two node_ids which are endpoints of this channel */ -const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The channel ID + * The other of the two node_ids which are endpoints of this channel */ -void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * The other of the two node_ids which are endpoints of this channel */ -struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * The funding key for the first node */ -void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Constructs a new Shutdown given each field + * The funding key for the first node */ -MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the Shutdown + * The funding key for the second node */ -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. + * The funding key for the second node */ -void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Creates a copy of the UnsignedChannelAnnouncement */ -uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Authentication of the announcement by the first public node */ -uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Authentication of the announcement by the first public node */ -void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Constructs a new ClosingSignedFeeRange given each field + * Authentication of the announcement by the second public node */ -MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); +struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Creates a copy of the ClosingSignedFeeRange + * Authentication of the announcement by the second public node */ -struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. + * Proof of funding UTXO ownership by the first public node */ -void ClosingSigned_free(struct LDKClosingSigned this_obj); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The channel ID + * Proof of funding UTXO ownership by the first public node */ -const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The channel ID + * Proof of funding UTXO ownership by the second public node */ -void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The proposed total fee for the closing transaction + * Proof of funding UTXO ownership by the second public node */ -uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The proposed total fee for the closing transaction + * The actual announcement */ -void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * A signature on the closing transaction + * The actual announcement */ -struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); /** - * A signature on the closing transaction + * Constructs a new ChannelAnnouncement given each field */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the ChannelAnnouncement */ -struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. */ -void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); /** - * Constructs a new ClosingSigned given each field + * The genesis hash of the blockchain where the channel is to be opened */ -MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the ClosingSigned + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. + * The short channel ID */ -void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The channel ID + * The short channel ID */ -const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel ID + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The HTLC ID + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * The HTLC ID + * Channel flags */ -void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The HTLC value in milli-satoshi + * Channel flags */ -uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * The HTLC value in milli-satoshi + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines + * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a + * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, + * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The payment hash, the pre-image of which controls HTLC redemption + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines + * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a + * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, + * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** - * The payment hash, the pre-image of which controls HTLC redemption + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The expiry height of the HTLC + * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The expiry height of the HTLC + * The base HTLC fee charged by sender, in milli-satoshi */ -void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Creates a copy of the UpdateAddHTLC + * The base HTLC fee charged by sender, in milli-satoshi */ -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. + * The amount to fee multiplier, in micro-satoshi */ -void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The channel ID + * The amount to fee multiplier, in micro-satoshi */ -const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID + * Creates a copy of the UnsignedChannelUpdate */ -void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); /** - * The HTLC ID + * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); +void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** - * The HTLC ID + * A signature of the channel update */ -void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * The pre-image of the payment hash, allowing HTLC redemption + * A signature of the channel update */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The pre-image of the payment hash, allowing HTLC redemption + * The actual channel update */ -void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * Constructs a new UpdateFulfillHTLC given each field + * The actual channel update */ -MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); /** - * Creates a copy of the UpdateFulfillHTLC + * Constructs a new ChannelUpdate given each field */ -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** - * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelUpdate */ -void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); /** - * The channel ID + * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. */ -const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; +void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); /** - * The channel ID + * The genesis hash of the blockchain being queried */ -void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** - * The HTLC ID + * The genesis hash of the blockchain being queried */ -uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The HTLC ID + * The height of the first block for the channel UTXOs being queried */ -void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * Creates a copy of the UpdateFailHTLC + * The height of the first block for the channel UTXOs being queried */ -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. + * The number of blocks to include in the query results */ -void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * The channel ID + * The number of blocks to include in the query results */ -const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID + * Constructs a new QueryChannelRange given each field */ -void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); /** - * The HTLC ID + * Creates a copy of the QueryChannelRange */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); /** - * The HTLC ID + * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. */ -void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); /** - * The failure code + * The genesis hash of the blockchain being queried */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** - * The failure code + * The genesis hash of the blockchain being queried */ -void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a copy of the UpdateFailMalformedHTLC + * The height of the first block in the range of the reply */ -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. + * The height of the first block in the range of the reply */ -void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID + * The number of blocks included in the range of the reply */ -const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The channel ID + * The number of blocks included in the range of the reply */ -void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * A signature on the commitment transaction + * True when this is the final reply for a query */ -struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * A signature on the commitment transaction + * True when this is the final reply for a query */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** - * Signatures on the HTLC transactions + * The short_channel_ids in the channel range */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Constructs a new CommitmentSigned given each field + * Constructs a new ReplyChannelRange given each field */ -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); +MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * Creates a copy of the CommitmentSigned + * Creates a copy of the ReplyChannelRange */ -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); /** - * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. + * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. */ -void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); /** - * The channel ID + * The genesis hash of the blockchain being queried */ -const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** - * The channel ID + * The genesis hash of the blockchain being queried */ -void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The secret corresponding to the per-commitment point + * The short_channel_ids that are being queried */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * The secret corresponding to the per-commitment point + * Constructs a new QueryShortChannelIds given each field */ -void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Creates a copy of the QueryShortChannelIds */ -struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. */ -void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); /** - * Constructs a new RevokeAndACK given each field + * The genesis hash of the blockchain that was queried */ -MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the RevokeAndACK + * The genesis hash of the blockchain that was queried */ -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. + * Indicates if the query recipient maintains up-to-date channel + * information for the chain_hash */ -void UpdateFee_free(struct LDKUpdateFee this_obj); +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** - * The channel ID + * Indicates if the query recipient maintains up-to-date channel + * information for the chain_hash */ -const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); /** - * The channel ID + * Constructs a new ReplyShortChannelIdsEnd given each field */ -void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); /** - * Fee rate per 1000-weight of the transaction + * Creates a copy of the ReplyShortChannelIdsEnd */ -uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); /** - * Fee rate per 1000-weight of the transaction + * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. */ -void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); /** - * Constructs a new UpdateFee given each field + * The genesis hash of the blockchain for channel and node information */ -MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the UpdateFee + * The genesis hash of the blockchain for channel and node information */ -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL. + * The starting unix timestamp */ -void DataLossProtect_free(struct LDKDataLossProtect this_obj); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * The starting unix timestamp */ -const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * The range of information in seconds */ -void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * The sender's per-commitment point for their current commitment transaction + * The range of information in seconds */ -struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * The sender's per-commitment point for their current commitment transaction + * Constructs a new GossipTimestampFilter given each field */ -void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); /** - * Constructs a new DataLossProtect given each field + * Creates a copy of the GossipTimestampFilter */ -MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); /** - * Creates a copy of the DataLossProtect + * Frees any resources used by the ErrorAction */ -struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); +void ErrorAction_free(struct LDKErrorAction this_ptr); /** - * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. + * Creates a copy of the ErrorAction */ -void ChannelReestablish_free(struct LDKChannelReestablish this_obj); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); /** - * The channel ID + * Utility method to constructs a new DisconnectPeer-variant ErrorAction */ -const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; +struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); /** - * The channel ID + * Utility method to constructs a new IgnoreError-variant ErrorAction */ -void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKErrorAction ErrorAction_ignore_error(void); /** - * The next commitment number for the sender + * Utility method to constructs a new IgnoreAndLog-variant ErrorAction */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); /** - * The next commitment number for the sender + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction */ -void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); /** - * The next commitment number for the recipient + * Utility method to constructs a new SendErrorMessage-variant ErrorAction */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); /** - * The next commitment number for the recipient + * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. */ -void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +void LightningError_free(struct LDKLightningError this_obj); /** - * Creates a copy of the ChannelReestablish + * A human-readable message describing the error */ -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. + * A human-readable message describing the error */ -void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); /** - * The channel ID + * The action which should be taken against the offending peer. */ -const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * The channel ID + * The action which should be taken against the offending peer. */ -void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); /** - * The short channel ID + * Constructs a new LightningError given each field */ -uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); /** - * The short channel ID + * Creates a copy of the LightningError */ -void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); /** - * A signature by the node key + * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); /** - * A signature by the node key + * update_add_htlc messages which should be sent */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * A signature by the funding key + * update_add_htlc messages which should be sent */ -struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** - * A signature by the funding key + * update_fulfill_htlc messages which should be sent */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Constructs a new AnnouncementSignatures given each field + * update_fulfill_htlc messages which should be sent */ -MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** - * Creates a copy of the AnnouncementSignatures + * update_fail_htlc messages which should be sent */ -struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the NetAddress + * update_fail_htlc messages which should be sent */ -void NetAddress_free(struct LDKNetAddress this_ptr); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** - * Creates a copy of the NetAddress + * update_fail_malformed_htlc messages which should be sent */ -struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); +struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new IPv4-variant NetAddress + * update_fail_malformed_htlc messages which should be sent */ -struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** - * Utility method to constructs a new IPv6-variant NetAddress + * An update_fee message which should be sent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new OnionV2-variant NetAddress + * An update_fee message which should be sent + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port); +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** - * Utility method to constructs a new OnionV3-variant NetAddress + * Finally, the commitment_signed message which should be sent */ -struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Serialize the NetAddress object into a byte array which can be read by NetAddress_read + * Finally, the commitment_signed message which should be sent */ -struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); /** - * Read a Result from a byte array, created by Result_write + * Constructs a new CommitmentUpdate given each field */ -struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); /** - * Read a NetAddress from a byte array, created by NetAddress_write + * Creates a copy of the CommitmentUpdate */ -struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); /** - * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); +void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); /** - * The advertised features + * Calls the free function if one is set */ -struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); /** - * The advertised features + * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ -void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); /** - * A strictly monotonic announcement counter, with gaps allowed + * Read a AcceptChannel from a byte array, created by AcceptChannel_write */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); /** - * A strictly monotonic announcement counter, with gaps allowed + * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read */ -void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back - * to this node). + * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write */ -struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back - * to this node). + * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); /** - * An RGB color for UI purposes + * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); /** - * An RGB color for UI purposes + * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read */ -void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * Read a ClosingSigned from a byte array, created by ClosingSigned_write */ -const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read */ -void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); /** - * List of addresses on which this node is reachable + * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); /** - * Creates a copy of the UnsignedNodeAnnouncement + * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read */ -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); /** - * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. + * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write */ -void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); /** - * The signature by the node key + * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read */ -struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); /** - * The signature by the node key + * Read a FundingCreated from a byte array, created by FundingCreated_write */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); /** - * The actual content of the announcement + * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read */ -struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); /** - * The actual content of the announcement + * Read a FundingSigned from a byte array, created by FundingSigned_write */ -void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); /** - * Constructs a new NodeAnnouncement given each field + * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); /** - * Creates a copy of the NodeAnnouncement + * Read a FundingLocked from a byte array, created by FundingLocked_write */ -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); /** - * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Serialize the Init object into a byte array which can be read by Init_read */ -void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); /** - * The advertised channel features + * Read a Init from a byte array, created by Init_write */ -struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); /** - * The advertised channel features + * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read */ -void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); /** - * The genesis hash of the blockchain where the channel is to be opened + * Read a OpenChannel from a byte array, created by OpenChannel_write */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); /** - * The genesis hash of the blockchain where the channel is to be opened + * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read */ -void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); /** - * The short channel ID + * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); /** - * The short channel ID + * Serialize the Shutdown object into a byte array which can be read by Shutdown_read */ -void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); /** - * One of the two node_ids which are endpoints of this channel + * Read a Shutdown from a byte array, created by Shutdown_write */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); /** - * One of the two node_ids which are endpoints of this channel + * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); /** - * The other of the two node_ids which are endpoints of this channel + * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); /** - * The other of the two node_ids which are endpoints of this channel + * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); /** - * The funding key for the first node + * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); /** - * The funding key for the first node + * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); /** - * The funding key for the second node + * Read a UpdateFee from a byte array, created by UpdateFee_write */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); /** - * The funding key for the second node + * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); /** - * Creates a copy of the UnsignedChannelAnnouncement + * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write */ -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); /** - * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read */ -void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); /** - * Authentication of the announcement by the first public node + * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write */ -struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); /** - * Authentication of the announcement by the first public node + * Serialize the Ping object into a byte array which can be read by Ping_read */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); /** - * Authentication of the announcement by the second public node + * Read a Ping from a byte array, created by Ping_write */ -struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); /** - * Authentication of the announcement by the second public node + * Serialize the Pong object into a byte array which can be read by Pong_read */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); /** - * Proof of funding UTXO ownership by the first public node + * Read a Pong from a byte array, created by Pong_write */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); /** - * Proof of funding UTXO ownership by the first public node + * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); /** - * Proof of funding UTXO ownership by the second public node + * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); /** - * Proof of funding UTXO ownership by the second public node + * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); /** - * The actual announcement + * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write */ -struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); /** - * The actual announcement + * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read */ -void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); /** - * Constructs a new ChannelAnnouncement given each field + * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write */ -MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); /** - * Creates a copy of the ChannelAnnouncement + * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read */ -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); /** - * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. + * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write */ -void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); /** - * The genesis hash of the blockchain where the channel is to be opened + * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); /** - * The genesis hash of the blockchain where the channel is to be opened + * Read a ErrorMessage from a byte array, created by ErrorMessage_write */ -void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); /** - * The short channel ID + * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); /** - * The short channel ID + * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write */ -void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read */ -uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write */ -void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); /** - * Channel flags + * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write */ -uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); /** - * Channel flags + * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read */ -void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write */ -void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); /** - * The amount to fee multiplier, in micro-satoshi + * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); /** - * The amount to fee multiplier, in micro-satoshi + * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); /** - * Creates a copy of the UnsignedChannelUpdate + * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write */ -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); /** - * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void ChannelUpdate_free(struct LDKChannelUpdate this_obj); +void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); /** - * A signature of the channel update + * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. */ -struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); /** - * A signature of the channel update + * Constructs a new IgnoringMessageHandler given each field */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); +MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); /** - * The actual channel update + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The actual channel update + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); +struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Constructs a new ChannelUpdate given each field + * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is */ -MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelUpdate + * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is */ -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. */ -void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); +void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); /** - * The genesis hash of the blockchain being queried + * Constructs a new ErroringMessageHandler */ -const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); /** - * The genesis hash of the blockchain being queried + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * The height of the first block for the channel UTXOs being queried + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * The height of the first block for the channel UTXOs being queried + * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. */ -void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void MessageHandler_free(struct LDKMessageHandler this_obj); /** - * The number of blocks to include in the query results + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * The number of blocks to include in the query results + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** - * Constructs a new QueryChannelRange given each field + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`NetGraphMsgHandler`] object or an + * [`IgnoringMessageHandler`]. + * + * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler */ -MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Creates a copy of the QueryChannelRange + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`NetGraphMsgHandler`] object or an + * [`IgnoringMessageHandler`]. + * + * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler */ -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); /** - * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. + * Constructs a new MessageHandler given each field */ -void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg); /** - * The genesis hash of the blockchain being queried + * Creates a copy of a SocketDescriptor */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** - * The genesis hash of the blockchain being queried + * Calls the free function if one is set */ -void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); /** - * The height of the first block in the range of the reply + * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. */ -uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void PeerHandleError_free(struct LDKPeerHandleError this_obj); /** - * The height of the first block in the range of the reply + * Used to indicate that we probably can't make any future connections to this peer, implying + * we should go ahead and force-close any channels we have with it. */ -void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); /** - * The number of blocks included in the range of the reply + * Used to indicate that we probably can't make any future connections to this peer, implying + * we should go ahead and force-close any channels we have with it. */ -uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); /** - * The number of blocks included in the range of the reply + * Constructs a new PeerHandleError given each field */ -void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); /** - * True when this is the final reply for a query + * Creates a copy of the PeerHandleError */ -bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); /** - * True when this is the final reply for a query + * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. */ -void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +void PeerManager_free(struct LDKPeerManager this_obj); /** - * The short_channel_ids in the channel range + * Constructs a new PeerManager with the given message handlers and node_id secret key + * ephemeral_random_data is used to derive per-connection ephemeral keys and must be + * cryptographically secure random bytes. */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler); /** - * Constructs a new ReplyChannelRange given each field + * Get the list of node ids for peers which have completed the initial handshake. + * + * For outbound connections, this will be the same as the their_node_id parameter passed in to + * new_outbound_connection, however entries will only appear once the initial handshake has + * completed and we are sure the remote peer has the private key for the given node_id. */ -MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); +MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Creates a copy of the ReplyChannelRange + * Indicates a new outbound connection has been established to a node with the given node_id. + * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new + * descriptor but must disconnect the connection immediately. + * + * Returns a small number of bytes to send to the remote node (currently always 50). + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected()`]. + * + * [`socket_disconnected()`]: PeerManager::socket_disconnected */ -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); /** - * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. + * Indicates a new inbound connection has been established. + * + * May refuse the connection by returning an Err, but will never write bytes to the remote end + * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT + * call socket_disconnected for the new descriptor but must disconnect the connection + * immediately. + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected()`]. + * + * [`socket_disconnected()`]: PeerManager::socket_disconnected */ -void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); /** - * The genesis hash of the blockchain being queried + * Indicates that there is room to write data to the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before + * returning. Thus, be very careful with reentrancy issues! The invariants around calling + * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be + * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't + * sufficient! + * + * [`send_data`]: SocketDescriptor::send_data + * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * The genesis hash of the blockchain being queried + * Indicates that data was read from the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. + * Thus, however, you should call [`process_events`] after any `read_event` to generate + * [`send_data`] calls to handle responses. + * + * If `Ok(true)` is returned, further read_events should not be triggered until a + * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the + * send buffer). + * + * [`send_data`]: SocketDescriptor::send_data + * [`process_events`]: PeerManager::process_events */ -void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** - * The short_channel_ids that are being queried + * Checks for any events generated by our handlers and processes them. Includes sending most + * response messages as well as messages generated by calls to handler functions directly (eg + * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). + * + * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * You don't have to call this function explicitly if you are using [`lightning-net-tokio`] + * or one of the other clients provided in our language bindings. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards + * [`send_data`]: SocketDescriptor::send_data */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Constructs a new QueryShortChannelIds given each field + * Indicates that the given socket descriptor's connection is now closed. */ -MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * Creates a copy of the QueryShortChannelIds + * Disconnect a peer given its node id. + * + * Set `no_connection_possible` to true to prevent any further connection with this peer, + * force-closing any channels we have with it. + * + * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the + * peer. Thus, be very careful about reentrancy issues. + * + * [`disconnect_socket`]: SocketDescriptor::disconnect_socket */ -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); /** - * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. + * 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 ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); +void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * The genesis hash of the blockchain that was queried + * Send pings to each peer and disconnect those which did not respond to the last round of + * pings. + * + * This may be called on any timescale you want, however, roughly once every five to ten + * seconds is preferred. The call rate determines both how often we send a ping to our peers + * and how much time they have to respond before we disconnect them. + * + * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * [`send_data`]: SocketDescriptor::send_data */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; +void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * The genesis hash of the blockchain that was queried + * Gets the weight for an HTLC-Success transaction. */ -void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t htlc_success_tx_weight(bool opt_anchors); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * Gets the weight for an HTLC-Timeout transaction. */ -bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); +uint64_t htlc_timeout_tx_weight(bool opt_anchors); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * Build the commitment secret from the seed and the commitment number */ -void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); +struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); /** - * Constructs a new ReplyShortChannelIdsEnd given each field + * Build a closing transaction */ -MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); +struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * Creates a copy of the ReplyShortChannelIdsEnd + * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) + * from the base secret and the per_commitment_point. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). */ -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** - * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. + * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) + * from the base point and the per_commitment_key. This is the public equivalent of + * derive_private_key - using only public keys to derive a public key instead of private keys. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). */ -void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); +struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); /** - * The genesis hash of the blockchain for channel and node information + * Derives a per-commitment-transaction revocation key from its constituent parts. + * + * Only the cheating participant owns a valid witness to propagate a revoked + * commitment transaction, thus per_commitment_secret always come from cheater + * and revocation_base_secret always come from punisher, which is the broadcaster + * of the transaction spending with this key knowledge. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** - * The genesis hash of the blockchain for channel and node information + * Derives a per-commitment-transaction revocation public key from its constituent parts. This is + * the public equivalend of derive_private_revocation_key - using only public keys to derive a + * public key instead of private keys. + * + * Only the cheating participant owns a valid witness to propagate a revoked + * commitment transaction, thus per_commitment_point always come from cheater + * and revocation_base_point always come from punisher, which is the broadcaster + * of the transaction spending with this key knowledge. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). */ -void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); /** - * The starting unix timestamp + * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. */ -uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); /** - * The starting unix timestamp + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * The range of information in seconds + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The range of information in seconds + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Constructs a new GossipTimestampFilter given each field + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the GossipTimestampFilter + * Broadcaster's HTLC Key */ -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ErrorAction + * Broadcaster's HTLC Key */ -void ErrorAction_free(struct LDKErrorAction this_ptr); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the ErrorAction + * Countersignatory's HTLC Key */ -struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); +struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DisconnectPeer-variant ErrorAction + * Countersignatory's HTLC Key */ -struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new IgnoreError-variant ErrorAction + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKErrorAction ErrorAction_ignore_error(void); +struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new IgnoreAndLog-variant ErrorAction + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new SendErrorMessage-variant ErrorAction + * Constructs a new TxCreationKeys given each field */ -struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg); /** - * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. + * Creates a copy of the TxCreationKeys */ -void LightningError_free(struct LDKLightningError this_obj); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); /** - * A human-readable message describing the error + * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read */ -struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); /** - * A human-readable message describing the error + * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write */ -void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); /** - * The action which should be taken against the offending peer. + * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. */ -struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); +void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); /** - * The action which should be taken against the offending peer. + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. */ -void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Constructs a new LightningError given each field + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. */ -MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the LightningError + * The base point which is used (with derive_public_revocation_key) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); +struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. + * The base point which is used (with derive_public_revocation_key) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * update_add_htlc messages which should be sent + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * update_fulfill_htlc messages which should be sent + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * update_fail_htlc messages which should be sent + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); +struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * update_fail_malformed_htlc messages which should be sent + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * An update_fee message which should be sent - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * An update_fee message which should be sent - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Finally, the commitment_signed message which should be sent + * Constructs a new ChannelPublicKeys given each field */ -struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); /** - * Finally, the commitment_signed message which should be sent + * Creates a copy of the ChannelPublicKeys */ -void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); /** - * Constructs a new CommitmentUpdate given each field + * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read */ -MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); /** - * Creates a copy of the CommitmentUpdate + * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write */ -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); /** - * Frees any resources used by the HTLCFailChannelUpdate + * Create per-state keys from channel base points and the per-commitment point. + * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr); +MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); /** - * Creates a copy of the HTLCFailChannelUpdate + * Generate per-state keys from channel static keys. + * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** - * Utility method to constructs a new ChannelUpdateMessage-variant HTLCFailChannelUpdate + * A script either spendable by the revocation + * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. + * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. */ -struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_update_message(struct LDKChannelUpdate msg); +struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); /** - * Utility method to constructs a new ChannelClosed-variant HTLCFailChannelUpdate + * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. */ -struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent); +void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); /** - * Utility method to constructs a new NodeFailure-variant HTLCFailChannelUpdate + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** - * Calls the free function if one is set + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a AcceptChannel from a byte array, created by AcceptChannel_write + * The CLTV lock-time at which this HTLC expires. */ -struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read + * The CLTV lock-time at which this HTLC expires. */ -struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** - * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write + * The hash of the preimage which unlocks this HTLC. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** - * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read + * The hash of the preimage which unlocks this HTLC. */ -struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); +struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); +void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Read a ClosingSigned from a byte array, created by ClosingSigned_write + * Constructs a new HTLCOutputInCommitment given each field */ -struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); /** - * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read + * Creates a copy of the HTLCOutputInCommitment */ -struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); /** - * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write + * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); /** - * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read + * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write */ -struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); /** - * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write + * 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 LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** - * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read + * Gets the redeemscript for a funding output from the two funding public keys. + * Note that the order of funding public keys does not matter. */ -struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** - * Read a FundingCreated from a byte array, created by FundingCreated_write + * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC + * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the + * transaction which needs signing, and can be used to construct an HTLC transaction which is + * broadcastable given a counterparty HTLC signature. + * + * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the + * commitment transaction). */ -struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); +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); /** - * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read + * 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 FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); +struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** - * Read a FundingSigned from a byte array, created by FundingSigned_write + * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); +void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); /** - * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read + * Holder public keys */ -struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a FundingLocked from a byte array, created by FundingLocked_write + * Holder public keys */ -struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Serialize the Init object into a byte array which can be read by Init_read + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a Init from a byte array, created by Init_write + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a OpenChannel from a byte array, created by OpenChannel_write + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); /** - * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); /** - * Serialize the Shutdown object into a byte array which can be read by Shutdown_read + * The late-bound funding outpoint + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a Shutdown from a byte array, created by Shutdown_write + * The late-bound funding outpoint + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read + * Are anchors used for this channel. Boolean is serialization backwards-compatible */ -struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write + * Are anchors used for this channel. Boolean is serialization backwards-compatible */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read + * Constructs a new ChannelTransactionParameters given each field */ -struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); +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); /** - * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write + * Creates a copy of the ChannelTransactionParameters */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); /** - * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read + * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); /** - * Read a UpdateFee from a byte array, created by UpdateFee_write + * Counter-party public keys */ -struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read + * Counter-party public keys */ -struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write + * Constructs a new CounterpartyChannelTransactionParameters given each field */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); /** - * Serialize the Ping object into a byte array which can be read by Ping_read + * Creates a copy of the CounterpartyChannelTransactionParameters */ -struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); /** - * Read a Ping from a byte array, created by Ping_write + * Whether the late bound parameters are populated. */ -struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the Pong object into a byte array which can be read by Pong_read + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the holder is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Read a Pong from a byte array, created by Pong_write + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the counterparty is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read + * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); /** - * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write + * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); /** - * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read + * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read */ -struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); /** - * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write + * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); /** - * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read + * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); +void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); /** - * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write + * Get the channel pubkeys for the broadcaster */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read + * Get the channel pubkeys for the countersignatory */ -struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write + * Get the contest delay applicable to the transactions. + * Note that the contest delay was selected by the countersignatory. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read + * Whether the channel is outbound from the broadcaster. + * + * The boolean representing the side that initiated the channel is + * an input to the commitment number obscure factor computation. */ -struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Read a ErrorMessage from a byte array, created by ErrorMessage_write + * The funding outpoint */ -struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read + * Whether to use anchors for this channel */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); +MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write + * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); /** - * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read + * Our counterparty's signature for the transaction */ -struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); +struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write + * Our counterparty's signature for the transaction */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); /** - * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read + * Creates a copy of the HolderCommitmentTransaction */ -struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); /** - * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write + * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); /** - * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read + * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write */ -struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); /** - *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t + * Create a new holder transaction with the given counterparty signatures. + * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ -MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); /** - * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write + * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); +void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); /** - * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read + * The commitment transaction */ -struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write + * The commitment transaction */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** - * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; /** - * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + * Constructs a new BuiltCommitmentTransaction given each field */ -struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); +MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); /** - * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. + * Creates a copy of the BuiltCommitmentTransaction */ -void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); /** - * Constructs a new IgnoringMessageHandler given each field + * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read */ -MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write */ -struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. */ -void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); +MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Constructs a new ErroringMessageHandler + * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); +void ClosingTransaction_free(struct LDKClosingTransaction this_obj); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * Creates a copy of the ClosingTransaction */ -struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * Checks if two ClosingTransactions contain equal inner contents. */ -struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); /** - * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. + * Construct an object of the class */ -void MessageHandler_free(struct LDKMessageHandler this_obj); +MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * Trust our pre-built transaction. * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Applies a wrapper which allows access to the transaction. + * + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * Verify our pre-built transaction. * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Applies a wrapper which allows access to the transaction. + * + * An external validating signer must call this method before signing + * or using the built transaction. + */ +MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); + +/** + * The value to be sent to the holder, or zero if the output will be omitted */ -void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); +MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`NetGraphMsgHandler`] object or an - * [`IgnoringMessageHandler`]. - * - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * The value to be sent to the counterparty, or zero if the output will be omitted */ -const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`NetGraphMsgHandler`] object or an - * [`IgnoringMessageHandler`]. - * - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * The destination of the holder's output */ -void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Constructs a new MessageHandler given each field + * The destination of the counterparty's output */ -MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Creates a copy of a SocketDescriptor + * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); +void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); /** - * Calls the free function if one is set + * The pre-built Bitcoin commitment transaction */ -void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); +MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -void PeerHandleError_free(struct LDKPeerHandleError this_obj); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Used to indicate that we probably can't make any future connections to this peer, implying - * we should go ahead and force-close any channels we have with it. + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. */ -bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Used to indicate that we probably can't make any future connections to this peer, implying - * we should go ahead and force-close any channels we have with it. + * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); +void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); /** - * Constructs a new PeerHandleError given each field + * Creates a copy of the CommitmentTransaction */ -MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); /** - * Creates a copy of the PeerHandleError + * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read */ -struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); /** - * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. + * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write */ -void PeerManager_free(struct LDKPeerManager this_obj); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); /** - * Constructs a new PeerManager with the given message handlers and node_id secret key - * ephemeral_random_data is used to derive per-connection ephemeral keys and must be - * cryptographically secure random bytes. + * The backwards-counting commitment number */ -MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger); +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Get the list of node ids for peers which have completed the initial handshake. - * - * For outbound connections, this will be the same as the their_node_id parameter passed in to - * new_outbound_connection, however entries will only appear once the initial handshake has - * completed and we are sure the remote peer has the private key for the given node_id. + * The value to be sent to the broadcaster */ -MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Indicates a new outbound connection has been established to a node with the given node_id. - * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new - * descriptor but must disconnect the connection immediately. - * - * Returns a small number of bytes to send to the remote node (currently always 50). - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected()`]. - * - * [`socket_disconnected()`]: PeerManager::socket_disconnected + * The value to be sent to the counterparty */ -MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Indicates a new inbound connection has been established. - * - * May refuse the connection by returning an Err, but will never write bytes to the remote end - * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT - * call socket_disconnected for the new descriptor but must disconnect the connection - * immediately. - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected()`]. - * - * [`socket_disconnected()`]: PeerManager::socket_disconnected + * The feerate paid per 1000-weight-unit in this commitment transaction. */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); +MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Indicates that there is room to write data to the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. + * Trust our pre-built transaction and derived transaction creation public keys. * - * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before - * returning. Thus, be very careful with reentrancy issues! The invariants around calling - * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be - * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't - * sufficient! + * Applies a wrapper which allows access to these fields. * - * [`send_data`]: SocketDescriptor::send_data - * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Indicates that data was read from the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. - * - * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. - * Thus, however, you should call [`process_events`] after any `read_event` to generate - * [`send_data`] calls to handle responses. + * Verify our pre-built transaction and derived transaction creation public keys. * - * If `Ok(true)` is returned, further read_events should not be triggered until a - * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the - * send buffer). + * Applies a wrapper which allows access to these fields. * - * [`send_data`]: SocketDescriptor::send_data - * [`process_events`]: PeerManager::process_events + * An external validating signer must call this method before signing + * or using the built transaction. */ -MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); +MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** - * Checks for any events generated by our handlers and processes them. Includes sending most - * response messages as well as messages generated by calls to handler functions directly (eg - * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). - * - * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! - * - * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - * [`send_data`]: SocketDescriptor::send_data + * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); +void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); /** - * Indicates that the given socket descriptor's connection is now closed. + * The transaction ID of the built Bitcoin transaction */ -void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Disconnect a peer given its node id. - * - * Set `no_connection_possible` to true to prevent any further connection with this peer, - * force-closing any channels we have with it. - * - * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the - * peer. Thus, be very careful about reentrancy issues. - * - * [`disconnect_socket`]: SocketDescriptor::disconnect_socket + * The pre-built Bitcoin commitment transaction */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Send pings to each peer and disconnect those which did not respond to the last round of - * pings. - * - * This may be called on any timescale you want, however, roughly once every five to ten - * seconds is preferred. The call rate determines both how often we send a ping to our peers - * and how much time they have to respond before we disconnect them. - * - * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! - * - * [`send_data`]: SocketDescriptor::send_data + * The pre-calculated transaction creation public keys. */ -void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Build the commitment secret from the seed and the commitment number + * Should anchors be used. */ -struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); +MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) - * from the base secret and the per_commitment_point. + * Get a signature for each HTLC which was included in the commitment transaction (ie for + * which HTLCOutputInCommitment::transaction_output_index.is_some()). * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * The returned Vec has one entry for each HTLC, and in the same order. */ -struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); /** - * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) - * from the base point and the per_commitment_key. This is the public equivalent of - * derive_private_key - using only public keys to derive a public key instead of private keys. + * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a + * shared secret first. This prevents on-chain observers from discovering how many commitment + * transactions occurred in a channel before it was closed. * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * This function gets the shared secret from relevant channel public keys and can be used to + * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. */ -struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); /** - * Derives a per-commitment-transaction revocation key from its constituent parts. - * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_secret always come from cheater - * and revocation_base_secret always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * Checks if two InitFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); /** - * Derives a per-commitment-transaction revocation public key from its constituent parts. This is - * the public equivalend of derive_private_revocation_key - using only public keys to derive a - * public key instead of private keys. - * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_point always come from cheater - * and revocation_base_point always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * Checks if two NodeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); /** - * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. + * Checks if two ChannelFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); +bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * Checks if two InvoiceFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * 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. */ -void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Creates a copy of the InitFeatures */ -struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Creates a copy of the NodeFeatures */ -void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); /** - * Broadcaster's HTLC Key + * Creates a copy of the ChannelFeatures */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); /** - * Broadcaster's HTLC Key + * Creates a copy of the InvoiceFeatures */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); /** - * Countersignatory's HTLC Key + * Creates a copy of the ChannelTypeFeatures */ -struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); /** - * Countersignatory's HTLC Key + * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InitFeatures_free(struct LDKInitFeatures this_obj); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void NodeFeatures_free(struct LDKNodeFeatures this_obj); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelFeatures_free(struct LDKChannelFeatures this_obj); /** - * Constructs a new TxCreationKeys given each field + * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg); +void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); /** - * Creates a copy of the TxCreationKeys + * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); +void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); /** - * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); +MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); /** - * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write + * Creates a Features with the bits set which are known by the implementation */ -struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void); /** - * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); +MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * Create a blank Features with no features set */ -struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * Creates a Features with the bits set which are known by the implementation */ -void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void); /** - * The base point which is used (with derive_public_revocation_key) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_revocation_key) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Create a blank Features with no features set */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Creates a Features with the bits set which are known by the implementation */ -struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Create a blank Features with no features set */ -struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Creates a Features with the bits set which are known by the implementation */ -void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Create a blank Features with no features set */ -void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); /** - * Constructs a new ChannelPublicKeys given each field + * Creates a Features with the bits set which are known by the implementation */ -MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void); /** - * Creates a copy of the ChannelPublicKeys + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read + * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read */ -struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); /** - * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write + * Read a InitFeatures from a byte array, created by InitFeatures_write */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); /** - * Create per-state keys from channel base points and the per-commitment point. - * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. + * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read */ -MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); /** - * Generate per-state keys from channel static keys. - * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write */ -MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); /** - * A script either spendable by the revocation - * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. - * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read */ -struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); /** - * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. + * Read a NodeFeatures from a byte array, created by NodeFeatures_write */ -void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read */ -bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write */ -void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write */ -void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); /** - * The CLTV lock-time at which this HTLC expires. + * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +void ShutdownScript_free(struct LDKShutdownScript this_obj); /** - * The CLTV lock-time at which this HTLC expires. + * Creates a copy of the ShutdownScript */ -void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); +struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); /** - * The hash of the preimage which unlocks this HTLC. + * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; +void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); /** - * The hash of the preimage which unlocks this HTLC. + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md */ -void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md */ -struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * Constructs a new InvalidShutdownScript given each field */ -void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); /** - * Constructs a new HTLCOutputInCommitment given each field + * Creates a copy of the InvalidShutdownScript */ -MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); +struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); /** - * Creates a copy of the HTLCOutputInCommitment + * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read */ -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); +struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); /** - * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read + * Read a ShutdownScript from a byte array, created by ShutdownScript_write */ -struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); +struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); /** - * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write + * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); /** - * 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. + * Generates a P2WSH script pubkey from the given [`WScriptHash`]. */ -struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); /** - * Gets the redeemscript for a funding output from the two funding public keys. - * Note that the order of funding public keys does not matter. + * Generates a witness script pubkey from the given segwit version and program. + * + * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or + * [`ShutdownScript::new_p2wsh`] instead. + * + * # Errors + * + * This function may return an error if `program` is invalid for the segwit `version`. */ -struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program); /** - * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC - * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the - * transaction which needs signing, and can be used to construct an HTLC transaction which is - * broadcastable given a counterparty HTLC signature. - * - * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the - * commitment transaction). + * Converts the shutdown script into the underlying [`Script`]. */ -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); +MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); /** - * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); +MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); /** - * Holder public keys + * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. + * + * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. */ -struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); /** - * Holder public keys + * Calls the free function if one is set */ -void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Calls the free function if one is set */ -uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void Type_free(struct LDKType this_ptr); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. */ -void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +void NodeId_free(struct LDKNodeId this_obj); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Creates a copy of the NodeId */ -bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Create a new NodeId from a public key */ -void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Get the public key slice from this NodeId */ -struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two NodeIds contain equal inner contents. */ -void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); +uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); /** - * The late-bound funding outpoint - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the NodeId object into a byte array which can be read by NodeId_read */ -struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); /** - * The late-bound funding outpoint - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a NodeId from a byte array, created by NodeId_write */ -void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); /** - * Constructs a new ChannelTransactionParameters given each field + * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. */ -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); +void NetworkGraph_free(struct LDKNetworkGraph this_obj); /** - * Creates a copy of the ChannelTransactionParameters + * Creates a copy of the NetworkGraph */ -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); /** - * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. */ -void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); +void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); /** - * Counter-party public keys + * Frees any resources used by the NetworkUpdate */ -struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); /** - * Counter-party public keys + * Creates a copy of the NetworkUpdate */ -void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate */ -uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Utility method to constructs a new ChannelClosed-variant NetworkUpdate */ -void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent); /** - * Constructs a new CounterpartyChannelTransactionParameters given each field + * Utility method to constructs a new NodeFailure-variant NetworkUpdate */ -MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); +struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); /** - * Creates a copy of the CounterpartyChannelTransactionParameters + * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read */ -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); /** - * Whether the late bound parameters are populated. + * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write */ -MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the holder is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * 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 */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the counterparty is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); /** - * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read + * Creates a new tracker of the actual state of the network of channels and nodes, + * assuming an existing Network Graph. + * Chain monitor is used to make sure announced channels exist on-chain, + * channel data is correct, and that the announcement is signed with + * channel owners' keys. */ -struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); +MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); /** - * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write + * Adds a provider used to check new announcements. Does not affect + * existing announcements unless they are updated. + * Add, update or remove the provider would replace the current one. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); +void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); /** - * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); +struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); /** - * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); +struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); /** - * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL. */ -void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); +void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj); /** - * Get the channel pubkeys for the broadcaster + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Get the channel pubkeys for the countersignatory + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Get the contest delay applicable to the transactions. - * Note that the contest delay was selected by the countersignatory. + * Whether the channel can be currently used for payments (in this one direction). */ -MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Whether the channel is outbound from the broadcaster. - * - * The boolean representing the side that initiated the channel is - * an input to the commitment number obscure factor computation. + * Whether the channel can be currently used for payments (in this one direction). */ -MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); /** - * The funding outpoint + * The difference in CLTV values that you must have when routing through this channel. */ -MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. + * The difference in CLTV values that you must have when routing through this channel. */ -void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); +void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Our counterparty's signature for the transaction + * The minimum value, which must be relayed to the next hop via the channel */ -struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Our counterparty's signature for the transaction + * The minimum value, which must be relayed to the next hop via the channel */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); +void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * The maximum value which may be relayed to the next hop via the channel. */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the HolderCommitmentTransaction + * The maximum value which may be relayed to the next hop via the channel. */ -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); +void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read + * Fees charged when the channel is used for routing */ -struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); +struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write + * Fees charged when the channel is used for routing */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); +void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Create a new holder transaction with the given counterparty signatures. - * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); +struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); +void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); /** - * The commitment transaction + * Constructs a new DirectionalChannelInfo given each field */ -struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); /** - * The commitment transaction + * Creates a copy of the DirectionalChannelInfo */ -void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); +struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read */ -const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write */ -void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); /** - * Constructs a new BuiltCommitmentTransaction given each field + * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); +void ChannelInfo_free(struct LDKChannelInfo this_obj); /** - * Creates a copy of the BuiltCommitmentTransaction + * Protocol features of a channel communicated during its announcement */ -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read + * Protocol features of a channel communicated during its announcement */ -struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write + * Source node of the first direction of a channel */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Get the SIGHASH_ALL sighash value of the transaction. - * - * This can be used to verify a signature. + * Source node of the first direction of a channel */ -MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Sign a transaction, either because we are counter-signing the counterparty's transaction or - * because we are about to broadcast a holder transaction. + * Details about the first direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. + * Details about the first direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** - * Creates a copy of the CommitmentTransaction + * Source node of the second direction of a channel */ -struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); +struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read + * Source node of the second direction of a channel */ -struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write + * Details about the second direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); +struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * The backwards-counting commitment number + * Details about the second direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); /** - * The value to be sent to the broadcaster + * The channel capacity as seen on-chain, if chain lookup is available. */ -MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * The value to be sent to the counterparty + * The channel capacity as seen on-chain, if chain lookup is available. */ -MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Trust our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. * - * This should only be used if you fully trust the builder of this object. It should not - *\tbe used by an external signer - instead use the verify function. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); /** - * Verify our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. - * - * An external validating signer must call this method before signing - * or using the built transaction. + * Creates a copy of the ChannelInfo */ -MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); /** - * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ -void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); /** - * The transaction ID of the built Bitcoin transaction + * Read a ChannelInfo from a byte array, created by ChannelInfo_write */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); /** - * The pre-built Bitcoin commitment transaction + * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void RoutingFees_free(struct LDKRoutingFees this_obj); /** - * The pre-calculated transaction creation public keys. + * Flat routing fee in satoshis */ -MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Get a signature for each HTLC which was included in the commitment transaction (ie for - * which HTLCOutputInCommitment::transaction_output_index.is_some()). - * - * The returned Vec has one entry for each HTLC, and in the same order. + * Flat routing fee in satoshis */ -MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a - * shared secret first. This prevents on-chain observers from discovering how many commitment - * transactions occurred in a channel before it was closed. - * - * This function gets the shared secret from relevant channel public keys and can be used to - * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Checks if two InitFeaturess 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. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two NodeFeaturess contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new RoutingFees given each field */ -bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); +MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); /** - * Checks if two ChannelFeaturess contain equal inner contents. + * Checks if two RoutingFeess 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 ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); +bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); /** - * Checks if two InvoiceFeaturess 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. + * Creates a copy of the RoutingFees */ -bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); /** - * Creates a copy of the InitFeatures + * Checks if two RoutingFeess contain equal inner contents. */ -struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); +uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); /** - * Creates a copy of the NodeFeatures + * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read */ -struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); /** - * Creates a copy of the ChannelFeatures + * Read a RoutingFees from a byte array, created by RoutingFees_write */ -struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); /** - * Creates a copy of the InvoiceFeatures + * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL. */ -struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); +void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); /** - * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. + * Protocol features the node announced support for */ -void InitFeatures_free(struct LDKInitFeatures this_obj); +struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. + * Protocol features the node announced support for */ -void NodeFeatures_free(struct LDKNodeFeatures this_obj); +void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -void ChannelFeatures_free(struct LDKChannelFeatures this_obj); +uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); +void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Create a blank Features with no features set + * Color assigned to the node */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); +const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; /** - * Creates a Features with the bits set which are known by the implementation + * Color assigned to the node */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void); +void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * Create a blank Features with no features set + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); +const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; /** - * Creates a Features with the bits set which are known by the implementation + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void); +void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Create a blank Features with no features set + * Internet-level addresses via which one can connect to the node */ -MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); +void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); /** - * Creates a Features with the bits set which are known by the implementation + * An initial announcement of the node + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void); +struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Create a blank Features with no features set + * An initial announcement of the node + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); +void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); /** - * Creates a Features with the bits set which are known by the implementation + * Constructs a new NodeAnnouncementInfo given each field */ -MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void); +MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); /** - * Returns whether the `payment_secret` feature is supported. + * Creates a copy of the NodeAnnouncementInfo */ -MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); /** - * Returns whether the `payment_secret` feature is supported. + * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read */ -MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); /** - * Returns whether the `payment_secret` feature is supported. + * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write */ -MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); /** - * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read + * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); +void NodeInfo_free(struct LDKNodeInfo this_obj); /** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + * All valid channels a node has announced */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read + * Lowest fees enabling routing via any of the enabled, known channels to a node. + * The two fields (flat and proportional fee) are independent, + * meaning they don't have to refer to the same channel. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); +struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read + * Lowest fees enabling routing via any of the enabled, known channels to a node. + * The two fields (flat and proportional fee) are independent, + * meaning they don't have to refer to the same channel. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); +void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Read a InitFeatures from a byte array, created by InitFeatures_write + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); +struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Read a NodeFeatures from a byte array, created by NodeFeatures_write + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); /** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + * Constructs a new NodeInfo given each field */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); /** - * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write + * Creates a copy of the NodeInfo */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); /** - * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. + * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read */ -void ShutdownScript_free(struct LDKShutdownScript this_obj); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); /** - * Creates a copy of the ShutdownScript + * Read a NodeInfo from a byte array, created by NodeInfo_write */ -struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); /** - * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. + * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read */ -void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md + * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ -struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md + * Creates a new, empty, network graph. */ -void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); /** - * Constructs a new InvalidShutdownScript given each field + * Returns a read-only view of the network graph. */ -MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); +MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement. + * + * 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. */ -struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Read a ShutdownScript from a byte array, created by ShutdownScript_write + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement without verifying the associated signatures. Because we aren't + * given the associated signatures here we cannot relay the node announcement to any of our + * peers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); /** - * Generates a P2PKH script pubkey from the given [`PubkeyHash`]. + * Store or update channel info from a channel announcement. + * + * 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 a `chain::Access` object is provided via `chain_access`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); /** - * Generates a P2SH script pubkey from the given [`ScriptHash`]. + * Store or update channel info from a channel announcement without verifying the associated + * signatures. Because we aren't given the associated signatures here we cannot relay the + * channel announcement to any of our peers. + * + * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); /** - * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. + * Close a channel if a corresponding HTLC fail was sent. + * If permanent, removes a channel from the local storage. + * May cause the removal of nodes too, if this was their last channel. + * If not permanent, makes channels unavailable for routing. */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); +void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); /** - * Generates a P2WSH script pubkey from the given [`WScriptHash`]. + * Marks a node in the graph as failed. */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); +void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); /** - * Generates a witness script pubkey from the given segwit version and program. - * - * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or - * [`ShutdownScript::new_p2wsh`] instead. + * 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. * - * # Errors + * 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 may return an error if `program` is invalid for the segwit `version`. + * This function takes the current unix time as an argument. For users with the `std` feature + * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable. */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program); +void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); /** - * Converts the shutdown script into the underlying [`Script`]. + * For an already known (from announcement) channel, update info about one of the directions + * of the channel. + * + * 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 LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. + * 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. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); -/** - * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. - * - * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. +/** + * Get network addresses by node id. + * Returns None if the requested node is completely unknown, + * or if node announcement for the node was never received. */ -MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. @@ -18494,6 +23192,18 @@ MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, str */ struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); +/** + * Checks if two RouteHops contain equal inner contents. + */ +uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); + +/** + * Checks if two RouteHops 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 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 */ @@ -18517,754 +23227,598 @@ void Route_free(struct LDKRoute this_obj); * 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); - -/** - * Constructs a new Route given each field - */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); - -/** - * Creates a copy of the Route - */ -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); - -/** - * 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 RouteHint, if is_owned is set and inner is non-NULL. - */ -void RouteHint_free(struct LDKRouteHint this_obj); - -/** - * Checks if two RouteHints 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 RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); - -/** - * Creates a copy of the RouteHint - */ -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); - -/** - * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. - */ -void RouteHintHop_free(struct LDKRouteHintHop this_obj); - -/** - * The node_id of the non-target end of the route - */ -struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The node_id of the non-target end of the route - */ -void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - -/** - * The short_channel_id of this channel - */ -uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The short_channel_id of this channel - */ -void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); - -/** - * The fees which must be paid to use this channel - */ -struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The fees which must be paid to use this channel - */ -void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - -/** - * The difference in CLTV values between this node and the next node. - */ -uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The difference in CLTV values between this node and the next node. - */ -void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); - -/** - * The minimum value, in msat, which must be relayed to the next hop. - */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The minimum value, in msat, which must be relayed to the next hop. - */ -void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - -/** - * The maximum value in msat available for routing with a single HTLC. - */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - -/** - * The maximum value in msat available for routing with a single HTLC. - */ -void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - -/** - * Constructs a new RouteHintHop given each field - */ -MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); - -/** - * Checks if two RouteHintHops 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 RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); - -/** - * Creates a copy of the RouteHintHop - */ -struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); +struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * 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 + * 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 LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, 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); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); /** - * Gets 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. - * 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. - * - * 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 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. + * 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`]. * - * 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_id, 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); - -/** - * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. - */ -void NetworkGraph_free(struct LDKNetworkGraph this_obj); - -/** - * Creates a copy of the NetworkGraph - */ -struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); - -/** - * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL. - */ -void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj); - -/** - * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL. - */ -void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); - -/** - * Creates a new tracker of the actual state of the network of channels and nodes, - * assuming a fresh network graph. - * Chain monitor is used to make sure announced channels exist on-chain, - * channel data is correct, and that the announcement is signed with - * channel owners' keys. + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed * - * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger); +struct LDKPayee Route_get_payee(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Creates a new tracker of the actual state of the network of channels and nodes, - * assuming an existing Network Graph. + * 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`]. * - * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph); - -/** - * Adds a provider used to check new announcements. Does not affect - * existing announcements unless they are updated. - * Add, update or remove the provider would replace the current one. + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed * - * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access); - -/** - * Take a read lock on the network_graph and return it in the C-bindings - * newtype helper. This is likely only useful when called via the C - * bindings as you can call `self.network_graph.read().unwrap()` in Rust - * yourself. - */ -MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - -/** - * Get a reference to the NetworkGraph which this read-lock contains. - */ -MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg); - -/** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is - */ -struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - -/** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is - */ -struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - -/** - * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL. - */ -void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj); - -/** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +void Route_set_payee(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPayee val); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Constructs a new Route given each field */ -void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPayee payee_arg); /** - * Whether the channel can be currently used for payments (in this one direction). + * Creates a copy of the Route */ -bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); /** - * Whether the channel can be currently used for payments (in this one direction). + * Checks if two Routes contain equal inner contents. */ -void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); +uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); /** - * The difference in CLTV values that you must have when routing through this channel. + * 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. */ -uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); /** - * The difference in CLTV values that you must have when routing through this channel. + * 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`. */ -void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * The minimum value, which must be relayed to the next hop via the channel + * Returns the total amount paid on this [`Route`], excluding the fees. */ -uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); /** - * The minimum value, which must be relayed to the next hop via the channel + * Serialize the Route object into a byte array which can be read by Route_read */ -void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); /** - * The maximum value which may be relayed to the next hop via the channel. + * Read a Route from a byte array, created by Route_write */ -struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); /** - * The maximum value which may be relayed to the next hop via the channel. + * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. */ -void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void RouteParameters_free(struct LDKRouteParameters this_obj); /** - * Fees charged when the channel is used for routing + * The recipient of the failed payment path. */ -struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +struct LDKPayee RouteParameters_get_payee(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Fees charged when the channel is used for routing + * The recipient of the failed payment path. */ -void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +void RouteParameters_set_payee(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPayee val); /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The amount in msats sent on the failed payment path. */ -struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); +uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); -/** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +/** + * The amount in msats sent on the failed payment path. */ -void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); +void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new DirectionalChannelInfo given each field + * The CLTV on the final hop of the failed payment path. */ -MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); +uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the DirectionalChannelInfo + * The CLTV on the final hop of the failed payment path. */ -struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); +void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read + * Constructs a new RouteParameters given each field */ -struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPayee payee_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg); /** - * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write + * Creates a copy of the RouteParameters */ -struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); +struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. + * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ -void ChannelInfo_free(struct LDKChannelInfo this_obj); +struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); /** - * Protocol features of a channel communicated during its announcement + * Read a RouteParameters from a byte array, created by RouteParameters_write */ -struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); /** - * Protocol features of a channel communicated during its announcement + * Frees any resources used by the Payee, if is_owned is set and inner is non-NULL. */ -void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +void Payee_free(struct LDKPayee this_obj); /** - * Source node of the first direction of a channel + * The node id of the payee. */ -struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKPublicKey Payee_get_pubkey(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Source node of the first direction of a channel + * The node id of the payee. */ -void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void Payee_set_pubkey(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Details about the first direction of a channel + * 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 LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKInvoiceFeatures Payee_get_features(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Details about the first direction of a channel + * 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 */ -void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); +void Payee_set_features(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); /** - * Source node of the second direction of a channel + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCVec_RouteHintZ Payee_get_route_hints(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Source node of the second direction of a channel + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void Payee_set_route_hints(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val); /** - * Details about the second direction of a channel - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z Payee_get_expiry_time(const struct LDKPayee *NONNULL_PTR this_ptr); /** - * Details about the second direction of a channel - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); +void Payee_set_expiry_time(struct LDKPayee *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Constructs a new Payee given each field */ -struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +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); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Creates a copy of the Payee */ -void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); /** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two Payees contain equal inner contents. */ -struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); /** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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. */ -void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); /** - * Constructs a new ChannelInfo given each field + * Serialize the Payee object into a byte array which can be read by Payee_read */ -MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); +struct LDKCVec_u8Z Payee_write(const struct LDKPayee *NONNULL_PTR obj); /** - * Creates a copy of the ChannelInfo + * Read a Payee from a byte array, created by Payee_write */ -struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); +struct LDKCResult_PayeeDecodeErrorZ Payee_read(struct LDKu8slice ser); /** - * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read + * Creates a payee with the node id of the given `pubkey`. */ -struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); +MUST_USE_RES struct LDKPayee Payee_from_node_id(struct LDKPublicKey pubkey); /** - * Read a ChannelInfo from a byte array, created by ChannelInfo_write + * Creates a payee with the node id of the given `pubkey` to use for keysend payments. */ -struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPayee Payee_for_keysend(struct LDKPublicKey pubkey); /** - * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. + * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. */ -void RoutingFees_free(struct LDKRoutingFees this_obj); +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); /** - * Flat routing fee in satoshis + * Constructs a new RouteHint given each field */ -uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); /** - * Flat routing fee in satoshis + * Creates a copy of the RouteHint */ -void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Checks if two RouteHints contain equal inner contents. */ -uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Checks if two RouteHints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); /** - * Constructs a new RoutingFees given each field + * Serialize the RouteHint object into a byte array which can be read by RouteHint_read */ -MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); +struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); /** - * Checks if two RoutingFeess 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. + * Read a RouteHint from a byte array, created by RouteHint_write */ -bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); +struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); /** - * Creates a copy of the RoutingFees + * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. */ -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); +void RouteHintHop_free(struct LDKRouteHintHop this_obj); /** - * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read + * The node_id of the non-target end of the route */ -struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); +struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Read a RoutingFees from a byte array, created by RoutingFees_write + * The node_id of the non-target end of the route */ -struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); +void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL. + * The short_channel_id of this channel */ -void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); +uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Protocol features the node announced support for + * The short_channel_id of this channel */ -struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Protocol features the node announced support for + * The fees which must be paid to use this channel */ -void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * The fees which must be paid to use this channel */ -uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * The difference in CLTV values between this node and the next node. */ -void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); +uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Color assigned to the node + * The difference in CLTV values between this node and the next node. */ -const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; +void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); /** - * Color assigned to the node + * The minimum value, in msat, which must be relayed to the next hop. */ -void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * The minimum value, in msat, which must be relayed to the next hop. */ -const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; +void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * The maximum value in msat available for routing with a single HTLC. */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Internet-level addresses via which one can connect to the node + * The maximum value in msat available for routing with a single HTLC. */ -void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * An initial announcement of the node - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new RouteHintHop given each field */ -struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); /** - * An initial announcement of the node - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. + * Creates a copy of the RouteHintHop + */ +struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); + +/** + * Checks if two RouteHintHops contain equal inner contents. + */ +uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); + +/** + * Checks if two RouteHintHops 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 RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); + +/** + * 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_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); + +/** + * Finds a route from us (payer) to the given target node (payee). * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 `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. + * + * # Panics + * + * Panics if first_hops contains channels without short_channel_ids; + * [`ChannelManager::list_usable_channels`] will never include such channels. + * + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); +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); /** - * Constructs a new NodeAnnouncementInfo given each field + * Calls the free function if one is set */ -MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); +void Score_free(struct LDKScore this_ptr); /** - * Creates a copy of the NodeAnnouncementInfo + * Calls the free function if one is set */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); +void LockableScore_free(struct LDKLockableScore this_ptr); /** - * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); /** - * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. + * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL. */ -void NodeInfo_free(struct LDKNodeInfo this_obj); +void Scorer_free(struct LDKScorer this_obj); /** - * All valid channels a node has announced + * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL. */ -void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +void ScoringParameters_free(struct LDKScoringParameters this_obj); /** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. + * A fixed penalty in msats to apply to each channel. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Default value: 500 msat */ -struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); /** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. + * A fixed penalty in msats to apply to each channel. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Default value: 500 msat */ -void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. + * A penalty in msats to apply to a channel upon failing to relay a payment. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 */ -struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. + * A penalty in msats to apply to a channel upon failing to relay a payment. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); +void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new NodeInfo given each field + * 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 */ -MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); +uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the NodeInfo + * 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 */ -struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); +void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read + * 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 */ -struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); +uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); /** - * Read a NodeInfo from a byte array, created by NodeInfo_write + * 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 */ -struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); +uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr); /** - * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read + * 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 */ -struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); +void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a NetworkGraph from a byte array, created by NetworkGraph_write + * Constructs a new ScoringParameters given each field */ -struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); +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); /** - * Creates a new, empty, network graph. + * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); +struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement. - * - * 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. + * Read a ScoringParameters from a byte array, created by ScoringParameters_write */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); +struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement without verifying the associated signatures. Because we aren't - * given the associated signatures here we cannot relay the node announcement to any of our - * peers. + * Creates a new scorer using the given scoring parameters. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); +MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params); /** - * Store or update channel info from a channel announcement. - * - * 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 a `chain::Access` object is provided via `chain_access`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. - * - * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); +MUST_USE_RES struct LDKScorer Scorer_default(void); /** - * Store or update channel info from a channel announcement without verifying the associated - * signatures. Because we aren't given the associated signatures here we cannot relay the - * channel announcement to any of our peers. - * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. - * - * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access); +MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void); /** - * Close a channel if a corresponding HTLC fail was sent. - * If permanent, removes a channel from the local storage. - * May cause the removal of nodes too, if this was their last channel. - * If not permanent, makes channels unavailable for routing. + * 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 */ -void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); +struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg); /** - * For an already known (from announcement) channel, update info about one of the directions - * of the channel. - * - * 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. + * Serialize the Scorer object into a byte array which can be read by Scorer_read */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj); /** - * 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. + * Read a Scorer from a byte array, created by Scorer_write */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +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. @@ -19317,23 +23871,35 @@ void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr); * `persist_manager` returns an error. In case of an error, the error is retrieved by calling * either [`join`] or [`stop`]. * - * Typically, users should either implement [`ChannelManagerPersister`] to never return an - * error or call [`join`] and handle any error that may arise. For the latter case, the - * `BackgroundProcessor` must be restarted by calling `start` again after handling the error. + * # Data Persistence * * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's * provided implementation. * - * [top-level documentation]: Self + * Typically, users should either implement [`ChannelManagerPersister`] to never return an + * error or call [`join`] and handle any error that may arise. For the latter case, + * `BackgroundProcessor` must be restarted by calling `start` again after handling the error. + * + * # Event Handling + * + * `event_handler` is responsible for handling events that users should be notified of (e.g., + * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common + * functionality implemented by other handlers. + * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures. + * + * [top-level documentation]: BackgroundProcessor * [`join`]: Self::join * [`stop`]: Self::stop * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager + * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph + * + * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger); +MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger); /** * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -19550,6 +24116,11 @@ enum LDKCurrency Currency_simnet(void); */ enum LDKCurrency Currency_signet(void); +/** + * Checks if two Currencys contain equal inner contents. + */ +uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o); + /** * Checks if two Currencys contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -19561,6 +24132,16 @@ bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency * */ void Sha256_free(struct LDKSha256 this_obj); +/** + * Creates a copy of the Sha256 + */ +struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig); + +/** + * Checks if two Sha256s contain equal inner contents. + */ +uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o); + /** * Checks if two Sha256s contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -19569,38 +24150,40 @@ void Sha256_free(struct LDKSha256 this_obj); bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b); /** - * Creates a copy of the Sha256 + * Frees any resources used by the Description, if is_owned is set and inner is non-NULL. */ -struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig); +void Description_free(struct LDKDescription this_obj); /** - * Frees any resources used by the Description, if is_owned is set and inner is non-NULL. + * Creates a copy of the Description */ -void Description_free(struct LDKDescription this_obj); +struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig); /** * Checks if two Descriptions 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 Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b); +uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o); /** - * Creates a copy of the Description + * Checks if two Descriptions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig); +bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b); /** * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL. */ 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); + /** - * Checks if two PayeePubKeys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new PayeePubKey given each field */ -bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b); +MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg); /** * Creates a copy of the PayeePubKey @@ -19608,16 +24191,21 @@ bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDK struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig); /** - * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL. + * Checks if two PayeePubKeys contain equal inner contents. */ -void ExpiryTime_free(struct LDKExpiryTime this_obj); +uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o); /** - * Checks if two ExpiryTimes contain equal inner contents. + * Checks if two PayeePubKeys 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 ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); +bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b); + +/** + * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL. + */ +void ExpiryTime_free(struct LDKExpiryTime this_obj); /** * Creates a copy of the ExpiryTime @@ -19625,22 +24213,48 @@ bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKEx struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig); /** - * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL. + * Checks if two ExpiryTimes contain equal inner contents. */ -void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj); +uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o); /** - * Checks if two MinFinalCltvExpirys contain equal inner contents. + * Checks if two ExpiryTimes 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 MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b); +bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); + +/** + * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL. + */ +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 */ struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig); +/** + * Checks if two MinFinalCltvExpirys contain equal inner contents. + */ +uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o); + +/** + * Checks if two MinFinalCltvExpirys 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 MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b); + /** * Frees any resources used by the Fallback */ @@ -19666,6 +24280,11 @@ struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a); */ struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a); +/** + * Checks if two Fallbacks contain equal inner contents. + */ +uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o); + /** * Checks if two Fallbacks contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -19677,6 +24296,11 @@ bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallba */ void InvoiceSignature_free(struct LDKInvoiceSignature this_obj); +/** + * Creates a copy of the InvoiceSignature + */ +struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig); + /** * Checks if two InvoiceSignatures contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -19685,26 +24309,26 @@ void InvoiceSignature_free(struct LDKInvoiceSignature this_obj); bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b); /** - * Creates a copy of the InvoiceSignature + * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL. */ -struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig); +void PrivateRoute_free(struct LDKPrivateRoute this_obj); /** - * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL. + * Creates a copy of the PrivateRoute */ -void PrivateRoute_free(struct LDKPrivateRoute this_obj); +struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig); /** * Checks if two PrivateRoutes 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 PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b); +uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o); /** - * Creates a copy of the PrivateRoute + * Checks if two PrivateRoutes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig); +bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b); /** * Disassembles the `SignedRawInvoice` into its three parts: @@ -19838,10 +24462,17 @@ MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const * ``` * use lightning_invoice::*; * - * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\ - * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\ - * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\ - * \tky03ylcqca784w\"; + * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\ + * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\ + * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\ + * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\ + * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\ + * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\ + * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\ + * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\ + * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\ + * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\ + * j5r6drg6k6zcqj0fcwg\"; * * let signed = invoice.parse::().unwrap(); * @@ -19869,10 +24500,8 @@ MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice * /** * Get the payment secret if one was included in the invoice - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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 @@ -19891,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`]. @@ -19913,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, @@ -19989,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. @@ -20025,6 +24664,11 @@ enum LDKSemanticError SemanticError_no_description(void); */ enum LDKSemanticError SemanticError_multiple_descriptions(void); +/** + * Utility method to constructs a new NoPaymentSecret-variant SemanticError + */ +enum LDKSemanticError SemanticError_no_payment_secret(void); + /** * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError */ @@ -20045,6 +24689,11 @@ enum LDKSemanticError SemanticError_invalid_recovery_id(void); */ enum LDKSemanticError SemanticError_invalid_signature(void); +/** + * Utility method to constructs a new ImpreciseAmount-variant SemanticError + */ +enum LDKSemanticError SemanticError_imprecise_amount(void); + /** * Checks if two SemanticErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -20087,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 @@ -20096,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 */