X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=e70de6ff9669467b576305884e32e168c07c7ded;hb=0ac4dbdb8352c898100b34f0ef8ed9cebfea7786;hp=bf4f3ddb1dc658ed030156c69f8a3aa6ae962ee8;hpb=7ebc93258c70a014e9129c0b464256d2ee670751;p=ldk-c-bindings diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index bf4f3dd..e70de6f 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.24.3 */ +/* Generated with cbindgen:0.24.5 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -10,6 +10,27 @@ #include #include "ldk_rust_types.h" +/** + * Whether this blinded HTLC is being failed backwards by the introduction node or a blinded node, + * which determines the failure message that should be used. + */ +typedef enum LDKBlindedFailure { + /** + * This HTLC is being failed backwards by the introduction node, and thus should be failed with + * [`msgs::UpdateFailHTLC`] and error code `0x8000|0x4000|24`. + */ + LDKBlindedFailure_FromIntroductionNode, + /** + * This HTLC is being failed backwards by a blinded node within the path, and thus should be + * failed with [`msgs::UpdateFailMalformedHTLC`] and error code `0x8000|0x4000|24`. + */ + LDKBlindedFailure_FromBlindedNode, + /** + * Must be last for serialization purposes + */ + LDKBlindedFailure_Sentinel, +} LDKBlindedFailure; + /** * Errors that may occur when converting a [`RawBolt11Invoice`] to a [`Bolt11Invoice`]. They relate to * the requirements sections in BOLT #11 @@ -150,6 +171,10 @@ typedef enum LDKBolt12SemanticError { * A payer id was expected but was missing. */ LDKBolt12SemanticError_MissingPayerId, + /** + * The payment id for a refund or request is already in use. + */ + LDKBolt12SemanticError_DuplicatePaymentId, /** * Blinded paths were expected but were missing. */ @@ -196,6 +221,25 @@ typedef enum LDKCOption_NoneZ { /** * An enum representing the status of a channel monitor update persistence. + * + * These are generally used as the return value for an implementation of [`Persist`] which is used + * as the storage layer for a [`ChainMonitor`]. See the docs on [`Persist`] for a high-level + * explanation of how to handle different cases. + * + * While `UnrecoverableError` is provided as a failure variant, it is not truly \"handled\" on the + * calling side, and generally results in an immediate panic. For those who prefer to avoid + * panics, `InProgress` can be used and you can retry the update operation in the background or + * shut down cleanly. + * + * Note that channels should generally *not* be force-closed after a persistence failure. + * Force-closing with the latest [`ChannelMonitorUpdate`] applied may result in a transaction + * being broadcast which can only be spent by the latest [`ChannelMonitor`]! Thus, if the + * latest [`ChannelMonitor`] is not durably persisted anywhere and exists only in memory, naively + * calling [`ChannelManager::force_close_broadcasting_latest_txn`] *may result in loss of funds*! + * + * [`Persist`]: chainmonitor::Persist + * [`ChainMonitor`]: chainmonitor::ChainMonitor + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn */ typedef enum LDKChannelMonitorUpdateStatus { /** @@ -207,17 +251,13 @@ typedef enum LDKChannelMonitorUpdateStatus { */ LDKChannelMonitorUpdateStatus_Completed, /** - * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of - * 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, a [`MonitorEvent::Completed`] can be used to restore the - * channel to an operational state. + * Indicates that the update will happen asynchronously in the background or that a transient + * failure occurred which is being retried in the background and will eventually complete. * - * Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`]. - * If you return this error you must ensure that it is written to disk safely before writing - * the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead. + * This will \"freeze\" a channel, preventing us from revoking old states or submitting a new + * commitment transaction to the counterparty. Once the update(s) which are `InProgress` have + * been completed, a [`MonitorEvent::Completed`] can be used to restore the channel to an + * operational state. * * Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to * occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us @@ -227,56 +267,31 @@ typedef enum LDKChannelMonitorUpdateStatus { * until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later * monitor update for the same channel. * - * 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 + * For deployments where a copy of [`ChannelMonitor`]s and other local state are backed up in + * a remote location (with local copies persisted immediately), it is anticipated that all * updates will return [`InProgress`] until the remote copies could be updated. * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure + * Note that while fully asynchronous persistence of [`ChannelMonitor`] data is generally + * reliable, this feature is considered beta, and a handful of edge-cases remain. Until the + * remaining cases are fixed, in rare cases, *using this feature may lead to funds loss*. + * * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ LDKChannelMonitorUpdateStatus_InProgress, /** - * Used to indicate no further channel monitor updates will be allowed (likely a disk failure - * or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable). - * - * When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast - * our current commitment transaction. This avoids a dangerous case where a local disk failure - * (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s - * for all monitor updates. If we were to broadcast our latest commitment transaction and then - * restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`], - * revoking our now-broadcasted state before seeing it confirm and losing all our funds. - * - * Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost - * the data permanently, we really should broadcast immediately. If the data can be recovered - * with manual intervention, we'd rather close the channel, rejecting future updates to it, - * and broadcast the latest state only if we have HTLCs to claim which are timing out (which - * we do as long as blocks are connected). - * - * In order to broadcast the latest local commitment transaction, you'll need to call - * [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting - * transactions once you've safely ensured no further channel updates can be generated by your - * [`ChannelManager`]. - * - * Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must - * still be processed by a running [`ChannelMonitor`]. This final update will mark the - * [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest - * commitment transaction) are allowed. - * - * Note that even if you return a [`PermanentFailure`] due to unavailability of secondary - * [`ChannelMonitor`] copies, you should still make an attempt to store the update where - * possible to ensure you can claim HTLC outputs on the latest commitment transaction - * broadcasted later. - * - * In case of distributed watchtowers deployment, the new version must be written to disk, as - * state may have been stored but rejected due to a block forcing a commitment broadcast. This - * storage is used to claim outputs of rejected state confirmed onchain by another watchtower, - * lagging behind on block processing. - * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Indicates that an update has failed and will not complete at any point in the future. + * + * Currently returning this variant will cause LDK to immediately panic to encourage immediate + * shutdown. In the future this may be updated to disconnect peers and refuse to continue + * normal operation without a panic. + * + * Applications which wish to perform an orderly shutdown after failure should consider + * returning [`InProgress`] instead and simply shut down without ever marking the update + * complete. + * + * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress */ - LDKChannelMonitorUpdateStatus_PermanentFailure, + LDKChannelMonitorUpdateStatus_UnrecoverableError, /** * Must be last for serialization purposes */ @@ -326,28 +341,92 @@ typedef enum LDKChannelShutdownState { */ typedef enum LDKConfirmationTarget { /** - * We'd like a transaction to confirm in the future, but don't want to commit most of the fees - * required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee - * bump of the transaction. + * We have some funds available on chain which we need to spend prior to some expiry time at + * which point our counterparty may be able to steal them. Generally we have in the high tens + * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a + * fee - this should be a relatively high priority feerate. + */ + LDKConfirmationTarget_OnChainSweep, + /** + * This is the lowest feerate we will allow our channel counterparty to have in an anchor + * channel in order to close the channel if a channel party goes away. * - * The feerate returned should be the absolute minimum feerate required to enter most node - * mempools across the network. Note that if you are not able to obtain this feerate estimate, - * you should likely use the furthest-out estimate allowed by your fee estimator. + * This needs to be sufficient to get into the mempool when the channel needs to + * be force-closed. Setting too high may result in force-closures if our counterparty attempts + * to use a lower feerate. Because this is for anchor channels, we can always bump the feerate + * later; the feerate here only needs to be sufficient to enter the mempool. + * + * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this + * is not an estimate which is very easy to calculate because we do not know the future. Using + * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to + * ensure you can always close the channel. A future change to Bitcoin's P2P network + * (package relay) may obviate the need for this entirely. */ - LDKConfirmationTarget_MempoolMinimum, + LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee, /** - * We are happy with a transaction confirming slowly, at least within a day or so worth of - * blocks. + * The lowest feerate we will allow our channel counterparty to have in a non-anchor channel. + * + * This is the feerate on the transaction which we (or our counterparty) will broadcast in + * order to close the channel if a channel party goes away. Setting this value too high will + * cause immediate force-closures in order to avoid having an unbroadcastable state. + * + * This feerate represents the fee we pick now, which must be sufficient to enter a block at an + * arbitrary time in the future. Obviously this is not an estimate which is very easy to + * calculate. This can leave channels subject to being unable to close if feerates rise, and in + * general you should prefer anchor channels to ensure you can increase the feerate when the + * transactions need broadcasting. + * + * Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw), + * causing occasional issues with feerate disagreements between an initiator that wants a + * feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee + * estimator rounds subtracting 250 to your desired feerate here can help avoid this issue. + * + * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure */ - LDKConfirmationTarget_Background, + LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee, /** - * We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks. + * This is the feerate on the transaction which we (or our counterparty) will broadcast in + * order to close the channel if a channel party goes away. + * + * This needs to be sufficient to get into the mempool when the channel needs to + * be force-closed. Setting too low may result in force-closures. Because this is for anchor + * channels, it can be a low value as we can always bump the feerate later. + * + * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this + * is not an estimate which is very easy to calculate because we do not know the future. Using + * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to + * ensure you can always close the channel. A future change to Bitcoin's P2P network + * (package relay) may obviate the need for this entirely. */ - LDKConfirmationTarget_Normal, + LDKConfirmationTarget_AnchorChannelFee, /** - * We'd like a transaction to confirm in the next few blocks. + * Lightning is built around the ability to broadcast a transaction in the future to close our + * channel and claim all pending funds. In order to do so, non-anchor channels are built with + * transactions which we need to be able to broadcast at some point in the future. + * + * This feerate represents the fee we pick now, which must be sufficient to enter a block at an + * arbitrary time in the future. Obviously this is not an estimate which is very easy to + * calculate, so most lightning nodes use some relatively high-priority feerate using the + * current mempool. This leaves channels subject to being unable to close if feerates rise, and + * in general you should prefer anchor channels to ensure you can increase the feerate when the + * transactions need broadcasting. + * + * Since this should represent the feerate of a channel close that does not need fee + * bumping, this is also used as an upper bound for our attempted feerate when doing cooperative + * closure of any channel. */ - LDKConfirmationTarget_HighPriority, + LDKConfirmationTarget_NonAnchorChannelFee, + /** + * When cooperatively closing a channel, this is the minimum feerate we will accept. + * Recommended at least within a day or so worth of blocks. + * + * This will also be used when initiating a cooperative close of a channel. When closing a + * channel you can override this fee by using + * [`ChannelManager::close_channel_with_feerate_and_script`]. + * + * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script + */ + LDKConfirmationTarget_ChannelCloseMinimum, /** * Must be last for serialization purposes */ @@ -423,36 +502,6 @@ typedef enum LDKCurrency { LDKCurrency_Sentinel, } LDKCurrency; -/** - * This enum is used to specify which error data to send to peers when failing back an HTLC - * using [`ChannelManager::fail_htlc_backwards_with_reason`]. - * - * For more info on failure codes, see . - */ -typedef enum LDKFailureCode { - /** - * We had a temporary error processing the payment. Useful if no other error codes fit - * and you want to indicate that the payer may want to retry. - */ - LDKFailureCode_TemporaryNodeFailure, - /** - * We have a required feature which was not in this onion. For example, you may require - * some additional metadata that was not provided with this payment. - */ - LDKFailureCode_RequiredNodeFeatureMissing, - /** - * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of - * the HTLC is too close to the current block height for safe handling. - * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is - * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. - */ - LDKFailureCode_IncorrectOrUnknownPaymentDetails, - /** - * Must be last for serialization purposes - */ - LDKFailureCode_Sentinel, -} LDKFailureCode; - /** * Describes the type of HTLC claim as determined by analyzing the witness. */ @@ -755,6 +804,32 @@ typedef enum LDKSiPrefix { LDKSiPrefix_Sentinel, } LDKSiPrefix; +/** + * [`SocketAddress`] error variants + */ +typedef enum LDKSocketAddressParseError { + /** + * Socket address (IPv4/IPv6) parsing error + */ + LDKSocketAddressParseError_SocketAddrParse, + /** + * Invalid input format + */ + LDKSocketAddressParseError_InvalidInput, + /** + * Invalid port + */ + LDKSocketAddressParseError_InvalidPort, + /** + * Invalid onion v3 address + */ + LDKSocketAddressParseError_InvalidOnionV3, + /** + * Must be last for serialization purposes + */ + LDKSocketAddressParseError_Sentinel, +} LDKSocketAddressParseError; + /** * An error when accessing the chain via [`UtxoLookup`]. */ @@ -815,6 +890,52 @@ typedef struct LDKU128 { uint8_t le_bytes[16]; } LDKU128; +/** + * Integer in the range `0..=16` + */ +typedef struct LDKWitnessVersion { + uint8_t _0; +} LDKWitnessVersion; + +/** + * A dynamically-allocated array of u8s of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_u8Z { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + uint8_t *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_u8Z; + +/** + * A segregated witness version byte and script bytes + */ +typedef struct LDKWitnessProgram { + struct LDKWitnessVersion version; + struct LDKCVec_u8Z program; +} LDKWitnessProgram; + +/** + * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not + * own the memory pointed to by data. + */ +typedef struct LDKu8slice { + /** + * A pointer to the byte buffer + */ + const uint8_t *data; + /** + * The number of bytes pointed to by `data`. + */ + uintptr_t datalen; +} LDKu8slice; + /** * Represents a scalar value between zero and the secp256k1 curve order, in big endian. */ @@ -938,22 +1059,6 @@ typedef struct LDKWitness { bool data_is_owned; } LDKWitness; -/** - * A dynamically-allocated array of u8s of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_u8Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - uint8_t *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_u8Z; - /** * An input to a transaction. * @@ -1002,29 +1107,29 @@ typedef struct LDKTxOut { /** * An enum which can either contain a u64 or not */ -typedef enum LDKCOption_DurationZ_Tag { +typedef enum LDKCOption_u64Z_Tag { /** - * When we're in this state, this COption_DurationZ contains a u64 + * When we're in this state, this COption_u64Z contains a u64 */ - LDKCOption_DurationZ_Some, + LDKCOption_u64Z_Some, /** - * When we're in this state, this COption_DurationZ contains nothing + * When we're in this state, this COption_u64Z contains nothing */ - LDKCOption_DurationZ_None, + LDKCOption_u64Z_None, /** * Must be last for serialization purposes */ - LDKCOption_DurationZ_Sentinel, -} LDKCOption_DurationZ_Tag; + LDKCOption_u64Z_Sentinel, +} LDKCOption_u64Z_Tag; -typedef struct LDKCOption_DurationZ { - LDKCOption_DurationZ_Tag tag; +typedef struct LDKCOption_u64Z { + LDKCOption_u64Z_Tag tag; union { struct { uint64_t some; }; }; -} LDKCOption_DurationZ; +} LDKCOption_u64Z; @@ -1063,33 +1168,6 @@ typedef struct LDKCVec_BlindedPathZ { uintptr_t datalen; } LDKCVec_BlindedPathZ; -/** - * An enum which can either contain a u64 or not - */ -typedef enum LDKCOption_u64Z_Tag { - /** - * When we're in this state, this COption_u64Z contains a u64 - */ - LDKCOption_u64Z_Some, - /** - * When we're in this state, this COption_u64Z contains nothing - */ - LDKCOption_u64Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u64Z_Sentinel, -} LDKCOption_u64Z_Tag; - -typedef struct LDKCOption_u64Z { - LDKCOption_u64Z_Tag tag; - union { - struct { - uint64_t some; - }; - }; -} LDKCOption_u64Z; - /** @@ -1170,6 +1248,129 @@ typedef struct LDKCResult_RefundBolt12ParseErrorZ { bool result_ok; } LDKCResult_RefundBolt12ParseErrorZ; +/** + * Strategies available to retry payment path failures. + */ +typedef enum LDKRetry_Tag { + /** + * Max number of attempts to retry payment. + * + * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a + * retry, and may retry multiple failed HTLCs at once if they failed around the same time and + * were retried along a route from a single call to [`Router::find_route_with_id`]. + */ + LDKRetry_Attempts, + /** + * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; + * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKRetry_Timeout, + /** + * Must be last for serialization purposes + */ + LDKRetry_Sentinel, +} LDKRetry_Tag; + +typedef struct MUST_USE_STRUCT LDKRetry { + LDKRetry_Tag tag; + union { + struct { + uint32_t attempts; + }; + struct { + uint64_t timeout; + }; + }; +} LDKRetry; + +/** + * An error in decoding a message or struct. + */ +typedef enum LDKDecodeError_Tag { + /** + * A version byte specified something we don't know how to handle. + * + * Includes unknown realm byte in an onion hop data packet. + */ + LDKDecodeError_UnknownVersion, + /** + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) + */ + LDKDecodeError_UnknownRequiredFeature, + /** + * Value was invalid. + * + * For example, a byte which was supposed to be a bool was something other than a 0 + * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was + * syntactically incorrect, etc. + */ + LDKDecodeError_InvalidValue, + /** + * The buffer to be read was too short. + */ + LDKDecodeError_ShortRead, + /** + * A length descriptor in the packet didn't describe the later data correctly. + */ + LDKDecodeError_BadLengthDescriptor, + /** + * Error from [`std::io`]. + */ + LDKDecodeError_Io, + /** + * The message included zlib-compressed values, which we don't support. + */ + LDKDecodeError_UnsupportedCompression, + /** + * Must be last for serialization purposes + */ + LDKDecodeError_Sentinel, +} LDKDecodeError_Tag; + +typedef struct MUST_USE_STRUCT LDKDecodeError { + LDKDecodeError_Tag tag; + union { + struct { + enum LDKIOError io; + }; + }; +} LDKDecodeError; + +/** + * The contents of CResult_RetryDecodeErrorZ + */ +typedef union LDKCResult_RetryDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRetry *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_RetryDecodeErrorZPtr; + +/** + * A CResult_RetryDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::Retry 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_RetryDecodeErrorZ { + /** + * The contents of this CResult_RetryDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RetryDecodeErrorZPtr contents; + /** + * Whether this CResult_RetryDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RetryDecodeErrorZ; + /** @@ -1364,29 +1565,29 @@ typedef struct LDKCVec_APIErrorZ { /** * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not */ -typedef enum LDKCOption_PaymentSecretZ_Tag { +typedef enum LDKCOption_ThirtyTwoBytesZ_Tag { /** - * When we're in this state, this COption_PaymentSecretZ contains a crate::c_types::ThirtyTwoBytes + * When we're in this state, this COption_ThirtyTwoBytesZ contains a crate::c_types::ThirtyTwoBytes */ - LDKCOption_PaymentSecretZ_Some, + LDKCOption_ThirtyTwoBytesZ_Some, /** - * When we're in this state, this COption_PaymentSecretZ contains nothing + * When we're in this state, this COption_ThirtyTwoBytesZ contains nothing */ - LDKCOption_PaymentSecretZ_None, + LDKCOption_ThirtyTwoBytesZ_None, /** * Must be last for serialization purposes */ - LDKCOption_PaymentSecretZ_Sentinel, -} LDKCOption_PaymentSecretZ_Tag; + LDKCOption_ThirtyTwoBytesZ_Sentinel, +} LDKCOption_ThirtyTwoBytesZ_Tag; -typedef struct LDKCOption_PaymentSecretZ { - LDKCOption_PaymentSecretZ_Tag tag; +typedef struct LDKCOption_ThirtyTwoBytesZ { + LDKCOption_ThirtyTwoBytesZ_Tag tag; union { struct { struct LDKThirtyTwoBytes some; }; }; -} LDKCOption_PaymentSecretZ; +} LDKCOption_ThirtyTwoBytesZ; /** * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not @@ -1439,90 +1640,174 @@ typedef struct MUST_USE_STRUCT LDKRecipientOnionFields { } LDKRecipientOnionFields; /** - * An error in decoding a message or struct. + * The contents of CResult_RecipientOnionFieldsDecodeErrorZ */ -typedef enum LDKDecodeError_Tag { +typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr { /** - * A version byte specified something we don't know how to handle. - * - * Includes unknown realm byte in an onion hop data packet. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKDecodeError_UnknownVersion, + struct LDKRecipientOnionFields *result; /** - * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKDecodeError_UnknownRequiredFeature, + struct LDKDecodeError *err; +} LDKCResult_RecipientOnionFieldsDecodeErrorZPtr; + +/** + * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields 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_RecipientOnionFieldsDecodeErrorZ { /** - * Value was invalid. - * - * For example, a byte which was supposed to be a bool was something other than a 0 - * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was - * syntactically incorrect, etc. + * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKDecodeError_InvalidValue, + union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents; /** - * The buffer to be read was too short. + * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state. */ - LDKDecodeError_ShortRead, + bool result_ok; +} LDKCResult_RecipientOnionFieldsDecodeErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64CVec_u8ZZ { /** - * A length descriptor in the packet didn't describe the later data correctly. + * The element at position 0 */ - LDKDecodeError_BadLengthDescriptor, + uint64_t a; /** - * Error from [`std::io`]. + * The element at position 1 */ - LDKDecodeError_Io, + struct LDKCVec_u8Z b; +} LDKC2Tuple_u64CVec_u8ZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64CVec_u8ZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_u64CVec_u8ZZZ { /** - * The message included zlib-compressed values, which we don't support. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKDecodeError_UnsupportedCompression, + struct LDKC2Tuple_u64CVec_u8ZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_u64CVec_u8ZZZ; + +/** + * The contents of CResult_RecipientOnionFieldsNoneZ + */ +typedef union LDKCResult_RecipientOnionFieldsNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRecipientOnionFields *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_RecipientOnionFieldsNoneZPtr; + +/** + * A CResult_RecipientOnionFieldsNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RecipientOnionFieldsNoneZ { + /** + * The contents of this CResult_RecipientOnionFieldsNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RecipientOnionFieldsNoneZPtr contents; + /** + * Whether this CResult_RecipientOnionFieldsNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_RecipientOnionFieldsNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ThirtyTwoBytesZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ThirtyTwoBytesZ; + +/** + * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not + */ +typedef enum LDKCOption_CVec_ThirtyTwoBytesZZ_Tag { + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_Some, + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_None, /** * Must be last for serialization purposes */ - LDKDecodeError_Sentinel, -} LDKDecodeError_Tag; + LDKCOption_CVec_ThirtyTwoBytesZZ_Sentinel, +} LDKCOption_CVec_ThirtyTwoBytesZZ_Tag; -typedef struct MUST_USE_STRUCT LDKDecodeError { - LDKDecodeError_Tag tag; +typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { + LDKCOption_CVec_ThirtyTwoBytesZZ_Tag tag; union { struct { - enum LDKIOError io; + struct LDKCVec_ThirtyTwoBytesZ some; }; }; -} LDKDecodeError; +} LDKCOption_CVec_ThirtyTwoBytesZZ; /** - * The contents of CResult_RecipientOnionFieldsDecodeErrorZ + * The contents of CResult_ThirtyTwoBytesNoneZ */ -typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr { +typedef union LDKCResult_ThirtyTwoBytesNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRecipientOnionFields *result; + struct LDKThirtyTwoBytes *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_RecipientOnionFieldsDecodeErrorZPtr; + void *err; +} LDKCResult_ThirtyTwoBytesNoneZPtr; /** - * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ThirtyTwoBytesNoneZ 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_RecipientOnionFieldsDecodeErrorZ { +typedef struct LDKCResult_ThirtyTwoBytesNoneZ { /** - * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents; + union LDKCResult_ThirtyTwoBytesNoneZPtr contents; /** - * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state. + * Whether this CResult_ThirtyTwoBytesNoneZ represents a success state. */ bool result_ok; -} LDKCResult_RecipientOnionFieldsDecodeErrorZ; +} LDKCResult_ThirtyTwoBytesNoneZ; @@ -1756,8 +2041,8 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * To derive the delayed payment key which is used to sign this input, you must pass the * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided - * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be - * generated without the secret key using [`chan_utils::derive_public_key`] and only the + * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be + * generated without the secret key using [`DelayedPaymentKey::from_basepoint`] and only the * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. * * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is @@ -1765,7 +2050,7 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to * [`ChannelSigner::provide_channel_parameters`]) and the provided * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to - * [`chan_utils::derive_public_revocation_key`]. + * [`RevocationKey`]. * * The witness script which is hashed and included in the output `script_pubkey` may be * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived @@ -1775,15 +2060,23 @@ typedef enum LDKSpendableOutputDescriptor_Tag { */ LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** - * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key - * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness - * in the spending input is, thus, simply: + * An output spendable exclusively by our payment key (i.e., the private key that corresponds + * to the `payment_point` in [`ChannelSigner::pubkeys`]). The output type depends on the + * channel type negotiated. + * + * On an anchor outputs channel, the witness in the spending input is: + * ```bitcoin + * + * ``` + * + * Otherwise, it is: * ```bitcoin * * ``` * * These are generally the result of our counterparty having broadcast the current state, - * allowing us to claim the non-HTLC-encumbered outputs immediately. + * allowing us to claim the non-HTLC-encumbered outputs immediately, or after one confirmation + * in the case of anchor outputs channels. */ LDKSpendableOutputDescriptor_StaticPaymentOutput, /** @@ -1801,6 +2094,19 @@ typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { * The output which is referenced by the given outpoint. */ struct LDKTxOut output; + /** + * The `channel_keys_id` for the channel which this output came from. + * + * For channels which were generated on LDK 0.0.119 or later, this is the value which was + * passed to the [`SignerProvider::get_destination_script`] call which provided this + * output script. + * + * For channels which were generated prior to LDK 0.0.119, no such argument existed, + * however this field may still be filled in if such data is available. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes channel_keys_id; } LDKSpendableOutputDescriptor_LDKStaticOutput_Body; typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { @@ -1884,34 +2190,34 @@ typedef struct LDKCVec_TxOutZ { /** * An enum which can either contain a u32 or not */ -typedef enum LDKCOption_PackedLockTimeZ_Tag { +typedef enum LDKCOption_u32Z_Tag { /** - * When we're in this state, this COption_PackedLockTimeZ contains a u32 + * When we're in this state, this COption_u32Z contains a u32 */ - LDKCOption_PackedLockTimeZ_Some, + LDKCOption_u32Z_Some, /** - * When we're in this state, this COption_PackedLockTimeZ contains nothing + * When we're in this state, this COption_u32Z contains nothing */ - LDKCOption_PackedLockTimeZ_None, + LDKCOption_u32Z_None, /** * Must be last for serialization purposes */ - LDKCOption_PackedLockTimeZ_Sentinel, -} LDKCOption_PackedLockTimeZ_Tag; + LDKCOption_u32Z_Sentinel, +} LDKCOption_u32Z_Tag; -typedef struct LDKCOption_PackedLockTimeZ { - LDKCOption_PackedLockTimeZ_Tag tag; +typedef struct LDKCOption_u32Z { + LDKCOption_u32Z_Tag tag; union { struct { uint32_t some; }; }; -} LDKCOption_PackedLockTimeZ; +} LDKCOption_u32Z; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PartiallySignedTransactionusizeZ { +typedef struct LDKC2Tuple_CVec_u8Zu64Z { /** * The element at position 0 */ @@ -1919,191 +2225,177 @@ typedef struct LDKC2Tuple_PartiallySignedTransactionusizeZ { /** * The element at position 1 */ - uintptr_t b; -} LDKC2Tuple_PartiallySignedTransactionusizeZ; + uint64_t b; +} LDKC2Tuple_CVec_u8Zu64Z; /** - * The contents of CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ + * The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ */ -typedef union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr { +typedef union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PartiallySignedTransactionusizeZ *result; + struct LDKC2Tuple_CVec_u8Zu64Z *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr; +} LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr; /** - * A CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PartiallySignedTransactionusizeZ on success and a () on failure. + * A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ { +typedef struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ { /** - * The contents of this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ, accessible via either + * The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZPtr contents; + union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr contents; /** - * Whether this CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ represents a success state. + * Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ; +} LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ; + + /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ + * The parameters required to derive a channel signer via [`SignerProvider`]. */ -typedef struct LDKCVec_PaymentPreimageZ { +typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes *data; + LDKnativeChannelDerivationParameters *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_PaymentPreimageZ; + bool is_owned; +} LDKChannelDerivationParameters; /** - * The contents of CResult_NoneNoneZ + * The contents of CResult_ChannelDerivationParametersDecodeErrorZ */ -typedef union LDKCResult_NoneNoneZPtr { +typedef union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr { /** - * 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 LDKChannelDerivationParameters *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_NoneNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelDerivationParametersDecodeErrorZPtr; /** - * A CResult_NoneNoneZ represents the result of a fallible operation, - * containing a () on success and a () on failure. + * A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::sign::ChannelDerivationParameters 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_NoneNoneZ { +typedef struct LDKCResult_ChannelDerivationParametersDecodeErrorZ { /** - * The contents of this CResult_NoneNoneZ, accessible via either + * The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneNoneZPtr contents; + union LDKCResult_ChannelDerivationParametersDecodeErrorZPtr contents; /** - * Whether this CResult_NoneNoneZ represents a success state. + * Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneNoneZ; +} LDKCResult_ChannelDerivationParametersDecodeErrorZ; -/** - * Represents a secp256k1 signature serialized as two 32-byte numbers - */ -typedef struct LDKSignature { - /** - * The bytes of the signature in "compact" form - */ - uint8_t compact_form[64]; -} LDKSignature; -/** - * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_SignatureZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKSignature *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_SignatureZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A descriptor used to sign for a commitment transaction's HTLC output. */ -typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ { +typedef struct MUST_USE_STRUCT LDKHTLCDescriptor { /** - * The element at position 0 + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKSignature a; + LDKnativeHTLCDescriptor *inner; /** - * The element at position 1 + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKCVec_SignatureZ b; -} LDKC2Tuple_SignatureCVec_SignatureZZ; + bool is_owned; +} LDKHTLCDescriptor; /** - * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ + * The contents of CResult_HTLCDescriptorDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +typedef union LDKCResult_HTLCDescriptorDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_SignatureCVec_SignatureZZ *result; + struct LDKHTLCDescriptor *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_HTLCDescriptorDecodeErrorZPtr; /** - * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure. + * A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::sign::HTLCDescriptor 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_SignatureCVec_SignatureZZNoneZ { +typedef struct LDKCResult_HTLCDescriptorDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either + * The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents; + union LDKCResult_HTLCDescriptorDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state. + * Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; +} LDKCResult_HTLCDescriptorDecodeErrorZ; /** - * The contents of CResult_SignatureNoneZ + * The contents of CResult_NoneNoneZ */ -typedef union LDKCResult_SignatureNoneZPtr { +typedef union LDKCResult_NoneNoneZPtr { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKSignature *result; + void *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_SignatureNoneZPtr; +} LDKCResult_NoneNoneZPtr; /** - * A CResult_SignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Signature on success and a () on failure. + * 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_SignatureNoneZ { +typedef struct LDKCResult_NoneNoneZ { /** - * The contents of this CResult_SignatureNoneZ, accessible via either + * The contents of this CResult_NoneNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignatureNoneZPtr contents; + union LDKCResult_NoneNoneZPtr contents; /** - * Whether this CResult_SignatureNoneZ represents a success state. + * Whether this CResult_NoneNoneZ represents a success state. */ bool result_ok; -} LDKCResult_SignatureNoneZ; +} LDKCResult_NoneNoneZ; /** * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. @@ -2150,61 +2442,29 @@ typedef struct LDKCResult_PublicKeyNoneZ { /** * An enum which can either contain a crate::c_types::BigEndianScalar or not */ -typedef enum LDKCOption_ScalarZ_Tag { +typedef enum LDKCOption_BigEndianScalarZ_Tag { /** - * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar + * When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar */ - LDKCOption_ScalarZ_Some, + LDKCOption_BigEndianScalarZ_Some, /** - * When we're in this state, this COption_ScalarZ contains nothing + * When we're in this state, this COption_BigEndianScalarZ contains nothing */ - LDKCOption_ScalarZ_None, + LDKCOption_BigEndianScalarZ_None, /** * Must be last for serialization purposes */ - LDKCOption_ScalarZ_Sentinel, -} LDKCOption_ScalarZ_Tag; + LDKCOption_BigEndianScalarZ_Sentinel, +} LDKCOption_BigEndianScalarZ_Tag; -typedef struct LDKCOption_ScalarZ { - LDKCOption_ScalarZ_Tag tag; +typedef struct LDKCOption_BigEndianScalarZ { + LDKCOption_BigEndianScalarZ_Tag tag; union { struct { struct LDKBigEndianScalar some; }; }; -} LDKCOption_ScalarZ; - -/** - * The contents of CResult_SharedSecretNoneZ - */ -typedef union LDKCResult_SharedSecretNoneZPtr { - /** - * 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_SharedSecretNoneZPtr; - -/** - * A CResult_SharedSecretNoneZ 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_SharedSecretNoneZ { - /** - * The contents of this CResult_SharedSecretNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SharedSecretNoneZPtr contents; - /** - * Whether this CResult_SharedSecretNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_SharedSecretNoneZ; +} LDKCOption_BigEndianScalarZ; /** * Integer in the range `0..32` @@ -2273,6 +2533,152 @@ typedef struct LDKCResult_RecoverableSignatureNoneZ { bool result_ok; } LDKCResult_RecoverableSignatureNoneZ; +/** + * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers + */ +typedef struct LDKSchnorrSignature { + /** + * The bytes of the signature as two 32-byte numbers + */ + uint8_t compact_form[64]; +} LDKSchnorrSignature; + +/** + * The contents of CResult_SchnorrSignatureNoneZ + */ +typedef union LDKCResult_SchnorrSignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSchnorrSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_SchnorrSignatureNoneZPtr; + +/** + * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::SchnorrSignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SchnorrSignatureNoneZ { + /** + * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SchnorrSignatureNoneZPtr contents; + /** + * Whether this CResult_SchnorrSignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_SchnorrSignatureNoneZ; + +/** + * Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers + */ +typedef struct LDKECDSASignature { + /** + * The bytes of the signature in "compact" form + */ + uint8_t compact_form[64]; +} LDKECDSASignature; + +/** + * The contents of CResult_ECDSASignatureNoneZ + */ +typedef union LDKCResult_ECDSASignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKECDSASignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_ECDSASignatureNoneZPtr; + +/** + * A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ECDSASignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ECDSASignatureNoneZ { + /** + * The contents of this CResult_ECDSASignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ECDSASignatureNoneZPtr contents; + /** + * Whether this CResult_ECDSASignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_ECDSASignatureNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ECDSASignatureZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKECDSASignature *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ECDSASignatureZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + /** + * The element at position 0 + */ + struct LDKECDSASignature a; + /** + * The element at position 1 + */ + struct LDKCVec_ECDSASignatureZ b; +} LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; + +/** + * The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ + */ +typedef union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr; + +/** + * A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + /** + * The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; + /** @@ -2342,26 +2748,6 @@ typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { -/** - * A descriptor used to sign for a commitment transaction's HTLC output. - */ -typedef struct MUST_USE_STRUCT LDKHTLCDescriptor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeHTLCDescriptor *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; -} LDKHTLCDescriptor; - - - /** * This class tracks the per-transaction information needed to build a closing transaction and will * actually build it and sign. @@ -2485,14 +2871,21 @@ typedef struct LDKChannelSigner { * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * The preimages of outbound HTLCs that were fulfilled since the last commitment are provided. * A validating signer should ensure that an HTLC output is removed only when the matching * preimage is provided, or when the value to holder is restored. * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); + /** + * 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]); /** * Returns the holder's channel public keys and basepoints. */ @@ -2551,39 +2944,27 @@ typedef struct LDKEcdsaChannelSigner { * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. + * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment + * are provided. A validating signer should ensure that an outbound HTLC output is removed + * only when the matching preimage is provided and after the corresponding inbound HTLC has + * been removed for forwarded payments. * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); - /** - * 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]); + struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** - * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * Creates a signature for a holder's commitment transaction. * * This will be called * - with a non-revoked `commitment_tx`. * - with the latest `commitment_tx` when we initiate a force-close. - * - with the previous `commitment_tx`, just to get claiming HTLC - * signatures, if we are reacting to a [`ChannelMonitor`] - * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * that decided to broadcast before it had been updated to the latest `commitment_tx`. * * This may be called multiple times for the same transaction. * * An external signer implementation should check that the commitment has not been revoked. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** * Create a signature for the given input in a transaction spending an HTLC transaction output * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. @@ -2600,7 +2981,7 @@ typedef struct LDKEcdsaChannelSigner { * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** * Create a signature for the given input in a transaction spending a commitment transaction * HTLC output when our counterparty broadcasts an old state. @@ -2621,17 +3002,20 @@ typedef struct LDKEcdsaChannelSigner { * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script * (which is committed to in the BIP 143 signatures). */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Computes the signature for a commitment transaction's HTLC output used as an input within * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned - * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to - * sign HTLC transactions from channels supporting anchor outputs after all additional - * inputs/outputs have been added to the transaction. + * must be be computed using [`EcdsaSighashType::All`]. * - * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All + * Note that this may be called for HTLCs in the penultimate commitment transaction if a + * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * broadcasts it before receiving the update for the latest commitment transaction. + * + * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - struct LDKCResult_SignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment * transaction, either offered or received. @@ -2651,19 +3035,19 @@ typedef struct LDKEcdsaChannelSigner { * channel state keys, which are then included in the witness script and committed to in the * BIP 143 signature. */ - struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + struct LDKCResult_ECDSASignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** * Create a signature for a (proposed) closing transaction. * * 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, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** * Computes the signature for a commitment transaction's anchor output used as an * input within `anchor_tx`, which spends the commitment transaction, at index `input`. */ - struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); /** * Signs a channel announcement message with our funding key proving it comes from one of the * channel participants. @@ -2674,8 +3058,10 @@ typedef struct LDKEcdsaChannelSigner { * Note that if this fails or is rejected, the channel will not be publicly announced and * our counterparty may (though likely will not) close the channel on us for violating the * protocol. + * + * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message */ - struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** * Implementation of ChannelSigner for this object. */ @@ -2710,6 +3096,12 @@ typedef struct LDKWriteableEcdsaChannelSigner { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Called, if set, after this WriteableEcdsaChannelSigner has been cloned into a duplicate object. + * The new WriteableEcdsaChannelSigner is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR new_WriteableEcdsaChannelSigner); /** * 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. @@ -2735,7 +3127,7 @@ typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { /** * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning::sign::ecdsa::WriteableEcdsaChannelSigner 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_WriteableEcdsaChannelSignerDecodeErrorZ { @@ -2751,9 +3143,9 @@ typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ { } LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ; /** - * The contents of CResult_ScriptNoneZ + * The contents of CResult_CVec_u8ZNoneZ */ -typedef union LDKCResult_ScriptNoneZPtr { +typedef union LDKCResult_CVec_u8ZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -2763,24 +3155,24 @@ typedef union LDKCResult_ScriptNoneZPtr { * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_ScriptNoneZPtr; +} LDKCResult_CVec_u8ZNoneZPtr; /** - * A CResult_ScriptNoneZ represents the result of a fallible operation, + * A CResult_CVec_u8ZNoneZ represents the result of a fallible operation, * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ScriptNoneZ { +typedef struct LDKCResult_CVec_u8ZNoneZ { /** - * The contents of this CResult_ScriptNoneZ, accessible via either + * The contents of this CResult_CVec_u8ZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ScriptNoneZPtr contents; + union LDKCResult_CVec_u8ZNoneZPtr contents; /** - * Whether this CResult_ScriptNoneZ represents a success state. + * Whether this CResult_CVec_u8ZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_ScriptNoneZ; +} LDKCResult_CVec_u8ZNoneZ; /** * The contents of CResult_ShutdownScriptNoneZ @@ -2815,52 +3207,90 @@ typedef struct LDKCResult_ShutdownScriptNoneZ { } LDKCResult_ShutdownScriptNoneZ; /** - * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a u16 or not */ -typedef struct LDKCVec_CVec_u8ZZ { +typedef enum LDKCOption_u16Z_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * When we're in this state, this COption_u16Z contains a u16 */ - struct LDKCVec_u8Z *data; + LDKCOption_u16Z_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_u16Z contains nothing */ - uintptr_t datalen; -} LDKCVec_CVec_u8ZZ; + LDKCOption_u16Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u16Z_Sentinel, +} LDKCOption_u16Z_Tag; + +typedef struct LDKCOption_u16Z { + LDKCOption_u16Z_Tag tag; + union { + struct { + uint16_t some; + }; + }; +} LDKCOption_u16Z; + +/** + * An enum which can either contain a bool or not + */ +typedef enum LDKCOption_boolZ_Tag { + /** + * When we're in this state, this COption_boolZ contains a bool + */ + LDKCOption_boolZ_Some, + /** + * When we're in this state, this COption_boolZ contains nothing + */ + LDKCOption_boolZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_boolZ_Sentinel, +} LDKCOption_boolZ_Tag; + +typedef struct LDKCOption_boolZ { + LDKCOption_boolZ_Tag tag; + union { + struct { + bool some; + }; + }; +} LDKCOption_boolZ; /** - * The contents of CResult_CVec_CVec_u8ZZNoneZ + * The contents of CResult_WitnessNoneZ */ -typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { +typedef union LDKCResult_WitnessNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_CVec_u8ZZ *result; + struct LDKWitness *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_CVec_CVec_u8ZZNoneZPtr; +} LDKCResult_WitnessNoneZPtr; /** - * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. + * A CResult_WitnessNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Witness on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { +typedef struct LDKCResult_WitnessNoneZ { /** - * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either + * The contents of this CResult_WitnessNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; + union LDKCResult_WitnessNoneZPtr contents; /** - * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. + * Whether this CResult_WitnessNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_CVec_u8ZZNoneZ; +} LDKCResult_WitnessNoneZ; @@ -2919,93 +3349,215 @@ typedef struct LDKCResult_InMemorySignerDecodeErrorZ { } LDKCResult_InMemorySignerDecodeErrorZ; /** - * The contents of CResult_PartiallySignedTransactionNoneZ + * The contents of CResult_TransactionNoneZ */ -typedef union LDKCResult_PartiallySignedTransactionNoneZPtr { +typedef union LDKCResult_TransactionNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_u8Z *result; + struct LDKTransaction *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_PartiallySignedTransactionNoneZPtr; +} LDKCResult_TransactionNoneZPtr; /** - * A CResult_PartiallySignedTransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. + * A CResult_TransactionNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Transaction on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PartiallySignedTransactionNoneZ { +typedef struct LDKCResult_TransactionNoneZ { /** - * The contents of this CResult_PartiallySignedTransactionNoneZ, accessible via either + * The contents of this CResult_TransactionNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PartiallySignedTransactionNoneZPtr contents; + union LDKCResult_TransactionNoneZPtr contents; /** - * Whether this CResult_PartiallySignedTransactionNoneZ represents a success state. + * Whether this CResult_TransactionNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PartiallySignedTransactionNoneZ; +} LDKCResult_TransactionNoneZ; + + /** - * The contents of CResult_TransactionNoneZ + * A [`CandidateRouteHop::FirstHop`] entry. */ -typedef union LDKCResult_TransactionNoneZPtr { +typedef struct MUST_USE_STRUCT LDKFirstHopCandidate { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKTransaction *result; + LDKnativeFirstHopCandidate *inner; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Indicates that this is the only struct which contains the same pointer. + * Rust 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 *err; -} LDKCResult_TransactionNoneZPtr; + bool is_owned; +} LDKFirstHopCandidate; + + /** - * A CResult_TransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Transaction on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A [`CandidateRouteHop::PublicHop`] entry. */ -typedef struct LDKCResult_TransactionNoneZ { +typedef struct MUST_USE_STRUCT LDKPublicHopCandidate { /** - * The contents of this CResult_TransactionNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - union LDKCResult_TransactionNoneZPtr contents; + LDKnativePublicHopCandidate *inner; /** - * Whether this CResult_TransactionNoneZ represents a success state. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - bool result_ok; -} LDKCResult_TransactionNoneZ; + bool is_owned; +} LDKPublicHopCandidate; /** - * Represents the compressed public key of a node + * A [`CandidateRouteHop::PrivateHop`] entry. */ -typedef struct MUST_USE_STRUCT LDKNodeId { +typedef struct MUST_USE_STRUCT LDKPrivateHopCandidate { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeId *inner; + LDKnativePrivateHopCandidate *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNodeId; +} LDKPrivateHopCandidate; + + + +/** + * A [`CandidateRouteHop::Blinded`] entry. + */ +typedef struct MUST_USE_STRUCT LDKBlindedPathCandidate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedPathCandidate *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; +} LDKBlindedPathCandidate; + + + +/** + * A [`CandidateRouteHop::OneHopBlinded`] entry. + */ +typedef struct MUST_USE_STRUCT LDKOneHopBlindedPathCandidate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOneHopBlindedPathCandidate *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; +} LDKOneHopBlindedPathCandidate; + +/** + * A wrapper around the various hop representations. + * + * Can be used to examine the properties of a hop, + * potentially to decide whether to include it in a route. + */ +typedef enum LDKCandidateRouteHop_Tag { + /** + * A hop from the payer, where the outbound liquidity is known. + */ + LDKCandidateRouteHop_FirstHop, + /** + * A hop found in the [`ReadOnlyNetworkGraph`]. + */ + LDKCandidateRouteHop_PublicHop, + /** + * A private hop communicated by the payee, generally via a BOLT 11 invoice. + * + * Because BOLT 11 route hints can take multiple hops to get to the destination, this may not + * terminate at the payee. + */ + LDKCandidateRouteHop_PrivateHop, + /** + * A blinded path which starts with an introduction point and ultimately terminates with the + * payee. + * + * Because we don't know the payee's identity, [`CandidateRouteHop::target`] will return + * `None` in this state. + * + * Because blinded paths are \"all or nothing\", and we cannot use just one part of a blinded + * path, the full path is treated as a single [`CandidateRouteHop`]. + */ + LDKCandidateRouteHop_Blinded, + /** + * Similar to [`Self::Blinded`], but the path here only has one hop. + * + * While we treat this similarly to [`CandidateRouteHop::Blinded`] in many respects (e.g. + * returning `None` from [`CandidateRouteHop::target`]), in this case we do actually know the + * payee's identity - it's the introduction point! + * + * [`BlindedPayInfo`] provided for 1-hop blinded paths is ignored because it is meant to apply + * to the hops *between* the introduction node and the destination. + * + * This primarily exists to track that we need to included a blinded path at the end of our + * [`Route`], even though it doesn't actually add an additional hop in the payment. + */ + LDKCandidateRouteHop_OneHopBlinded, + /** + * Must be last for serialization purposes + */ + LDKCandidateRouteHop_Sentinel, +} LDKCandidateRouteHop_Tag; + +typedef struct MUST_USE_STRUCT LDKCandidateRouteHop { + LDKCandidateRouteHop_Tag tag; + union { + struct { + struct LDKFirstHopCandidate first_hop; + }; + struct { + struct LDKPublicHopCandidate public_hop; + }; + struct { + struct LDKPrivateHopCandidate private_hop; + }; + struct { + struct LDKBlindedPathCandidate blinded; + }; + struct { + struct LDKOneHopBlindedPathCandidate one_hop_blinded; + }; + }; +} LDKCandidateRouteHop; /** - * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`]. */ typedef struct MUST_USE_STRUCT LDKChannelUsage { /** @@ -3048,6 +3600,37 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters { bool is_owned; } LDKProbabilisticScoringFeeParameters; +/** + * An interface used to score payment channels for path finding. + * + * `ScoreLookUp` is used to determine the penalty for a given channel. + * + * Scoring is in terms of fees willing to be paid in order to avoid routing through a channel. + */ +typedef struct LDKScoreLookUp { + /** + * 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 that are also being considered for use in + * the same payment) is given by `capacity_msat`. It may be determined from various sources + * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near + * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. + * Thus, implementations should be overflow-safe. + */ + uint64_t (*channel_penalty_msat)(const void *this_arg, const struct LDKCandidateRouteHop *NONNULL_PTR candidate, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); + /** + * 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); +} LDKScoreLookUp; + /** @@ -3070,61 +3653,51 @@ typedef struct MUST_USE_STRUCT LDKPath { } LDKPath; /** - * 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. + * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt. */ -typedef struct LDKScore { +typedef struct LDKScoreUpdate { /** * 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 that are also being considered for use in - * the same payment) is given by `capacity_msat`. It may be determined from various sources - * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near - * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. - * Thus, implementations should be overflow-safe. - */ - uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); /** * Handles updating channel penalties after failing to route through a channel. */ - void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); + void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); /** * Handles updating channel penalties after successfully routing along a path. */ - void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); + void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); /** * Handles updating channel penalties after a probe over the given path failed. */ - void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); + void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); /** * Handles updating channel penalties after a probe over the given path succeeded. */ - void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); + void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); /** - * Serialize the object into a byte array + * Scorers may wish to reduce their certainty of channel liquidity information over time. + * Thus, this method is provided to allow scorers to observe the passage of time - the holder + * of this object should call this method regularly (generally via the + * `lightning-background-processor` crate). */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + void (*time_passed)(void *this_arg, uint64_t duration_since_epoch); /** * 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; +} LDKScoreUpdate; /** * 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`] + * Needed so that calls to [`ScoreLookUp::channel_penalty_msat`] in [`find_route`] can be made while + * having shared ownership of a scorer but without requiring internal locking in [`ScoreUpdate`] * 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. + * result in [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel. * * [`find_route`]: crate::routing::router::find_route */ @@ -3135,9 +3708,13 @@ typedef struct LDKLockableScore { */ void *this_arg; /** - * Returns the locked scorer. + * Returns read locked scorer. + */ + struct LDKScoreLookUp (*read_lock)(const void *this_arg); + /** + * Returns write locked scorer. */ - struct LDKScore (*lock)(const void *this_arg); + struct LDKScoreUpdate (*write_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. @@ -3200,9 +3777,9 @@ typedef struct LDKCOption_WriteableScoreZ { } LDKCOption_WriteableScoreZ; /** - * The contents of CResult_NoneErrorZ + * The contents of CResult_NoneIOErrorZ */ -typedef union LDKCResult_NoneErrorZPtr { +typedef union LDKCResult_NoneIOErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -3212,24 +3789,24 @@ typedef union LDKCResult_NoneErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKIOError *err; -} LDKCResult_NoneErrorZPtr; +} LDKCResult_NoneIOErrorZPtr; /** - * A CResult_NoneErrorZ represents the result of a fallible operation, + * A CResult_NoneIOErrorZ represents the result of a fallible operation, * containing a () on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneErrorZ { +typedef struct LDKCResult_NoneIOErrorZ { /** - * The contents of this CResult_NoneErrorZ, accessible via either + * The contents of this CResult_NoneIOErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneErrorZPtr contents; + union LDKCResult_NoneIOErrorZPtr contents; /** - * Whether this CResult_NoneErrorZ represents a success state. + * Whether this CResult_NoneIOErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneErrorZ; +} LDKCResult_NoneIOErrorZ; @@ -3341,6 +3918,168 @@ typedef struct LDKCResult_RouteLightningErrorZ { bool result_ok; } LDKCResult_RouteLightningErrorZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ { + /** + * The element at position 0 + */ + struct LDKBlindedPayInfo a; + /** + * The element at position 1 + */ + struct LDKBlindedPath b; +} LDKC2Tuple_BlindedPayInfoBlindedPathZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ; + +/** + * The contents of CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ + */ +typedef union LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr; + +/** + * A CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_BlindedPayInfoBlindedPathZZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ { + /** + * The contents of this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZPtr contents; + /** + * Whether this CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PublicKeyZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPublicKey *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PublicKeyZ; + + + +/** + * A path for sending an [`OnionMessage`]. + */ +typedef struct MUST_USE_STRUCT LDKOnionMessagePath { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOnionMessagePath *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; +} LDKOnionMessagePath; + +/** + * The contents of CResult_OnionMessagePathNoneZ + */ +typedef union LDKCResult_OnionMessagePathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionMessagePath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_OnionMessagePathNoneZPtr; + +/** + * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionMessagePathNoneZ { + /** + * The contents of this CResult_OnionMessagePathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionMessagePathNoneZPtr contents; + /** + * Whether this CResult_OnionMessagePathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionMessagePathNoneZ; + +/** + * The contents of CResult_CVec_BlindedPathZNoneZ + */ +typedef union LDKCResult_CVec_BlindedPathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_BlindedPathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_BlindedPathZNoneZPtr; + +/** + * A CResult_CVec_BlindedPathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedPathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedPathZNoneZ { + /** + * The contents of this CResult_CVec_BlindedPathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_BlindedPathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedPathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedPathZNoneZ; + /** @@ -3452,8 +4191,9 @@ typedef struct LDKCResult_RouteHopDecodeErrorZ { /** - * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified - * by outside observers and thus can be used to hide the identity of the recipient. + * An encrypted payload and node id corresponding to a hop in a payment or onion message path, to + * be encoded in the sender's onion packet. These hops cannot be identified by outside observers + * and thus can be used to hide the identity of the recipient. */ typedef struct MUST_USE_STRUCT LDKBlindedHop { /** @@ -3558,33 +4298,6 @@ typedef struct LDKCVec_RouteHopZ { uintptr_t datalen; } LDKCVec_RouteHopZ; -/** - * An enum which can either contain a u32 or not - */ -typedef enum LDKCOption_u32Z_Tag { - /** - * When we're in this state, this COption_u32Z contains a u32 - */ - LDKCOption_u32Z_Some, - /** - * When we're in this state, this COption_u32Z contains nothing - */ - LDKCOption_u32Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u32Z_Sentinel, -} LDKCOption_u32Z_Tag; - -typedef struct LDKCOption_u32Z { - LDKCOption_u32Z_Tag tag; - union { - struct { - uint32_t some; - }; - }; -} LDKCOption_u32Z; - /** * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. * This corresponds to std::vector in C++ @@ -3758,36 +4471,6 @@ typedef struct LDKCResult_PaymentParametersDecodeErrorZ { bool result_ok; } LDKCResult_PaymentParametersDecodeErrorZ; -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ { - /** - * The element at position 0 - */ - struct LDKBlindedPayInfo a; - /** - * The element at position 1 - */ - struct LDKBlindedPath b; -} LDKC2Tuple_BlindedPayInfoBlindedPathZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ; - /** @@ -3828,6 +4511,10 @@ typedef struct LDKCVec_RouteHintZ { /** * A channel descriptor for a hop along a payment path. + * + * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are + * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as + * fields not supported in BOLT 11 will be stripped. */ typedef struct MUST_USE_STRUCT LDKRouteHintHop { /** @@ -3926,26 +4613,10 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintHopDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PublicKeyZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKPublicKey *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; - /** - * [`Score`] implementation that uses a fixed penalty. + * [`ScoreLookUp`] implementation that uses a fixed penalty. */ typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { /** @@ -3995,6 +4666,26 @@ typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { bool result_ok; } LDKCResult_FixedPenaltyScorerDecodeErrorZ; + + +/** + * Represents the compressed public key of a node + */ +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. + */ + 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; +} LDKNodeId; + /** * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. * This corresponds to std::vector in C++ @@ -4053,14 +4744,14 @@ typedef struct LDKCOption_C2Tuple_u64u64ZZ { } LDKCOption_C2Tuple_u64u64ZZ; /** - * 8 u16s + * 32 u16s */ -typedef struct LDKEightU16s { +typedef struct LDKThirtyTwoU16s { /** - * The eight 16-bit integers + * The thirty-two 16-bit integers */ - uint16_t data[8]; -} LDKEightU16s; + uint16_t data[32]; +} LDKThirtyTwoU16s; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -4069,53 +4760,80 @@ typedef struct LDKC2Tuple_Z { /** * The element at position 0 */ - struct LDKEightU16s a; + struct LDKThirtyTwoU16s a; /** * The element at position 1 */ - struct LDKEightU16s b; + struct LDKThirtyTwoU16s b; } LDKC2Tuple_Z; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple__u168_u168Z { +typedef struct LDKC2Tuple__u1632_u1632Z { /** * The element at position 0 */ - struct LDKEightU16s a; + struct LDKThirtyTwoU16s a; /** * The element at position 1 */ - struct LDKEightU16s b; -} LDKC2Tuple__u168_u168Z; + struct LDKThirtyTwoU16s b; +} LDKC2Tuple__u1632_u1632Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not + */ +typedef enum LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Sentinel, +} LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag; + +typedef struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag tag; + union { + struct { + struct LDKC2Tuple__u1632_u1632Z some; + }; + }; +} LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; /** - * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not + * An enum which can either contain a f64 or not */ -typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag { +typedef enum LDKCOption_f64Z_Tag { /** - * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z + * When we're in this state, this COption_f64Z contains a f64 */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some, + LDKCOption_f64Z_Some, /** - * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing + * When we're in this state, this COption_f64Z contains nothing */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_None, + LDKCOption_f64Z_None, /** * Must be last for serialization purposes */ - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel, -} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag; + LDKCOption_f64Z_Sentinel, +} LDKCOption_f64Z_Tag; -typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ { - LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag; +typedef struct LDKCOption_f64Z { + LDKCOption_f64Z_Tag tag; union { struct { - struct LDKC2Tuple__u168_u168Z some; + double some; }; }; -} LDKCOption_C2Tuple_EightU16sEightU16sZZ; +} LDKCOption_f64Z; @@ -4139,7 +4857,7 @@ typedef struct MUST_USE_STRUCT LDKRecord { } LDKRecord; /** - * A trait encapsulating the operations required of a logger + * A trait encapsulating the operations required of a logger. */ typedef struct LDKLogger { /** @@ -4148,9 +4866,9 @@ typedef struct LDKLogger { */ void *this_arg; /** - * Logs the `Record` + * Logs the [`Record`]. */ - void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); + void (*log)(const void *this_arg, struct LDKRecord 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. @@ -4181,7 +4899,7 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { /** - * [`Score`] implementation using channel success probability distributions. + * [`ScoreLookUp`] implementation using channel success probability distributions. * * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel, * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC. @@ -4206,11 +4924,6 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { * formula, but using the history of a channel rather than our latest estimates for the liquidity * bounds. * - * # Note - * - * Mixing the `no-std` feature between serialization and deserialization results in undefined - * behavior. - * * [1]: https://arxiv.org/abs/2107.05322 * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat @@ -4297,61 +5010,70 @@ typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { } LDKCVec_C2Tuple_usizeTransactionZZ; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef enum LDKCOption_BlockHashZ_Tag { +typedef struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { /** - * When we're in this state, this COption_BlockHashZ contains a crate::c_types::ThirtyTwoBytes + * The element at position 0 */ - LDKCOption_BlockHashZ_Some, + struct LDKThirtyTwoBytes a; /** - * When we're in this state, this COption_BlockHashZ contains nothing + * The element at position 1 */ - LDKCOption_BlockHashZ_None, + uint32_t b; /** - * Must be last for serialization purposes + * The element at position 2 */ - LDKCOption_BlockHashZ_Sentinel, -} LDKCOption_BlockHashZ_Tag; + struct LDKCOption_ThirtyTwoBytesZ c; +} LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ; -typedef struct LDKCOption_BlockHashZ { - LDKCOption_BlockHashZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_BlockHashZ; +/** + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_ChannelMonitorUpdateStatusNoneZ */ -typedef struct LDKC2Tuple_TxidCOption_BlockHashZZ { +typedef union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr { /** - * The element at position 0 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes a; + enum LDKChannelMonitorUpdateStatus *result; /** - * The element at position 1 + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKCOption_BlockHashZ b; -} LDKC2Tuple_TxidCOption_BlockHashZZ; + void *err; +} LDKCResult_ChannelMonitorUpdateStatusNoneZPtr; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCOption_BlockHashZZs of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation, + * containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ { +typedef struct LDKCResult_ChannelMonitorUpdateStatusNoneZ { /** - * 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_ChannelMonitorUpdateStatusNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKC2Tuple_TxidCOption_BlockHashZZ *data; + union LDKCResult_ChannelMonitorUpdateStatusNoneZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ; + bool result_ok; +} LDKCResult_ChannelMonitorUpdateStatusNoneZ; @@ -4384,9 +5106,10 @@ typedef enum LDKMonitorEvent_Tag { */ LDKMonitorEvent_HTLCEvent, /** - * A monitor event that the Channel's commitment transaction was confirmed. + * Indicates we broadcasted the channel's latest commitment transaction and thus closed the + * channel. */ - LDKMonitorEvent_CommitmentTxConfirmed, + LDKMonitorEvent_HolderForceClosed, /** * Indicates a [`ChannelMonitor`] update has completed. See * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. @@ -4394,13 +5117,6 @@ typedef enum LDKMonitorEvent_Tag { * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ LDKMonitorEvent_Completed, - /** - * Indicates a [`ChannelMonitor`] update has failed. See - * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used. - * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure - */ - LDKMonitorEvent_UpdateFailed, /** * Must be last for serialization purposes */ @@ -4429,12 +5145,9 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent { struct LDKHTLCUpdate htlc_event; }; struct { - struct LDKOutPoint commitment_tx_confirmed; + struct LDKOutPoint holder_force_closed; }; LDKMonitorEvent_LDKCompleted_Body completed; - struct { - struct LDKOutPoint update_failed; - }; }; } LDKMonitorEvent; @@ -4868,22 +5581,6 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_ChannelTypeFeaturesDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChainHashZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKThirtyTwoBytes *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_ChainHashZ; - /** @@ -4950,9 +5647,9 @@ typedef struct LDKCResult_OfferBolt12ParseErrorZ { } LDKCResult_OfferBolt12ParseErrorZ; /** - * The contents of CResult_PublicKeyErrorZ + * The contents of CResult_PublicKeySecp256k1ErrorZ */ -typedef union LDKCResult_PublicKeyErrorZPtr { +typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -4963,24 +5660,24 @@ typedef union LDKCResult_PublicKeyErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKSecp256k1Error *err; -} LDKCResult_PublicKeyErrorZPtr; +} LDKCResult_PublicKeySecp256k1ErrorZPtr; /** - * A CResult_PublicKeyErrorZ represents the result of a fallible operation, + * A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation, * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PublicKeyErrorZ { +typedef struct LDKCResult_PublicKeySecp256k1ErrorZ { /** - * The contents of this CResult_PublicKeyErrorZ, accessible via either + * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PublicKeyErrorZPtr contents; + union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; /** - * Whether this CResult_PublicKeyErrorZ represents a success state. + * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PublicKeyErrorZ; +} LDKCResult_PublicKeySecp256k1ErrorZ; /** * The contents of CResult_NodeIdDecodeErrorZ @@ -5270,12 +5967,12 @@ typedef struct LDKUtxoLookup { 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. + * Returns an error if `chain_hash` is for a different chain or if such a transaction output is + * unknown. * * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); + struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*chain_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. @@ -5586,6 +6283,88 @@ typedef struct MUST_USE_STRUCT LDKFundingSigned { +/** + * An stfu (quiescence) message to be sent by or received from the stfu initiator. + */ +typedef struct MUST_USE_STRUCT LDKStfu { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeStfu *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; +} LDKStfu; + + + +/** + * A splice message to be sent by or received from the stfu initiator (splice initiator). + */ +typedef struct MUST_USE_STRUCT LDKSplice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSplice *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; +} LDKSplice; + + + +/** + * A splice_ack message to be received by or sent to the splice initiator. + * + */ +typedef struct MUST_USE_STRUCT LDKSpliceAck { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSpliceAck *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; +} LDKSpliceAck; + + + +/** + * A splice_locked message to be sent to or received from a peer. + * + */ +typedef struct MUST_USE_STRUCT LDKSpliceLocked { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSpliceLocked *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; +} LDKSpliceLocked; + + + /** * A tx_add_input message for adding an input during interactive transaction construction * @@ -5758,6 +6537,27 @@ typedef struct MUST_USE_STRUCT LDKTxAckRbf { +/** + * A tx_abort message which signals the cancellation of an in-progress transaction negotiation. + * + */ +typedef struct MUST_USE_STRUCT LDKTxAbort { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeTxAbort *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; +} LDKTxAbort; + + + /** * A [`channel_ready`] message to be sent to or received from a peer. * @@ -6208,6 +7008,22 @@ typedef enum LDKMessageSendEvent_Tag { * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ LDKMessageSendEvent_SendFundingSigned, + /** + * Used to indicate that a stfu message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendStfu, + /** + * Used to indicate that a splice message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSplice, + /** + * Used to indicate that a splice_ack message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSpliceAck, + /** + * Used to indicate that a splice_locked message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSpliceLocked, /** * Used to indicate that a tx_add_input message should be sent to the peer with the given node_id. */ @@ -6400,6 +7216,50 @@ typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { struct LDKFundingSigned msg; } LDKMessageSendEvent_LDKSendFundingSigned_Body; +typedef struct LDKMessageSendEvent_LDKSendStfu_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKStfu msg; +} LDKMessageSendEvent_LDKSendStfu_Body; + +typedef struct LDKMessageSendEvent_LDKSendSplice_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSplice msg; +} LDKMessageSendEvent_LDKSendSplice_Body; + +typedef struct LDKMessageSendEvent_LDKSendSpliceAck_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSpliceAck msg; +} LDKMessageSendEvent_LDKSendSpliceAck_Body; + +typedef struct LDKMessageSendEvent_LDKSendSpliceLocked_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSpliceLocked msg; +} LDKMessageSendEvent_LDKSendSpliceLocked_Body; + typedef struct LDKMessageSendEvent_LDKSendTxAddInput_Body { /** * The node_id of the node which should receive this message @@ -6496,7 +7356,7 @@ typedef struct LDKMessageSendEvent_LDKSendTxAbort_Body { /** * The message which should be sent. */ - struct LDKTxAddInput msg; + struct LDKTxAbort msg; } LDKMessageSendEvent_LDKSendTxAbort_Body; typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body { @@ -6693,6 +7553,10 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKSendOpenChannelV2_Body send_open_channel_v2; LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; + LDKMessageSendEvent_LDKSendStfu_Body send_stfu; + LDKMessageSendEvent_LDKSendSplice_Body send_splice; + LDKMessageSendEvent_LDKSendSpliceAck_Body send_splice_ack; + LDKMessageSendEvent_LDKSendSpliceLocked_Body send_splice_locked; LDKMessageSendEvent_LDKSendTxAddInput_Body send_tx_add_input; LDKMessageSendEvent_LDKSendTxAddOutput_Body send_tx_add_output; LDKMessageSendEvent_LDKSendTxRemoveInput_Body send_tx_remove_input; @@ -6947,40 +7811,40 @@ typedef struct MUST_USE_STRUCT LDKHostname { /** * An address which can be used to connect to a remote peer. */ -typedef enum LDKNetAddress_Tag { +typedef enum LDKSocketAddress_Tag { /** - * An IPv4 address/port on which the peer is listening. + * An IPv4 address and port on which the peer is listening. */ - LDKNetAddress_IPv4, + LDKSocketAddress_TcpIpV4, /** - * An IPv6 address/port on which the peer is listening. + * An IPv6 address and port on which the peer is listening. */ - LDKNetAddress_IPv6, + LDKSocketAddress_TcpIpV6, /** * 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, + LDKSocketAddress_OnionV2, /** * A new-style Tor onion address/port on which the peer is listening. * * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version, * wrap as base32 and append \".onion\". */ - LDKNetAddress_OnionV3, + LDKSocketAddress_OnionV3, /** * A hostname/port on which the peer is listening. */ - LDKNetAddress_Hostname, + LDKSocketAddress_Hostname, /** * Must be last for serialization purposes */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; + LDKSocketAddress_Sentinel, +} LDKSocketAddress_Tag; -typedef struct LDKNetAddress_LDKIPv4_Body { +typedef struct LDKSocketAddress_LDKTcpIpV4_Body { /** * The 4-byte IPv4 address */ @@ -6989,9 +7853,9 @@ typedef struct LDKNetAddress_LDKIPv4_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKIPv4_Body; +} LDKSocketAddress_LDKTcpIpV4_Body; -typedef struct LDKNetAddress_LDKIPv6_Body { +typedef struct LDKSocketAddress_LDKTcpIpV6_Body { /** * The 16-byte IPv6 address */ @@ -7000,9 +7864,9 @@ typedef struct LDKNetAddress_LDKIPv6_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKIPv6_Body; +} LDKSocketAddress_LDKTcpIpV6_Body; -typedef struct LDKNetAddress_LDKOnionV3_Body { +typedef struct LDKSocketAddress_LDKOnionV3_Body { /** * The ed25519 long-term public key of the peer */ @@ -7019,9 +7883,9 @@ typedef struct LDKNetAddress_LDKOnionV3_Body { * The port on which the node is listening */ uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; +} LDKSocketAddress_LDKOnionV3_Body; -typedef struct LDKNetAddress_LDKHostname_Body { +typedef struct LDKSocketAddress_LDKHostname_Body { /** * The hostname on which the node is listening. */ @@ -7030,36 +7894,36 @@ typedef struct LDKNetAddress_LDKHostname_Body { * The port on which the node is listening. */ uint16_t port; -} LDKNetAddress_LDKHostname_Body; +} LDKSocketAddress_LDKHostname_Body; -typedef struct MUST_USE_STRUCT LDKNetAddress { - LDKNetAddress_Tag tag; +typedef struct MUST_USE_STRUCT LDKSocketAddress { + LDKSocketAddress_Tag tag; union { - LDKNetAddress_LDKIPv4_Body i_pv4; - LDKNetAddress_LDKIPv6_Body i_pv6; + LDKSocketAddress_LDKTcpIpV4_Body tcp_ip_v4; + LDKSocketAddress_LDKTcpIpV6_Body tcp_ip_v6; struct { struct LDKTwelveBytes onion_v2; }; - LDKNetAddress_LDKOnionV3_Body onion_v3; - LDKNetAddress_LDKHostname_Body hostname; + LDKSocketAddress_LDKOnionV3_Body onion_v3; + LDKSocketAddress_LDKHostname_Body hostname; }; -} LDKNetAddress; +} LDKSocketAddress; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_NetAddressZ { +typedef struct LDKCVec_SocketAddressZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKNetAddress *data; + struct LDKSocketAddress *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_NetAddressZ; +} LDKCVec_SocketAddressZ; @@ -7257,58 +8121,105 @@ typedef struct LDKCResult_NetworkGraphDecodeErrorZ { } LDKCResult_NetworkGraphDecodeErrorZ; /** - * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not + * An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not */ -typedef enum LDKCOption_CVec_NetAddressZZ_Tag { +typedef enum LDKCOption_CVec_SocketAddressZZ_Tag { /** - * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ + * When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ */ - LDKCOption_CVec_NetAddressZZ_Some, + LDKCOption_CVec_SocketAddressZZ_Some, /** - * When we're in this state, this COption_CVec_NetAddressZZ contains nothing + * When we're in this state, this COption_CVec_SocketAddressZZ contains nothing */ - LDKCOption_CVec_NetAddressZZ_None, + LDKCOption_CVec_SocketAddressZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_CVec_NetAddressZZ_Sentinel, -} LDKCOption_CVec_NetAddressZZ_Tag; + LDKCOption_CVec_SocketAddressZZ_Sentinel, +} LDKCOption_CVec_SocketAddressZZ_Tag; -typedef struct LDKCOption_CVec_NetAddressZZ { - LDKCOption_CVec_NetAddressZZ_Tag tag; +typedef struct LDKCOption_CVec_SocketAddressZZ { + LDKCOption_CVec_SocketAddressZZ_Tag tag; union { struct { - struct LDKCVec_NetAddressZ some; + struct LDKCVec_SocketAddressZ some; }; }; -} LDKCOption_CVec_NetAddressZZ; +} LDKCOption_CVec_SocketAddressZZ; + + /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it + * should go next. */ -typedef enum LDKCOption_PaymentPreimageZ_Tag { +typedef struct MUST_USE_STRUCT LDKPendingHTLCInfo { /** - * When we're in this state, this COption_PaymentPreimageZ contains a crate::c_types::ThirtyTwoBytes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_PaymentPreimageZ_Some, + LDKnativePendingHTLCInfo *inner; /** - * When we're in this state, this COption_PaymentPreimageZ contains nothing + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKCOption_PaymentPreimageZ_None, + bool is_owned; +} LDKPendingHTLCInfo; + + + +/** + * Invalid inbound onion payment. + */ +typedef struct MUST_USE_STRUCT LDKInboundHTLCErr { /** - * Must be last for serialization purposes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_PaymentPreimageZ_Sentinel, -} LDKCOption_PaymentPreimageZ_Tag; + LDKnativeInboundHTLCErr *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; +} LDKInboundHTLCErr; -typedef struct LDKCOption_PaymentPreimageZ { - LDKCOption_PaymentPreimageZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentPreimageZ; +/** + * The contents of CResult_PendingHTLCInfoInboundHTLCErrZ + */ +typedef union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPendingHTLCInfo *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKInboundHTLCErr *err; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr; + +/** + * A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ { + /** + * The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr contents; + /** + * Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. + */ + bool result_ok; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZ; /** * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. @@ -7327,7 +8238,7 @@ typedef struct LDKCVec_HTLCOutputInCommitmentZ { } LDKCVec_HTLCOutputInCommitmentZ; /** - * A dynamically-allocated array of crate::lightning::events::bump_transaction::HTLCDescriptors of arbitrary size. + * A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_HTLCDescriptorZ { @@ -7530,31 +8441,45 @@ typedef struct LDKCResult_CVec_UtxoZNoneZ { } LDKCResult_CVec_UtxoZNoneZ; /** - * An enum which can either contain a u16 or not + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKCOption_u16Z_Tag { +typedef struct LDKC2Tuple_u64u16Z { /** - * When we're in this state, this COption_u16Z contains a u16 + * The element at position 0 */ - LDKCOption_u16Z_Some, + uint64_t a; /** - * When we're in this state, this COption_u16Z contains nothing + * The element at position 1 */ - LDKCOption_u16Z_None, + uint16_t b; +} LDKC2Tuple_u64u16Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not + */ +typedef enum LDKCOption_C2Tuple_u64u16ZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z + */ + LDKCOption_C2Tuple_u64u16ZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing + */ + LDKCOption_C2Tuple_u64u16ZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_u16Z_Sentinel, -} LDKCOption_u16Z_Tag; + LDKCOption_C2Tuple_u64u16ZZ_Sentinel, +} LDKCOption_C2Tuple_u64u16ZZ_Tag; -typedef struct LDKCOption_u16Z { - LDKCOption_u16Z_Tag tag; +typedef struct LDKCOption_C2Tuple_u64u16ZZ { + LDKCOption_C2Tuple_u64u16ZZ_Tag tag; union { struct { - uint16_t some; + struct LDKC2Tuple_u64u16Z some; }; }; -} LDKCOption_u16Z; +} LDKCOption_C2Tuple_u64u16ZZ; /** * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not @@ -7584,36 +8509,9 @@ typedef struct LDKCOption_ChannelShutdownStateZ { } LDKCOption_ChannelShutdownStateZ; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not - */ -typedef enum LDKCOption_PaymentHashZ_Tag { - /** - * When we're in this state, this COption_PaymentHashZ contains a crate::c_types::ThirtyTwoBytes - */ - LDKCOption_PaymentHashZ_Some, - /** - * When we're in this state, this COption_PaymentHashZ contains nothing - */ - LDKCOption_PaymentHashZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_PaymentHashZ_Sentinel, -} LDKCOption_PaymentHashZ_Tag; - -typedef struct LDKCOption_PaymentHashZ { - LDKCOption_PaymentHashZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentHashZ; - -/** - * The contents of CResult__u832APIErrorZ + * The contents of CResult_ThirtyTwoBytesAPIErrorZ */ -typedef union LDKCResult__u832APIErrorZPtr { +typedef union LDKCResult_ThirtyTwoBytesAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7624,30 +8522,34 @@ typedef union LDKCResult__u832APIErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; +} LDKCResult_ThirtyTwoBytesAPIErrorZPtr; /** - * A CResult__u832APIErrorZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesAPIErrorZ 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 { +typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ { /** - * The contents of this CResult__u832APIErrorZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult__u832APIErrorZPtr contents; + union LDKCResult_ThirtyTwoBytesAPIErrorZPtr contents; /** - * Whether this CResult__u832APIErrorZ represents a success state. + * Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult__u832APIErrorZ; +} LDKCResult_ThirtyTwoBytesAPIErrorZ; /** * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments. * These include payments that have yet to find a successful path, or have unresolved HTLCs. */ typedef enum LDKRecentPaymentDetails_Tag { + /** + * When an invoice was requested and thus a payment has not yet been sent. + */ + LDKRecentPaymentDetails_AwaitingInvoice, /** * When a payment is still being sent and awaiting successful delivery. */ @@ -7670,7 +8572,20 @@ typedef enum LDKRecentPaymentDetails_Tag { LDKRecentPaymentDetails_Sentinel, } LDKRecentPaymentDetails_Tag; +typedef struct LDKRecentPaymentDetails_LDKAwaitingInvoice_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; +} LDKRecentPaymentDetails_LDKAwaitingInvoice_Body; + typedef struct LDKRecentPaymentDetails_LDKPending_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that is currently being sent but has yet to be fulfilled or * abandoned. @@ -7684,14 +8599,24 @@ typedef struct LDKRecentPaymentDetails_LDKPending_Body { } LDKRecentPaymentDetails_LDKPending_Body; typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`] * made before LDK version 0.0.104. */ - struct LDKCOption_PaymentHashZ payment_hash; + struct LDKCOption_ThirtyTwoBytesZ payment_hash; } LDKRecentPaymentDetails_LDKFulfilled_Body; typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { + /** + * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify + * a payment and ensure idempotency in LDK. + */ + struct LDKThirtyTwoBytes payment_id; /** * Hash of the payment that we have given up trying to send. */ @@ -7701,6 +8626,7 @@ typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails { LDKRecentPaymentDetails_Tag tag; union { + LDKRecentPaymentDetails_LDKAwaitingInvoice_Body awaiting_invoice; LDKRecentPaymentDetails_LDKPending_Body pending; LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled; LDKRecentPaymentDetails_LDKAbandoned_Body abandoned; @@ -7899,9 +8825,9 @@ typedef struct LDKCResult_NoneRetryableSendFailureZ { } LDKCResult_NoneRetryableSendFailureZ; /** - * The contents of CResult_PaymentHashPaymentSendFailureZ + * The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ */ -typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { +typedef union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7912,29 +8838,29 @@ typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentHashPaymentSendFailureZPtr; +} LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr; /** - * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { +typedef struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ { /** - * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentHashPaymentSendFailureZPtr contents; + union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr contents; /** - * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. + * Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentHashPaymentSendFailureZ; +} LDKCResult_ThirtyTwoBytesPaymentSendFailureZ; /** - * The contents of CResult_PaymentHashRetryableSendFailureZ + * The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ */ -typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr { +typedef union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -7945,29 +8871,29 @@ typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKRetryableSendFailure *err; -} LDKCResult_PaymentHashRetryableSendFailureZPtr; +} LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr; /** - * A CResult_PaymentHashRetryableSendFailureZ represents the result of a fallible operation, + * A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation, * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentHashRetryableSendFailureZ { +typedef struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ { /** - * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentHashRetryableSendFailureZPtr contents; + union LDKCResult_ThirtyTwoBytesRetryableSendFailureZPtr contents; /** - * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state. + * Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentHashRetryableSendFailureZ; +} LDKCResult_ThirtyTwoBytesRetryableSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { /** * The element at position 0 */ @@ -7976,61 +8902,124 @@ typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { * The element at position 1 */ struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentIdZ; +} LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PaymentHashPaymentIdZ *result; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *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_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr; /** - * 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::outbound_payment::PaymentSendFailure on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_ThirtyTwoBytesZ { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes *data; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_ThirtyTwoBytesZ; +} LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; + +/** + * Indicates that we failed to send a payment probe. Further errors may be surfaced later via + * [`Event::ProbeFailed`]. + * + * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + */ +typedef enum LDKProbeSendFailure_Tag { + /** + * We were unable to find a route to the destination. + */ + LDKProbeSendFailure_RouteNotFound, + /** + * We failed to send the payment probes. + */ + LDKProbeSendFailure_SendingFailed, + /** + * Must be last for serialization purposes + */ + LDKProbeSendFailure_Sentinel, +} LDKProbeSendFailure_Tag; + +typedef struct MUST_USE_STRUCT LDKProbeSendFailure { + LDKProbeSendFailure_Tag tag; + union { + struct { + struct LDKPaymentSendFailure sending_failed; + }; + }; +} LDKProbeSendFailure; + +/** + * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ + */ +typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKProbeSendFailure *err; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr; + +/** + * A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + /** + * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr contents; + /** + * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ { /** * The element at position 0 */ @@ -8038,132 +9027,325 @@ typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { /** * The element at position 1 */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentSecretZ; + struct LDKPublicKey b; +} LDKC2Tuple_ThirtyTwoBytesPublicKeyZ; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_PaymentHashPaymentSecretZ *result; + struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *data; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * The number of elements pointed to by `data`. */ - void *err; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr; + uintptr_t datalen; +} LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ; /** - * 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. + * An enum which can either contain a crate::c_types::Str or not + */ +typedef enum LDKCOption_StrZ_Tag { + /** + * When we're in this state, this COption_StrZ contains a crate::c_types::Str + */ + LDKCOption_StrZ_Some, + /** + * When we're in this state, this COption_StrZ contains nothing + */ + LDKCOption_StrZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_StrZ_Sentinel, +} LDKCOption_StrZ_Tag; + +typedef struct LDKCOption_StrZ { + LDKCOption_StrZ_Tag tag; + union { + struct { + struct LDKStr some; + }; + }; +} LDKCOption_StrZ; + +/** + * The contents of CResult_NoneBolt12SemanticErrorZ + */ +typedef union LDKCResult_NoneBolt12SemanticErrorZPtr { + /** + * 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. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_NoneBolt12SemanticErrorZPtr; + +/** + * A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +typedef struct LDKCResult_NoneBolt12SemanticErrorZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either + * The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents; + union LDKCResult_NoneBolt12SemanticErrorZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. + * Whether this CResult_NoneBolt12SemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; +} LDKCResult_NoneBolt12SemanticErrorZ; /** - * The contents of CResult_PaymentSecretNoneZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ */ -typedef union LDKCResult_PaymentSecretNoneZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { /** * 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_ThirtyTwoBytesThirtyTwoBytesZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_PaymentSecretNoneZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr; /** - * A CResult_PaymentSecretNoneZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentSecretNoneZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { /** - * The contents of this CResult_PaymentSecretNoneZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentSecretNoneZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr contents; /** - * Whether this CResult_PaymentSecretNoneZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentSecretNoneZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; + + /** - * The contents of CResult_PaymentPreimageAPIErrorZ + * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. + * + * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request + * specifies these such that its recipient can send an invoice for payment. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Offer`]: crate::offers::offer::Offer */ -typedef union LDKCResult_PaymentPreimageAPIErrorZPtr { +typedef struct MUST_USE_STRUCT LDKInvoiceRequest { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes *result; + LDKnativeInvoiceRequest *inner; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKAPIError *err; -} LDKCResult_PaymentPreimageAPIErrorZPtr; + bool is_owned; +} LDKInvoiceRequest; + + /** - * 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`. + * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. + * + * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent + * directly after scanning a refund. It includes all the information needed to pay a recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -typedef struct LDKCResult_PaymentPreimageAPIErrorZ { +typedef struct MUST_USE_STRUCT LDKBolt12Invoice { /** - * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12Invoice *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. */ - union LDKCResult_PaymentPreimageAPIErrorZPtr contents; + bool is_owned; +} LDKBolt12Invoice; + + + +/** + * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +typedef struct MUST_USE_STRUCT LDKInvoiceError { /** - * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - bool result_ok; -} LDKCResult_PaymentPreimageAPIErrorZ; + LDKnativeInvoiceError *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; +} LDKInvoiceError; + +/** + * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`]. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef enum LDKOffersMessage_Tag { + /** + * A request for a [`Bolt12Invoice`] for a particular [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + */ + LDKOffersMessage_InvoiceRequest, + /** + * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund + */ + LDKOffersMessage_Invoice, + /** + * An error from handling an [`OffersMessage`]. + */ + LDKOffersMessage_InvoiceError, + /** + * Must be last for serialization purposes + */ + LDKOffersMessage_Sentinel, +} LDKOffersMessage_Tag; + +typedef struct MUST_USE_STRUCT LDKOffersMessage { + LDKOffersMessage_Tag tag; + union { + struct { + struct LDKInvoiceRequest invoice_request; + }; + struct { + struct LDKBolt12Invoice invoice; + }; + struct { + struct LDKInvoiceError invoice_error; + }; + }; +} LDKOffersMessage; /** - * An enum which can either contain a crate::c_types::derived::CVec_ChainHashZ or not + * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not */ -typedef enum LDKCOption_CVec_ChainHashZZ_Tag { +typedef enum LDKCOption_OffersMessageZ_Tag { /** - * When we're in this state, this COption_CVec_ChainHashZZ contains a crate::c_types::derived::CVec_ChainHashZ + * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage */ - LDKCOption_CVec_ChainHashZZ_Some, + LDKCOption_OffersMessageZ_Some, /** - * When we're in this state, this COption_CVec_ChainHashZZ contains nothing + * When we're in this state, this COption_OffersMessageZ contains nothing */ - LDKCOption_CVec_ChainHashZZ_None, + LDKCOption_OffersMessageZ_None, /** * Must be last for serialization purposes */ - LDKCOption_CVec_ChainHashZZ_Sentinel, -} LDKCOption_CVec_ChainHashZZ_Tag; + LDKCOption_OffersMessageZ_Sentinel, +} LDKCOption_OffersMessageZ_Tag; -typedef struct LDKCOption_CVec_ChainHashZZ { - LDKCOption_CVec_ChainHashZZ_Tag tag; +typedef struct LDKCOption_OffersMessageZ { + LDKCOption_OffersMessageZ_Tag tag; union { struct { - struct LDKCVec_ChainHashZ some; + struct LDKOffersMessage some; }; }; -} LDKCOption_CVec_ChainHashZZ; +} LDKCOption_OffersMessageZ; + +/** + * The destination of an onion message. + */ +typedef enum LDKDestination_Tag { + /** + * We're sending this onion message to a node. + */ + LDKDestination_Node, + /** + * We're sending this onion message to a blinded path. + */ + LDKDestination_BlindedPath, + /** + * Must be last for serialization purposes + */ + LDKDestination_Sentinel, +} LDKDestination_Tag; + +typedef struct MUST_USE_STRUCT LDKDestination { + LDKDestination_Tag tag; + union { + struct { + struct LDKPublicKey node; + }; + struct { + struct LDKBlindedPath blinded_path; + }; + }; +} LDKDestination; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ { + /** + * The element at position 0 + */ + struct LDKOffersMessage a; + /** + * The element at position 1 + */ + struct LDKDestination b; + /** + * The element at position 2 + */ + struct LDKBlindedPath c; +} LDKC3Tuple_OffersMessageDestinationBlindedPathZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ; @@ -8360,6 +9542,338 @@ typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ { bool result_ok; } LDKCResult_PhantomRouteHintsDecodeErrorZ; + + +/** + * Information used to forward or fail this HTLC that is being forwarded within a blinded path. + */ +typedef struct MUST_USE_STRUCT LDKBlindedForward { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedForward *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; +} LDKBlindedForward; + +/** + * The contents of CResult_BlindedForwardDecodeErrorZ + */ +typedef union LDKCResult_BlindedForwardDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedForward *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_BlindedForwardDecodeErrorZPtr; + +/** + * A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedForwardDecodeErrorZ { + /** + * The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedForwardDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedForwardDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedForwardDecodeErrorZ; + + + +/** + * BOLT 4 onion packet including hop data for the next peer. + */ +typedef struct MUST_USE_STRUCT LDKOnionPacket { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOnionPacket *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; +} LDKOnionPacket; + + + +/** + * Information communicated in the onion to the recipient for multi-part tracking and proof that + * the payment is associated with an invoice. + */ +typedef struct MUST_USE_STRUCT LDKFinalOnionHopData { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeFinalOnionHopData *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; +} LDKFinalOnionHopData; + +/** + * Information about where a received HTLC('s onion) has indicated the HTLC should go. + */ +typedef enum LDKPendingHTLCRouting_Tag { + /** + * An HTLC which should be forwarded on to another node. + */ + LDKPendingHTLCRouting_Forward, + /** + * The onion indicates that this is a payment for an invoice (supposedly) generated by us. + * + * Note that at this point, we have not checked that the invoice being paid was actually + * generated by us, but rather it's claiming to pay an invoice of ours. + */ + LDKPendingHTLCRouting_Receive, + /** + * The onion indicates that this is for payment to us but which contains the preimage for + * claiming included, and is unrelated to any invoice we'd previously generated (aka a + * \"keysend\" or \"spontaneous\" payment). + */ + LDKPendingHTLCRouting_ReceiveKeysend, + /** + * Must be last for serialization purposes + */ + LDKPendingHTLCRouting_Sentinel, +} LDKPendingHTLCRouting_Tag; + +typedef struct LDKPendingHTLCRouting_LDKForward_Body { + /** + * The onion which should be included in the forwarded HTLC, telling the next hop what to + * do with the HTLC. + */ + struct LDKOnionPacket onion_packet; + /** + * The short channel ID of the channel which we were instructed to forward this HTLC to. + * + * This could be a real on-chain SCID, an SCID alias, or some other SCID which has meaning + * to the receiving node, such as one returned from + * [`ChannelManager::get_intercept_scid`] or [`ChannelManager::get_phantom_scid`]. + */ + uint64_t short_channel_id; + /** + * Set if this HTLC is being forwarded within a blinded path. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedForward blinded; +} LDKPendingHTLCRouting_LDKForward_Body; + +typedef struct LDKPendingHTLCRouting_LDKReceive_Body { + /** + * Information about the amount the sender intended to pay and (potential) proof that this + * is a payment for an invoice we generated. This proof of payment is is also used for + * linking MPP parts of a larger payment. + */ + struct LDKFinalOnionHopData payment_data; + /** + * Additional data which we (allegedly) instructed the sender to include in the onion. + * + * For HTLCs received by LDK, this will ultimately be exposed in + * [`Event::PaymentClaimable::onion_fields`] as + * [`RecipientOnionFields::payment_metadata`]. + */ + struct LDKCOption_CVec_u8ZZ payment_metadata; + /** + * CLTV expiry of the received HTLC. + * + * Used to track when we should expire pending HTLCs that go unclaimed. + */ + uint32_t incoming_cltv_expiry; + /** + * If the onion had forwarding instructions to one of our phantom node SCIDs, this will + * provide the onion shared secret used to decrypt the next level of forwarding + * instructions. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes phantom_shared_secret; + /** + * Custom TLVs which were set by the sender. + * + * For HTLCs received by LDK, this will ultimately be exposed in + * [`Event::PaymentClaimable::onion_fields`] as + * [`RecipientOnionFields::custom_tlvs`]. + */ + struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs; + /** + * Set if this HTLC is the final hop in a multi-hop blinded path. + */ + bool requires_blinded_error; +} LDKPendingHTLCRouting_LDKReceive_Body; + +typedef struct LDKPendingHTLCRouting_LDKReceiveKeysend_Body { + /** + * Information about the amount the sender intended to pay and possibly a token to + * associate MPP parts of a larger payment. + * + * This will only be filled in if receiving MPP keysend payments is enabled, and it being + * present will cause deserialization to fail on versions of LDK prior to 0.0.116. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKFinalOnionHopData payment_data; + /** + * Preimage for this onion payment. This preimage is provided by the sender and will be + * used to settle the spontaneous payment. + */ + struct LDKThirtyTwoBytes payment_preimage; + /** + * Additional data which we (allegedly) instructed the sender to include in the onion. + * + * For HTLCs received by LDK, this will ultimately bubble back up as + * [`RecipientOnionFields::payment_metadata`]. + */ + struct LDKCOption_CVec_u8ZZ payment_metadata; + /** + * CLTV expiry of the received HTLC. + * + * Used to track when we should expire pending HTLCs that go unclaimed. + */ + uint32_t incoming_cltv_expiry; + /** + * Custom TLVs which were set by the sender. + * + * For HTLCs received by LDK, these will ultimately bubble back up as + * [`RecipientOnionFields::custom_tlvs`]. + */ + struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs; +} LDKPendingHTLCRouting_LDKReceiveKeysend_Body; + +typedef struct MUST_USE_STRUCT LDKPendingHTLCRouting { + LDKPendingHTLCRouting_Tag tag; + union { + LDKPendingHTLCRouting_LDKForward_Body forward; + LDKPendingHTLCRouting_LDKReceive_Body receive; + LDKPendingHTLCRouting_LDKReceiveKeysend_Body receive_keysend; + }; +} LDKPendingHTLCRouting; + +/** + * The contents of CResult_PendingHTLCRoutingDecodeErrorZ + */ +typedef union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPendingHTLCRouting *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_PendingHTLCRoutingDecodeErrorZPtr; + +/** + * A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PendingHTLCRoutingDecodeErrorZ { + /** + * The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr contents; + /** + * Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PendingHTLCRoutingDecodeErrorZ; + +/** + * The contents of CResult_PendingHTLCInfoDecodeErrorZ + */ +typedef union LDKCResult_PendingHTLCInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPendingHTLCInfo *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_PendingHTLCInfoDecodeErrorZPtr; + +/** + * A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PendingHTLCInfoDecodeErrorZ { + /** + * The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PendingHTLCInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PendingHTLCInfoDecodeErrorZ; + +/** + * The contents of CResult_BlindedFailureDecodeErrorZ + */ +typedef union LDKCResult_BlindedFailureDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + enum LDKBlindedFailure *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_BlindedFailureDecodeErrorZPtr; + +/** + * A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedFailureDecodeErrorZ { + /** + * The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedFailureDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedFailureDecodeErrorZ; + /** * The contents of CResult_ChannelShutdownStateDecodeErrorZ */ @@ -8470,21 +9984,12 @@ typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { * blocks are connected and disconnected. * * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. + * responsible for maintaining a set of monitors such that they can be updated as channel state + * changes. On each update, *all copies* of a [`ChannelMonitor`] must be updated and the update + * persisted to disk to ensure that the latest [`ChannelMonitor`] state can be reloaded if the + * application crashes. * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateStatus`] for more details about how to handle - * multiple instances. - * - * [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure + * See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements. */ typedef struct LDKWatch { /** @@ -8499,21 +10004,33 @@ 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 [`ChannelMonitorUpdateStatus::PermanentFailure`] if - * the given `funding_txo` has previously been registered via `watch_channel`. + * A return of `Err(())` indicates that the channel should immediately be force-closed without + * broadcasting the funding transaction. + * + * If the given `funding_txo` has previously been registered via `watch_channel`, `Err(())` + * must be returned. * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ - enum LDKChannelMonitorUpdateStatus (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + struct LDKCResult_ChannelMonitorUpdateStatusNoneZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); /** * Updates a channel identified by `funding_txo` by applying `update` to its monitor. * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateStatus`] for invariants around returning an error. + * Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This + * may fail (returning an `Err(())`), in which case this should return + * [`ChannelMonitorUpdateStatus::InProgress`] (and the update should never complete). This + * generally implies the channel has been closed (either by the funding outpoint being spent + * on-chain or the [`ChannelMonitor`] having decided to do so and broadcasted a transaction), + * and the [`ChannelManager`] state will be updated once it sees the funding spend on-chain. * - * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * In general, persistence failures should be retried after returning + * [`ChannelMonitorUpdateStatus::InProgress`] and eventually complete. If a failure truly + * cannot be retried, the node should shut down immediately after returning + * [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** @@ -8573,7 +10090,7 @@ typedef struct LDKBroadcasterInterface { * be sure to manage both cases correctly. * * Bitcoin transaction packages are defined in BIP 331 and here: - * https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md + * */ void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs); /** @@ -8604,20 +10121,55 @@ typedef struct LDKEntropySource { void (*free)(void *this_arg); } LDKEntropySource; + + /** - * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not - * own the memory pointed to by data. + * A semantically valid [`InvoiceRequest`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. */ -typedef struct LDKu8slice { +typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { /** - * A pointer to the byte buffer + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - const uint8_t *data; + LDKnativeUnsignedInvoiceRequest *inner; /** - * The number of bytes pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKu8slice; + bool is_owned; +} LDKUnsignedInvoiceRequest; + + + +/** + * A semantically valid [`Bolt12Invoice`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedBolt12Invoice *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; +} LDKUnsignedBolt12Invoice; @@ -8740,7 +10292,7 @@ typedef struct LDKNodeSigner { * * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); + struct LDKCResult_ThirtyTwoBytesNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak); /** * Sign an invoice. * @@ -8755,6 +10307,34 @@ typedef struct LDKNodeSigner { * Errors if the [`Recipient`] variant is not supported by the implementation. */ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice request. + * + * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where + * `invoice_request` is the callee. + * + * Implementors may check that the `invoice_request` is expected rather than blindly signing + * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with + * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedInvoiceRequest::payer_id`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice. + * + * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the + * callee. + * + * Implementors may check that the `invoice` is expected rather than blindly signing the tagged + * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing + * key or an ephemeral key to preserve privacy, whichever is associated with + * [`UnsignedBolt12Invoice::signing_pubkey`]. + * + * [`TaggedHash`]: crate::offers::merkle::TaggedHash + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice); /** * Sign a gossip message. * @@ -8763,7 +10343,7 @@ typedef struct LDKNodeSigner { * message to be broadcast, as otherwise it may prevent one from receiving funds over the * corresponding channel. */ - struct LDKCResult_SignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); + struct LDKCResult_ECDSASignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); /** * 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. @@ -8781,7 +10361,7 @@ typedef struct LDKSignerProvider { */ void *this_arg; /** - * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::EcdsaSigner`] through * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated * `channel_keys_id`. @@ -8809,7 +10389,7 @@ typedef struct LDKSignerProvider { * This method is slowly being phased out -- it will only be called when reading objects * written by LDK versions prior to 0.0.113. * - * [`Signer`]: Self::Signer + * [`Signer`]: Self::EcdsaSigner * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ @@ -8820,9 +10400,10 @@ typedef struct LDKSignerProvider { * If this function returns an error, this will result in a channel failing to open. * * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * on-chain funds across channels as controlled to the same user. `channel_keys_id` may be + * used to derive a unique value for each channel. */ - struct LDKCResult_ScriptNoneZ (*get_destination_script)(const void *this_arg); + struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id); /** * Get a script pubkey which we will send funds to when closing a channel. * @@ -8877,6 +10458,52 @@ typedef struct LDKFeeEstimator { void (*free)(void *this_arg); } LDKFeeEstimator; + + +/** + * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and + * may not be valid if received by another lightning implementation. + */ +typedef struct MUST_USE_STRUCT LDKReceiveTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeReceiveTlvs *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; +} LDKReceiveTlvs; + +/** + * A trait defining behavior for routing an [`OnionMessage`]. + */ +typedef struct LDKMessageRouter { + /** + * 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 a route for sending an [`OnionMessage`] to the given [`Destination`]. + */ + struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); + /** + * Creates [`BlindedPath`]s to the `recipient` node. The nodes in `peers` are assumed to be + * direct peers with the `recipient`. + */ + struct LDKCResult_CVec_BlindedPathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_PublicKeyZ peers); + /** + * 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); +} LDKMessageRouter; + /** * A trait defining behavior for routing a payment. */ @@ -8907,6 +10534,16 @@ typedef struct LDKRouter { * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * Creates [`BlindedPath`]s for payment to the `recipient` node. The channels in `first_hops` + * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are + * given in `tlvs`. + */ + struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats); + /** + * Implementation of MessageRouter for this object. + */ + struct LDKMessageRouter MessageRouter; /** * 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. @@ -8929,12 +10566,14 @@ typedef struct LDKRouter { * called [`funding_transaction_generated`] for outbound channels) being closed. * * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with - * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before - * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the - * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees). + * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST durably write each + * [`ChannelMonitorUpdate`] before returning from + * [`chain::Watch::watch_channel`]/[`update_channel`] or before completing async writes. With + * `ChannelManager`s, writing updates happens out-of-band (and will prevent any other + * `ChannelManager` operations from occurring during the serialization process). If the + * deserialized version is out-of-date compared to the [`ChannelMonitor`] passed by reference to + * [`read`], those channels will be force-closed based on the `ChannelMonitor` state and no funds + * will be lost (modulo on-chain transaction fees). * * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which * tells you the last block hash which was connected. You should get the best block tip before using the manager. @@ -8988,7 +10627,7 @@ typedef struct MUST_USE_STRUCT LDKChannelManager { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BlockHashChannelManagerZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ { /** * The element at position 0 */ @@ -8997,40 +10636,40 @@ typedef struct LDKC2Tuple_BlockHashChannelManagerZ { * The element at position 1 */ struct LDKChannelManager b; -} LDKC2Tuple_BlockHashChannelManagerZ; +} LDKC2Tuple_ThirtyTwoBytesChannelManagerZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelManagerZ *result; + struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; /** * Options for how to set the max dust HTLC exposure allowed on a channel. See @@ -9400,7 +11039,7 @@ typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_OutPointScriptZ { +typedef struct LDKC2Tuple_OutPointCVec_u8ZZ { /** * The element at position 0 */ @@ -9409,12 +11048,12 @@ typedef struct LDKC2Tuple_OutPointScriptZ { * The element at position 1 */ struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointScriptZ; +} LDKC2Tuple_OutPointCVec_u8ZZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_u32ScriptZ { +typedef struct LDKC2Tuple_u32CVec_u8ZZ { /** * The element at position 0 */ @@ -9423,28 +11062,28 @@ typedef struct LDKC2Tuple_u32ScriptZ { * The element at position 1 */ struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; +} LDKC2Tuple_u32CVec_u8ZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32CVec_u8ZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef struct LDKCVec_C2Tuple_u32CVec_u8ZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_u32ScriptZ *data; + struct LDKC2Tuple_u32CVec_u8ZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_u32ScriptZZ; +} LDKCVec_C2Tuple_u32CVec_u8ZZZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { /** * The element at position 0 */ @@ -9452,24 +11091,40 @@ typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** * The element at position 1 */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; + struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b; +} LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; + struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; +} LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; + +/** + * A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CommitmentTransactionZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKCommitmentTransaction *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CommitmentTransactionZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -9504,7 +11159,7 @@ typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { /** * The element at position 0 */ @@ -9513,10 +11168,10 @@ typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { * The element at position 1 */ struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; +} LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ; /** - * 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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_TransactionOutputsZ { @@ -9524,7 +11179,7 @@ typedef struct LDKCVec_TransactionOutputsZ { * 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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *data; /** * The number of elements pointed to by `data`. */ @@ -9590,7 +11245,7 @@ typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { * The amount available to claim, in satoshis, excluding the on-chain fees which will be * required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; } LDKBalance_LDKClaimableOnChannelClose_Body; typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { @@ -9598,7 +11253,7 @@ typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { * The amount available to claim, in satoshis, possibly excluding the on-chain fees which * were spent in broadcasting the transaction. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which an [`Event::SpendableOutputs`] event will be generated for this * amount. @@ -9611,7 +11266,7 @@ typedef struct LDKBalance_LDKContentiousClaimable_Body { * The amount available to claim, in satoshis, excluding the on-chain fees which will be * required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which the counterparty may be able to claim the balance if we have not * done so. @@ -9632,7 +11287,7 @@ typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { * The amount potentially available to claim, in satoshis, excluding the on-chain fees * which will be required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which we will be able to claim the balance if our counterparty has not * done so. @@ -9649,7 +11304,7 @@ typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { * The amount potentially available to claim, in satoshis, excluding the on-chain fees * which will be required to do so. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; /** * The height at which our counterparty will be able to claim the balance if we have not * yet received the preimage and claimed it ourselves. @@ -9668,7 +11323,7 @@ typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body { * Note that for outputs from HTLC balances this may be excluding some on-chain fees that * were already spent. */ - uint64_t claimable_amount_satoshis; + uint64_t amount_satoshis; } LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body; typedef struct MUST_USE_STRUCT LDKBalance { @@ -9702,7 +11357,7 @@ typedef struct LDKCVec_BalanceZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { +typedef struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ { /** * The element at position 0 */ @@ -9711,40 +11366,40 @@ typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { * The element at position 1 */ struct LDKChannelMonitor b; -} LDKC2Tuple_BlockHashChannelMonitorZ; +} LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; /** * Defines a type identifier for sending messages over the wire. @@ -9769,6 +11424,12 @@ typedef struct LDKType { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Called, if set, after this Type has been cloned into a duplicate object. + * The new Type is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKType *NONNULL_PTR new_Type); /** * 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. @@ -9806,156 +11467,40 @@ typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { uintptr_t datalen; } LDKCVec_C2Tuple_PublicKeyTypeZZ; - - -/** - * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. - * - * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request - * specifies these such that its recipient can send an invoice for payment. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Offer`]: crate::offers::offer::Offer - */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequest { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoiceRequest *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; -} LDKInvoiceRequest; - - - -/** - * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. - * - * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent - * directly after scanning a refund. It includes all the information needed to pay a recipient. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - */ -typedef struct MUST_USE_STRUCT LDKBolt12Invoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeBolt12Invoice *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; -} LDKBolt12Invoice; - - - -/** - * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - */ -typedef struct MUST_USE_STRUCT LDKInvoiceError { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoiceError *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; -} LDKInvoiceError; - /** - * Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`]. - * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKOffersMessage_Tag { - /** - * A request for a [`Bolt12Invoice`] for a particular [`Offer`]. - * - * [`Offer`]: crate::offers::offer::Offer - */ - LDKOffersMessage_InvoiceRequest, +typedef struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ { /** - * A [`Bolt12Invoice`] sent in response to an [`InvoiceRequest`] or a [`Refund`]. - * - * [`Refund`]: crate::offers::refund::Refund - */ - LDKOffersMessage_Invoice, - /** - * An error from handling an [`OffersMessage`]. + * The element at position 0 */ - LDKOffersMessage_InvoiceError, + struct LDKPublicKey a; /** - * Must be last for serialization purposes + * The element at position 1 */ - LDKOffersMessage_Sentinel, -} LDKOffersMessage_Tag; - -typedef struct MUST_USE_STRUCT LDKOffersMessage { - LDKOffersMessage_Tag tag; - union { - struct { - struct LDKInvoiceRequest invoice_request; - }; - struct { - struct LDKBolt12Invoice invoice; - }; - struct { - struct LDKInvoiceError invoice_error; - }; - }; -} LDKOffersMessage; + struct LDKCVec_SocketAddressZ b; +} LDKC2Tuple_PublicKeyCVec_SocketAddressZZ; /** - * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCVec_SocketAddressZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_OffersMessageZ_Tag { - /** - * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage - */ - LDKCOption_OffersMessageZ_Some, +typedef struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ { /** - * When we're in this state, this COption_OffersMessageZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_OffersMessageZ_None, + struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_OffersMessageZ_Sentinel, -} LDKCOption_OffersMessageZ_Tag; - -typedef struct LDKCOption_OffersMessageZ { - LDKCOption_OffersMessageZ_Tag tag; - union { - struct { - struct LDKOffersMessage some; - }; - }; -} LDKCOption_OffersMessageZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ; /** - * The contents of a custom onion message. + * The contents of an onion message. */ -typedef struct LDKCustomOnionMessageContents { +typedef struct LDKOnionMessageContents { /** * 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. @@ -9969,72 +11514,116 @@ typedef struct LDKCustomOnionMessageContents { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Return a human-readable "debug" string describing this object + */ + struct LDKStr (*debug_str)(const void *this_arg); + /** + * Called, if set, after this OnionMessageContents has been cloned into a duplicate object. + * The new OnionMessageContents is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKOnionMessageContents *NONNULL_PTR new_OnionMessageContents); /** * 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); -} LDKCustomOnionMessageContents; +} LDKOnionMessageContents; /** - * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not + * An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not */ -typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag { +typedef enum LDKCOption_OnionMessageContentsZ_Tag { /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents + * When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents */ - LDKCOption_CustomOnionMessageContentsZ_Some, + LDKCOption_OnionMessageContentsZ_Some, /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing + * When we're in this state, this COption_OnionMessageContentsZ contains nothing */ - LDKCOption_CustomOnionMessageContentsZ_None, + LDKCOption_OnionMessageContentsZ_None, /** * Must be last for serialization purposes */ - LDKCOption_CustomOnionMessageContentsZ_Sentinel, -} LDKCOption_CustomOnionMessageContentsZ_Tag; + LDKCOption_OnionMessageContentsZ_Sentinel, +} LDKCOption_OnionMessageContentsZ_Tag; -typedef struct LDKCOption_CustomOnionMessageContentsZ { - LDKCOption_CustomOnionMessageContentsZ_Tag tag; +typedef struct LDKCOption_OnionMessageContentsZ { + LDKCOption_OnionMessageContentsZ_Tag tag; union { struct { - struct LDKCustomOnionMessageContents some; + struct LDKOnionMessageContents some; }; }; -} LDKCOption_CustomOnionMessageContentsZ; +} LDKCOption_OnionMessageContentsZ; /** - * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ + * The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ */ -typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +typedef union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_CustomOnionMessageContentsZ *result; + struct LDKCOption_OnionMessageContentsZ *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_CustomOnionMessageContentsZDecodeErrorZPtr; +} LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr; /** - * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ { +typedef struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ { /** - * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either + * The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents; + union LDKCResult_COption_OnionMessageContentsZDecodeErrorZPtr contents; /** - * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. + * Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ; +} LDKCResult_COption_OnionMessageContentsZDecodeErrorZ; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ { + /** + * The element at position 0 + */ + struct LDKOnionMessageContents a; + /** + * The element at position 1 + */ + struct LDKDestination b; + /** + * The element at position 2 + */ + struct LDKBlindedPath c; +} LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ; /** * An enum which can either contain a crate::lightning::ln::wire::Type or not @@ -10097,36 +11686,36 @@ typedef struct LDKCResult_COption_TypeZDecodeErrorZ { } LDKCResult_COption_TypeZDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + * An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not */ -typedef enum LDKCOption_NetAddressZ_Tag { +typedef enum LDKCOption_SocketAddressZ_Tag { /** - * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + * When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress */ - LDKCOption_NetAddressZ_Some, + LDKCOption_SocketAddressZ_Some, /** - * When we're in this state, this COption_NetAddressZ contains nothing + * When we're in this state, this COption_SocketAddressZ contains nothing */ - LDKCOption_NetAddressZ_None, + LDKCOption_SocketAddressZ_None, /** * Must be last for serialization purposes */ - LDKCOption_NetAddressZ_Sentinel, -} LDKCOption_NetAddressZ_Tag; + LDKCOption_SocketAddressZ_Sentinel, +} LDKCOption_SocketAddressZ_Tag; -typedef struct LDKCOption_NetAddressZ { - LDKCOption_NetAddressZ_Tag tag; +typedef struct LDKCOption_SocketAddressZ { + LDKCOption_SocketAddressZ_Tag tag; union { struct { - struct LDKNetAddress some; + struct LDKSocketAddress some; }; }; -} LDKCOption_NetAddressZ; +} LDKCOption_SocketAddressZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { +typedef struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ { /** * The element at position 0 */ @@ -10134,24 +11723,24 @@ typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { /** * The element at position 1 */ - struct LDKCOption_NetAddressZ b; -} LDKC2Tuple_PublicKeyCOption_NetAddressZZ; + struct LDKCOption_SocketAddressZ b; +} LDKC2Tuple_PublicKeyCOption_SocketAddressZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { +typedef struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *data; + struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ; +} LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ; @@ -10323,7 +11912,7 @@ typedef union LDKCResult_u32GraphSyncErrorZPtr { /** * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, - * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. + * containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_u32GraphSyncErrorZ { @@ -10338,6 +11927,170 @@ typedef struct LDKCResult_u32GraphSyncErrorZ { bool result_ok; } LDKCResult_u32GraphSyncErrorZ; +/** + * The contents of CResult_CVec_u8ZIOErrorZ + */ +typedef union LDKCResult_CVec_u8ZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_u8Z *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_u8ZIOErrorZPtr; + +/** + * A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_u8ZIOErrorZ { + /** + * The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_u8ZIOErrorZPtr contents; + /** + * Whether this CResult_CVec_u8ZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_u8ZIOErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_StrZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKStr *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_StrZ; + +/** + * The contents of CResult_CVec_StrZIOErrorZ + */ +typedef union LDKCResult_CVec_StrZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_StrZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_StrZIOErrorZPtr; + +/** + * A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_StrZIOErrorZ { + /** + * The contents of this CResult_CVec_StrZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_StrZIOErrorZPtr contents; + /** + * Whether this CResult_CVec_StrZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_StrZIOErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ; + +/** + * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ + */ +typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr; + +/** + * A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + /** + * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr contents; + /** + * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ; + +/** + * The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ + */ +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr; + +/** + * A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + /** + * The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr contents; + /** + * Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; + /** * Represents a valid secp256k1 secret key serialized as a 32 byte array. */ @@ -10351,88 +12104,82 @@ typedef struct LDKSecretKey { /** * An enum which can either contain a crate::c_types::SecretKey or not */ -typedef enum LDKCOption_KeyPairZ_Tag { +typedef enum LDKCOption_SecretKeyZ_Tag { /** - * When we're in this state, this COption_KeyPairZ contains a crate::c_types::SecretKey + * When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey */ - LDKCOption_KeyPairZ_Some, + LDKCOption_SecretKeyZ_Some, /** - * When we're in this state, this COption_KeyPairZ contains nothing + * When we're in this state, this COption_SecretKeyZ contains nothing */ - LDKCOption_KeyPairZ_None, + LDKCOption_SecretKeyZ_None, /** * Must be last for serialization purposes */ - LDKCOption_KeyPairZ_Sentinel, -} LDKCOption_KeyPairZ_Tag; + LDKCOption_SecretKeyZ_Sentinel, +} LDKCOption_SecretKeyZ_Tag; -typedef struct LDKCOption_KeyPairZ { - LDKCOption_KeyPairZ_Tag tag; +typedef struct LDKCOption_SecretKeyZ { + LDKCOption_SecretKeyZ_Tag tag; union { struct { struct LDKSecretKey some; }; }; -} LDKCOption_KeyPairZ; +} LDKCOption_SecretKeyZ; + + /** - * The contents of CResult_COption_KeyPairZNoneZ + * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different + * ways to respond depending on whether the signing keys were derived. */ -typedef union LDKCResult_COption_KeyPairZNoneZPtr { +typedef struct MUST_USE_STRUCT LDKVerifiedInvoiceRequest { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKCOption_KeyPairZ *result; + LDKnativeVerifiedInvoiceRequest *inner; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Indicates that this is the only struct which contains the same pointer. + * Rust 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 *err; -} LDKCResult_COption_KeyPairZNoneZPtr; + bool is_owned; +} LDKVerifiedInvoiceRequest; /** - * A CResult_COption_KeyPairZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_KeyPairZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * The contents of CResult_VerifiedInvoiceRequestNoneZ */ -typedef struct LDKCResult_COption_KeyPairZNoneZ { +typedef union LDKCResult_VerifiedInvoiceRequestNoneZPtr { /** - * The contents of this CResult_COption_KeyPairZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - union LDKCResult_COption_KeyPairZNoneZPtr contents; + struct LDKVerifiedInvoiceRequest *result; /** - * Whether this CResult_COption_KeyPairZNoneZ represents a success state. + * Note that this value is always NULL, as there are no contents in the Err variant */ - bool result_ok; -} LDKCResult_COption_KeyPairZNoneZ; + void *err; +} LDKCResult_VerifiedInvoiceRequestNoneZPtr; /** - * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not + * A CResult_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef enum LDKCOption_ScriptZ_Tag { - /** - * When we're in this state, this COption_ScriptZ contains a crate::c_types::derived::CVec_u8Z - */ - LDKCOption_ScriptZ_Some, +typedef struct LDKCResult_VerifiedInvoiceRequestNoneZ { /** - * When we're in this state, this COption_ScriptZ contains nothing + * The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_ScriptZ_None, + union LDKCResult_VerifiedInvoiceRequestNoneZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state. */ - LDKCOption_ScriptZ_Sentinel, -} LDKCOption_ScriptZ_Tag; - -typedef struct LDKCOption_ScriptZ { - LDKCOption_ScriptZ_Tag tag; - union { - struct { - struct LDKCVec_u8Z some; - }; - }; -} LDKCOption_ScriptZ; + bool result_ok; +} LDKCResult_VerifiedInvoiceRequestNoneZ; /** * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. @@ -10478,64 +12225,70 @@ typedef struct LDKCOption_i64Z { } LDKCOption_i64Z; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * The contents of CResult_SocketAddressDecodeErrorZ */ -typedef enum LDKCOption_TxidZ_Tag { +typedef union LDKCResult_SocketAddressDecodeErrorZPtr { /** - * When we're in this state, this COption_TxidZ contains a crate::c_types::ThirtyTwoBytes + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_TxidZ_Some, + struct LDKSocketAddress *result; /** - * When we're in this state, this COption_TxidZ contains nothing + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_TxidZ_None, + struct LDKDecodeError *err; +} LDKCResult_SocketAddressDecodeErrorZPtr; + +/** + * A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SocketAddressDecodeErrorZ { /** - * Must be last for serialization purposes + * The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_TxidZ_Sentinel, -} LDKCOption_TxidZ_Tag; - -typedef struct LDKCOption_TxidZ { - LDKCOption_TxidZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_TxidZ; + union LDKCResult_SocketAddressDecodeErrorZPtr contents; + /** + * Whether this CResult_SocketAddressDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SocketAddressDecodeErrorZ; /** - * The contents of CResult_NetAddressDecodeErrorZ + * The contents of CResult_SocketAddressSocketAddressParseErrorZ */ -typedef union LDKCResult_NetAddressDecodeErrorZPtr { +typedef union LDKCResult_SocketAddressSocketAddressParseErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetAddress *result; + struct LDKSocketAddress *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_NetAddressDecodeErrorZPtr; + enum LDKSocketAddressParseError *err; +} LDKCResult_SocketAddressSocketAddressParseErrorZPtr; /** - * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetAddressDecodeErrorZ { +typedef struct LDKCResult_SocketAddressSocketAddressParseErrorZ { /** - * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either + * The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetAddressDecodeErrorZPtr contents; + union LDKCResult_SocketAddressSocketAddressParseErrorZPtr contents; /** - * Whether this CResult_NetAddressDecodeErrorZ represents a success state. + * Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetAddressDecodeErrorZ; +} LDKCResult_SocketAddressSocketAddressParseErrorZ; @@ -10755,6 +12508,138 @@ typedef struct LDKCResult_AcceptChannelV2DecodeErrorZ { bool result_ok; } LDKCResult_AcceptChannelV2DecodeErrorZ; +/** + * The contents of CResult_StfuDecodeErrorZ + */ +typedef union LDKCResult_StfuDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStfu *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_StfuDecodeErrorZPtr; + +/** + * A CResult_StfuDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_StfuDecodeErrorZ { + /** + * The contents of this CResult_StfuDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StfuDecodeErrorZPtr contents; + /** + * Whether this CResult_StfuDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StfuDecodeErrorZ; + +/** + * The contents of CResult_SpliceDecodeErrorZ + */ +typedef union LDKCResult_SpliceDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSplice *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_SpliceDecodeErrorZPtr; + +/** + * A CResult_SpliceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::Splice on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SpliceDecodeErrorZ { + /** + * The contents of this CResult_SpliceDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceDecodeErrorZ; + +/** + * The contents of CResult_SpliceAckDecodeErrorZ + */ +typedef union LDKCResult_SpliceAckDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSpliceAck *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_SpliceAckDecodeErrorZPtr; + +/** + * A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SpliceAckDecodeErrorZ { + /** + * The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceAckDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceAckDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceAckDecodeErrorZ; + +/** + * The contents of CResult_SpliceLockedDecodeErrorZ + */ +typedef union LDKCResult_SpliceLockedDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSpliceLocked *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_SpliceLockedDecodeErrorZPtr; + +/** + * A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SpliceLockedDecodeErrorZ { + /** + * The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceLockedDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceLockedDecodeErrorZ; + /** * The contents of CResult_TxAddInputDecodeErrorZ */ @@ -11019,27 +12904,6 @@ typedef struct LDKCResult_TxAckRbfDecodeErrorZ { bool result_ok; } LDKCResult_TxAckRbfDecodeErrorZ; - - -/** - * A tx_abort message which signals the cancellation of an in-progress transaction negotiation. - * - */ -typedef struct MUST_USE_STRUCT LDKTxAbort { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeTxAbort *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; -} LDKTxAbort; - /** * The contents of CResult_TxAbortDecodeErrorZ */ @@ -11723,6 +13587,39 @@ typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ { bool result_ok; } LDKCResult_UpdateFulfillHTLCDecodeErrorZ; +/** + * The contents of CResult_OnionPacketDecodeErrorZ + */ +typedef union LDKCResult_OnionPacketDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionPacket *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_OnionPacketDecodeErrorZPtr; + +/** + * A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionPacketDecodeErrorZ { + /** + * The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionPacketDecodeErrorZPtr contents; + /** + * Whether this CResult_OnionPacketDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionPacketDecodeErrorZ; + /** * The contents of CResult_UpdateAddHTLCDecodeErrorZ */ @@ -11810,6 +13707,39 @@ typedef struct LDKCResult_OnionMessageDecodeErrorZ { bool result_ok; } LDKCResult_OnionMessageDecodeErrorZ; +/** + * The contents of CResult_FinalOnionHopDataDecodeErrorZ + */ +typedef union LDKCResult_FinalOnionHopDataDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKFinalOnionHopData *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_FinalOnionHopDataDecodeErrorZPtr; + +/** + * A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_FinalOnionHopDataDecodeErrorZ { + /** + * The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_FinalOnionHopDataDecodeErrorZPtr contents; + /** + * Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_FinalOnionHopDataDecodeErrorZ; + /** @@ -13082,36 +15012,63 @@ typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ { } LDKCResult_TrustedCommitmentTransactionNoneZ; /** - * The contents of CResult_CVec_SignatureZNoneZ + * The contents of CResult_CVec_ECDSASignatureZNoneZ */ -typedef union LDKCResult_CVec_SignatureZNoneZPtr { +typedef union LDKCResult_CVec_ECDSASignatureZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_SignatureZ *result; + struct LDKCVec_ECDSASignatureZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_CVec_SignatureZNoneZPtr; +} LDKCResult_CVec_ECDSASignatureZNoneZPtr; /** - * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure. + * A CResult_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_SignatureZNoneZ { +typedef struct LDKCResult_CVec_ECDSASignatureZNoneZ { /** - * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either + * The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_SignatureZNoneZPtr contents; + union LDKCResult_CVec_ECDSASignatureZNoneZPtr contents; /** - * Whether this CResult_CVec_SignatureZNoneZ represents a success state. + * Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_SignatureZNoneZ; +} LDKCResult_CVec_ECDSASignatureZNoneZ; + +/** + * An enum which can either contain a usize or not + */ +typedef enum LDKCOption_usizeZ_Tag { + /** + * When we're in this state, this COption_usizeZ contains a usize + */ + LDKCOption_usizeZ_Some, + /** + * When we're in this state, this COption_usizeZ contains nothing + */ + LDKCOption_usizeZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_usizeZ_Sentinel, +} LDKCOption_usizeZ_Tag; + +typedef struct LDKCOption_usizeZ { + LDKCOption_usizeZ_Tag tag; + union { + struct { + uintptr_t some; + }; + }; +} LDKCOption_usizeZ; /** * The contents of CResult_ShutdownScriptDecodeErrorZ @@ -13149,7 +15106,7 @@ typedef struct LDKCResult_ShutdownScriptDecodeErrorZ { /** - * An error occurring when converting from [`Script`] to [`ShutdownScript`]. + * An error occurring when converting from [`ScriptBuf`] to [`ShutdownScript`]. */ typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript { /** @@ -13228,7 +15185,7 @@ typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - struct LDKCOption_PaymentPreimageZ payment_preimage; + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; /** * The \"payment secret\". This authenticates the sender to the recipient, preventing a * number of deanonymization attacks during the routing process. @@ -13287,6 +15244,59 @@ typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { bool result_ok; } LDKCResult_PaymentPurposeDecodeErrorZ; + + +/** + * Information about an HTLC that is part of a payment that can be claimed. + */ +typedef struct MUST_USE_STRUCT LDKClaimedHTLC { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeClaimedHTLC *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKClaimedHTLC; + +/** + * The contents of CResult_ClaimedHTLCDecodeErrorZ + */ +typedef union LDKCResult_ClaimedHTLCDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKClaimedHTLC *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ClaimedHTLCDecodeErrorZPtr; + +/** + * A CResult_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ClaimedHTLCDecodeErrorZ { + /** + * The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClaimedHTLCDecodeErrorZPtr contents; + /** + * Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClaimedHTLCDecodeErrorZ; + /** * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`]. @@ -13478,6 +15488,11 @@ typedef enum LDKClosureReason_Tag { * The channel has been immediately closed. */ LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, + /** + * Another channel in the same funding batch closed before the funding transaction + * was ready to be broadcast. + */ + LDKClosureReason_FundingBatchClosure, /** * Must be last for serialization purposes */ @@ -13751,56 +15766,45 @@ typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ { /** * An enum which can either contain a crate::c_types::U128 or not */ -typedef enum LDKCOption_u128Z_Tag { +typedef enum LDKCOption_U128Z_Tag { /** - * When we're in this state, this COption_u128Z contains a crate::c_types::U128 + * When we're in this state, this COption_U128Z contains a crate::c_types::U128 */ - LDKCOption_u128Z_Some, + LDKCOption_U128Z_Some, /** - * When we're in this state, this COption_u128Z contains nothing + * When we're in this state, this COption_U128Z contains nothing */ - LDKCOption_u128Z_None, + LDKCOption_U128Z_None, /** * Must be last for serialization purposes */ - LDKCOption_u128Z_Sentinel, -} LDKCOption_u128Z_Tag; + LDKCOption_U128Z_Sentinel, +} LDKCOption_U128Z_Tag; -typedef struct LDKCOption_u128Z { - LDKCOption_u128Z_Tag tag; +typedef struct LDKCOption_U128Z { + LDKCOption_U128Z_Tag tag; union { struct { struct LDKU128 some; }; }; -} LDKCOption_u128Z; +} LDKCOption_U128Z; /** - * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not + * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_PaymentIdZ_Tag { - /** - * When we're in this state, this COption_PaymentIdZ contains a crate::c_types::ThirtyTwoBytes - */ - LDKCOption_PaymentIdZ_Some, +typedef struct LDKCVec_ClaimedHTLCZ { /** - * When we're in this state, this COption_PaymentIdZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_PaymentIdZ_None, + struct LDKClaimedHTLC *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_PaymentIdZ_Sentinel, -} LDKCOption_PaymentIdZ_Tag; - -typedef struct LDKCOption_PaymentIdZ { - LDKCOption_PaymentIdZ_Tag tag; - union { - struct { - struct LDKThirtyTwoBytes some; - }; - }; -} LDKCOption_PaymentIdZ; + uintptr_t datalen; +} LDKCVec_ClaimedHTLCZ; /** * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not @@ -13890,8 +15894,8 @@ typedef enum LDKBumpTransactionEvent_Tag { * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to * be not urgent. * - * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::EcdsaChannelSigner::sign_holder_anchor_input + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness */ LDKBumpTransactionEvent_ChannelClose, @@ -13923,9 +15927,8 @@ typedef enum LDKBumpTransactionEvent_Tag { * longer able to commit external confirmed funds to the HTLC transaction or the fee committed * to the HTLC transaction is greater in value than the HTLCs being claimed. * - * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction - * [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction */ LDKBumpTransactionEvent_HTLCResolution, /** @@ -14030,9 +16033,19 @@ typedef enum LDKEvent_Tag { * Note that if the preimage is not known, you should call * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`] * to free up resources for this HTLC and avoid network congestion. - * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`], - * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be - * automatically failed. + * + * If [`Event::PaymentClaimable::onion_fields`] is `Some`, and includes custom TLVs with even type + * numbers, you should use [`ChannelManager::fail_htlc_backwards_with_reason`] with + * [`FailureCode::InvalidOnionPayload`] if you fail to understand and handle the contents, or + * [`ChannelManager::claim_funds_with_known_custom_tlvs`] upon successful handling. + * If you don't intend to check for custom TLVs, you can simply use + * [`ChannelManager::claim_funds`], which will automatically fail back even custom TLVs. + * + * If you fail to call [`ChannelManager::claim_funds`], + * [`ChannelManager::claim_funds_with_known_custom_tlvs`], + * [`ChannelManager::fail_htlc_backwards`], or + * [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will + * be automatically failed. * * # Note * LDK will not stop an inbound payment from being paid multiple times, so multiple @@ -14044,6 +16057,8 @@ typedef enum LDKEvent_Tag { * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs + * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason */ @@ -14065,6 +16080,33 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ LDKEvent_PaymentClaimed, + /** + * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`]. + * + * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a + * [`Destination`]. Once a connection is established, any messages buffered by an + * [`OnionMessageHandler`] may be sent. + * + * This event will not be generated for onion message forwards; only for sends including + * replies. Handlers should connect to the node otherwise any buffered messages may be lost. + * + * [`OnionMessage`]: msgs::OnionMessage + * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter + * [`Destination`]: crate::onion_message::messenger::Destination + * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler + */ + LDKEvent_ConnectionNeeded, + /** + * Indicates a request for an invoice failed to yield a response in a reasonable amount of time + * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an + * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + */ + LDKEvent_InvoiceRequestFailed, /** * 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). @@ -14081,6 +16123,11 @@ typedef enum LDKEvent_Tag { * payment is no longer retryable, due either to the [`Retry`] provided or * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. * + * In exceedingly rare cases, it is possible that an [`Event::PaymentFailed`] is generated for + * a payment after an [`Event::PaymentSent`] event for this same payment has already been + * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, + * and the payment MUST be treated as having succeeded. + * * [`Retry`]: crate::ln::channelmanager::Retry * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ @@ -14167,18 +16214,28 @@ typedef enum LDKEvent_Tag { /** * Used to indicate that a previously opened channel with the given `channel_id` is in the * process of closure. + * + * Note that this event is only triggered for accepted channels: if the + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is + * rejected, no `ChannelClosed` event will be sent. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ LDKEvent_ChannelClosed, /** * Used to indicate to the user that they can abandon the funding transaction and recycle the * inputs for another purpose. + * + * This event is not guaranteed to be generated for channels that are closed due to a restart. */ LDKEvent_DiscardFunding, /** * Indicates a request to open a new channel by a peer. * - * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the - * request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, + * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`] + * event will _not_ be triggered if the channel is rejected. * * The event is only triggered when a new open channel request is received and the * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. @@ -14244,11 +16301,15 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { */ struct LDKCVec_u8Z output_script; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a - * random value for an inbound channel. This may be zero for objects serialized with LDK - * versions prior to 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ struct LDKU128 user_channel_id; } LDKEvent_LDKFundingGenerationReady_Body; @@ -14309,14 +16370,12 @@ typedef struct LDKEvent_LDKPaymentClaimable_Body { struct LDKPaymentPurpose purpose; /** * The `channel_id` indicating over which channel we received the payment. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes via_channel_id; + struct LDKCOption_ThirtyTwoBytesZ via_channel_id; /** * The `user_channel_id` indicating over which channel we received the payment. */ - struct LDKCOption_u128Z via_user_channel_id; + struct LDKCOption_U128Z via_user_channel_id; /** * The block height at which this payment will be failed back and will no longer be * eligible for claiming. @@ -14356,15 +16415,43 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { * spontaneous payment. */ struct LDKPaymentPurpose purpose; + /** + * The HTLCs that comprise the claimed payment. This will be empty for events serialized prior + * to LDK version 0.0.117. + */ + struct LDKCVec_ClaimedHTLCZ htlcs; + /** + * The sender-intended sum total of all the MPP parts. This will be `None` for events + * serialized prior to LDK version 0.0.117. + */ + struct LDKCOption_u64Z sender_intended_total_msat; } LDKEvent_LDKPaymentClaimed_Body; +typedef struct LDKEvent_LDKConnectionNeeded_Body { + /** + * The node id for the node needing a connection. + */ + struct LDKPublicKey node_id; + /** + * Sockets for connecting to the node. + */ + struct LDKCVec_SocketAddressZ addresses; +} LDKEvent_LDKConnectionNeeded_Body; + +typedef struct LDKEvent_LDKInvoiceRequestFailed_Body { + /** + * The `payment_id` to have been associated with payment for the requested invoice. + */ + struct LDKThirtyTwoBytes payment_id; +} LDKEvent_LDKInvoiceRequestFailed_Body; + typedef struct LDKEvent_LDKPaymentSent_Body { /** * The `payment_id` passed to [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - struct LDKCOption_PaymentIdZ payment_id; + struct LDKCOption_ThirtyTwoBytesZ payment_id; /** * The preimage to the hash given to ChannelManager::send_payment. * Note that this serves as a payment receipt, if you wish to have such a thing, you must @@ -14425,7 +16512,7 @@ typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - struct LDKCOption_PaymentHashZ payment_hash; + struct LDKCOption_ThirtyTwoBytesZ payment_hash; /** * The payment path that was successful. * @@ -14443,7 +16530,7 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - struct LDKCOption_PaymentIdZ payment_id; + struct LDKCOption_ThirtyTwoBytesZ payment_id; /** * The hash that was given to [`ChannelManager::send_payment`]. * @@ -14573,23 +16660,25 @@ typedef struct LDKEvent_LDKSpendableOutputs_Body { * The outputs which you should store as spendable by you. */ struct LDKCVec_SpendableOutputDescriptorZ outputs; + /** + * The `channel_id` indicating which channel the spendable outputs belong to. + * + * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + */ + struct LDKCOption_ThirtyTwoBytesZ channel_id; } LDKEvent_LDKSpendableOutputs_Body; typedef struct LDKEvent_LDKPaymentForwarded_Body { /** * The incoming channel between the previous node and us. This is only `None` for events * generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes prev_channel_id; + struct LDKCOption_ThirtyTwoBytesZ prev_channel_id; /** * The outgoing channel between the next node and us. This is only `None` for events * generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes next_channel_id; + struct LDKCOption_ThirtyTwoBytesZ next_channel_id; /** * The fee, in milli-satoshis, which was earned as a result of the payment. * @@ -14639,10 +16728,8 @@ typedef struct LDKEvent_LDKChannelPending_Body { * The `temporary_channel_id` this channel used to be known by during channel establishment. * * Will be `None` for channels created prior to LDK version 0.0.115. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes former_temporary_channel_id; + struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id; /** * The `node_id` of the channel counterparty. */ @@ -14702,6 +16789,28 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * The reason the channel was closed. */ struct LDKClosureReason reason; + /** + * Counterparty in the closed channel. + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey counterparty_node_id; + /** + * Channel capacity of the closing channel (sats). + * + * This field will be `None` for objects serialized prior to LDK 0.0.117. + */ + struct LDKCOption_u64Z channel_capacity_sats; + /** + * The original channel funding TXO; this helps checking for the existence and confirmation + * status of the closing tx. + * Note that for instances serialized in v0.0.119 or prior this will be missing (None). + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOutPoint channel_funding_txo; } LDKEvent_LDKChannelClosed_Body; typedef struct LDKEvent_LDKDiscardFunding_Body { @@ -14784,6 +16893,8 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; LDKEvent_LDKPaymentClaimable_Body payment_claimable; LDKEvent_LDKPaymentClaimed_Body payment_claimed; + LDKEvent_LDKConnectionNeeded_Body connection_needed; + LDKEvent_LDKInvoiceRequestFailed_Body invoice_request_failed; LDKEvent_LDKPaymentSent_Body payment_sent; LDKEvent_LDKPaymentFailed_Body payment_failed; LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful; @@ -14866,55 +16977,6 @@ typedef struct LDKCResult_COption_EventZDecodeErrorZ { bool result_ok; } LDKCResult_COption_EventZDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; - -/** - * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ - */ -typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKIOError *err; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; - -/** - * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { - /** - * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; - /** - * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; - /** * Sub-errors which don't have specific information in them use this type. */ @@ -15217,9 +17279,9 @@ typedef struct MUST_USE_STRUCT LDKPayeePubKey { } LDKPayeePubKey; /** - * The contents of CResult_PayeePubKeyErrorZ + * The contents of CResult_PayeePubKeySecp256k1ErrorZ */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { +typedef union LDKCResult_PayeePubKeySecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -15230,24 +17292,24 @@ typedef union LDKCResult_PayeePubKeyErrorZPtr { * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKSecp256k1Error *err; -} LDKCResult_PayeePubKeyErrorZPtr; +} LDKCResult_PayeePubKeySecp256k1ErrorZPtr; /** - * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, + * A CResult_PayeePubKeySecp256k1ErrorZ represents the result of a fallible operation, * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PayeePubKeyErrorZ { +typedef struct LDKCResult_PayeePubKeySecp256k1ErrorZ { /** - * The contents of this CResult_PayeePubKeyErrorZ, accessible via either + * The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PayeePubKeyErrorZPtr contents; + union LDKCResult_PayeePubKeySecp256k1ErrorZPtr contents; /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; +} LDKCResult_PayeePubKeySecp256k1ErrorZ; @@ -15412,22 +17474,6 @@ typedef struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ { bool result_ok; } LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ; -/** - * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_AddressZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKStr *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_AddressZ; - /** @@ -15764,184 +17810,229 @@ typedef struct LDKCResult_UntrustedStringDecodeErrorZ { } LDKCResult_UntrustedStringDecodeErrorZ; /** - * An error that may occur when making a payment. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKPaymentError_Tag { +typedef struct LDKC2Tuple__u832u16Z { /** - * An error resulting from the provided [`Bolt11Invoice`] or payment hash. + * The element at position 0 */ - LDKPaymentError_Invoice, + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + uint16_t b; +} LDKC2Tuple__u832u16Z; + + + +/** + * Parameters for relaying over a given [`BlindedHop`]. + * + * [`BlindedHop`]: crate::blinded_path::BlindedHop + */ +typedef struct MUST_USE_STRUCT LDKPaymentRelay { /** - * An error occurring when sending a payment. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKPaymentError_Sending, + LDKnativePaymentRelay *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. */ - LDKPaymentError_Sentinel, -} LDKPaymentError_Tag; - -typedef struct MUST_USE_STRUCT LDKPaymentError { - LDKPaymentError_Tag tag; - union { - struct { - struct LDKStr invoice; - }; - struct { - enum LDKRetryableSendFailure sending; - }; - }; -} LDKPaymentError; + bool is_owned; +} LDKPaymentRelay; /** - * The contents of CResult_PaymentIdPaymentErrorZ + * The contents of CResult_PaymentRelayDecodeErrorZ */ -typedef union LDKCResult_PaymentIdPaymentErrorZPtr { +typedef union LDKCResult_PaymentRelayDecodeErrorZPtr { /** * 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 LDKPaymentRelay *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; + struct LDKDecodeError *err; +} LDKCResult_PaymentRelayDecodeErrorZPtr; /** - * 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. + * A CResult_PaymentRelayDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentRelay 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_PaymentIdPaymentErrorZ { +typedef struct LDKCResult_PaymentRelayDecodeErrorZ { /** - * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either + * The contents of this CResult_PaymentRelayDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentErrorZPtr contents; + union LDKCResult_PaymentRelayDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + * Whether this CResult_PaymentRelayDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentErrorZ; +} LDKCResult_PaymentRelayDecodeErrorZ; + + /** - * The contents of CResult_NonePaymentErrorZ + * Constraints for relaying over a given [`BlindedHop`]. + * + * [`BlindedHop`]: crate::blinded_path::BlindedHop */ -typedef union LDKCResult_NonePaymentErrorZPtr { +typedef struct MUST_USE_STRUCT LDKPaymentConstraints { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - void *result; + LDKnativePaymentConstraints *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; +} LDKPaymentConstraints; + +/** + * The contents of CResult_PaymentConstraintsDecodeErrorZ + */ +typedef union LDKCResult_PaymentConstraintsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPaymentConstraints *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_NonePaymentErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_PaymentConstraintsDecodeErrorZPtr; /** - * A CResult_NonePaymentErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure. + * A CResult_PaymentConstraintsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentConstraints 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_NonePaymentErrorZ { +typedef struct LDKCResult_PaymentConstraintsDecodeErrorZ { /** - * The contents of this CResult_NonePaymentErrorZ, accessible via either + * The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentErrorZPtr contents; + union LDKCResult_PaymentConstraintsDecodeErrorZPtr contents; /** - * Whether this CResult_NonePaymentErrorZ represents a success state. + * Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentErrorZ; +} LDKCResult_PaymentConstraintsDecodeErrorZ; /** - * The contents of CResult_StringErrorZ + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_StringErrorZPtr { +typedef struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The element at position 0 */ - struct LDKStr *result; + struct LDKThirtyTwoBytes a; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The element at position 1 */ - enum LDKSecp256k1Error *err; -} LDKCResult_StringErrorZPtr; + struct LDKRecipientOnionFields b; + /** + * The element at position 2 + */ + struct LDKRouteParameters c; +} LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ; /** - * A CResult_StringErrorZ represents the result of a fallible operation, - * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ */ -typedef struct LDKCResult_StringErrorZ { +typedef union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { /** - * The contents of this CResult_StringErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - union LDKCResult_StringErrorZPtr contents; + struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *result; /** - * Whether this CResult_StringErrorZ represents a success state. + * Note that this value is always NULL, as there are no contents in the Err variant */ - bool result_ok; -} LDKCResult_StringErrorZ; - - + void *err; +} LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr; /** - * A path for sending an [`msgs::OnionMessage`]. + * A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKOnionMessagePath { +typedef struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeOnionMessagePath *inner; + union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state. */ - bool is_owned; -} LDKOnionMessagePath; + bool result_ok; +} LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ; /** - * The contents of CResult_OnionMessagePathNoneZ + * The contents of CResult_StrSecp256k1ErrorZ */ -typedef union LDKCResult_OnionMessagePathNoneZPtr { +typedef union LDKCResult_StrSecp256k1ErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKOnionMessagePath *result; + struct LDKStr *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_OnionMessagePathNoneZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_StrSecp256k1ErrorZPtr; /** - * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. + * A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation, + * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_OnionMessagePathNoneZ { +typedef struct LDKCResult_StrSecp256k1ErrorZ { /** - * The contents of this CResult_OnionMessagePathNoneZ, accessible via either + * The contents of this CResult_StrSecp256k1ErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_OnionMessagePathNoneZPtr contents; + union LDKCResult_StrSecp256k1ErrorZPtr contents; /** - * Whether this CResult_OnionMessagePathNoneZ represents a success state. + * Whether this CResult_StrSecp256k1ErrorZ represents a success state. */ bool result_ok; -} LDKCResult_OnionMessagePathNoneZ; +} LDKCResult_StrSecp256k1ErrorZ; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { + /** + * The element at position 0 + */ + struct LDKPublicKey a; + /** + * The element at position 1 + */ + struct LDKOnionMessage b; + /** + * The element at position 2 + */ + struct LDKCOption_CVec_SocketAddressZZ c; +} LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ; /** * Errors that may occur when [sending an onion message]. @@ -15959,14 +18050,18 @@ typedef enum LDKSendError_Tag { */ LDKSendError_TooBigPacket, /** - * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two - * blinded hops. + * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded + * hops. */ LDKSendError_TooFewBlindedHops, /** - * Our next-hop peer was offline or does not support onion message forwarding. + * The first hop is not a peer and doesn't have a known [`SocketAddress`]. */ LDKSendError_InvalidFirstHop, + /** + * A path from the sender to the destination could not be found by the [`MessageRouter`]. + */ + LDKSendError_PathNotFound, /** * Onion message contents must have a TLV type >= 64. */ @@ -16000,40 +18095,218 @@ typedef struct MUST_USE_STRUCT LDKSendError { struct { enum LDKSecp256k1Error secp256k1; }; + struct { + struct LDKPublicKey invalid_first_hop; + }; }; } LDKSendError; /** - * The contents of CResult_NoneSendErrorZ + * The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ */ -typedef union LDKCResult_NoneSendErrorZPtr { +typedef union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { /** - * 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 LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKSendError *err; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr; + +/** + * A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { + /** + * The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr contents; + /** + * Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ; + +/** + * The contents of an [`OnionMessage`] as read from the wire. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef enum LDKParsedOnionMessageContents_Tag { + /** + * A message related to BOLT 12 Offers. + */ + LDKParsedOnionMessageContents_Offers, + /** + * A custom onion message specified by the user. + */ + LDKParsedOnionMessageContents_Custom, + /** + * Must be last for serialization purposes + */ + LDKParsedOnionMessageContents_Sentinel, +} LDKParsedOnionMessageContents_Tag; + +typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents { + LDKParsedOnionMessageContents_Tag tag; + union { + struct { + struct LDKOffersMessage offers; + }; + struct { + struct LDKOnionMessageContents custom; + }; + }; +} LDKParsedOnionMessageContents; + +/** + * A processed incoming onion message, containing either a Forward (another onion message) + * or a Receive payload with decrypted contents. + */ +typedef enum LDKPeeledOnion_Tag { + /** + * Forwarded onion, with the next node id and a new onion + */ + LDKPeeledOnion_Forward, + /** + * Received onion message, with decrypted contents, path_id, and reply path + */ + LDKPeeledOnion_Receive, + /** + * Must be last for serialization purposes + */ + LDKPeeledOnion_Sentinel, +} LDKPeeledOnion_Tag; + +typedef struct LDKPeeledOnion_LDKForward_Body { + struct LDKPublicKey _0; + struct LDKOnionMessage _1; +} LDKPeeledOnion_LDKForward_Body; + +typedef struct LDKPeeledOnion_LDKReceive_Body { + struct LDKParsedOnionMessageContents _0; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes _1; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedPath _2; +} LDKPeeledOnion_LDKReceive_Body; + +typedef struct MUST_USE_STRUCT LDKPeeledOnion { + LDKPeeledOnion_Tag tag; + union { + LDKPeeledOnion_LDKForward_Body forward; + LDKPeeledOnion_LDKReceive_Body receive; + }; +} LDKPeeledOnion; + +/** + * The contents of CResult_PeeledOnionNoneZ + */ +typedef union LDKCResult_PeeledOnionNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPeeledOnion *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_PeeledOnionNoneZPtr; + +/** + * A CResult_PeeledOnionNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PeeledOnionNoneZ { + /** + * The contents of this CResult_PeeledOnionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PeeledOnionNoneZPtr contents; + /** + * Whether this CResult_PeeledOnionNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_PeeledOnionNoneZ; + +/** + * Result of successfully [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message + */ +typedef enum LDKSendSuccess_Tag { + /** + * The message was buffered and will be sent once it is processed by + * [`OnionMessageHandler::next_onion_message_for_peer`]. + */ + LDKSendSuccess_Buffered, + /** + * The message was buffered and will be sent once the node is connected as a peer and it is + * processed by [`OnionMessageHandler::next_onion_message_for_peer`]. + */ + LDKSendSuccess_BufferedAwaitingConnection, + /** + * Must be last for serialization purposes + */ + LDKSendSuccess_Sentinel, +} LDKSendSuccess_Tag; + +typedef struct MUST_USE_STRUCT LDKSendSuccess { + LDKSendSuccess_Tag tag; + union { + struct { + struct LDKPublicKey buffered_awaiting_connection; + }; + }; +} LDKSendSuccess; + +/** + * The contents of CResult_SendSuccessSendErrorZ + */ +typedef union LDKCResult_SendSuccessSendErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSendSuccess *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKSendError *err; -} LDKCResult_NoneSendErrorZPtr; +} LDKCResult_SendSuccessSendErrorZPtr; /** - * A CResult_NoneSendErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure. + * A CResult_SendSuccessSendErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneSendErrorZ { +typedef struct LDKCResult_SendSuccessSendErrorZ { /** - * The contents of this CResult_NoneSendErrorZ, accessible via either + * The contents of this CResult_SendSuccessSendErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneSendErrorZPtr contents; + union LDKCResult_SendSuccessSendErrorZPtr contents; /** - * Whether this CResult_NoneSendErrorZ represents a success state. + * Whether this CResult_SendSuccessSendErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneSendErrorZ; +} LDKCResult_SendSuccessSendErrorZ; /** * The contents of CResult_BlindedPathNoneZ @@ -16067,6 +18340,74 @@ typedef struct LDKCResult_BlindedPathNoneZ { bool result_ok; } LDKCResult_BlindedPathNoneZ; +/** + * The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ + */ +typedef union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr; + +/** + * A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { + /** + * The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ; + + + +/** + * An intermediate node, its outbound channel, and relay parameters. + */ +typedef struct MUST_USE_STRUCT LDKForwardNode { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeForwardNode *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; +} LDKForwardNode; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::payment::ForwardNodes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ForwardNodeZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKForwardNode *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ForwardNodeZ; + /** * The contents of CResult_BlindedPathDecodeErrorZ */ @@ -16168,6 +18509,356 @@ typedef struct LDKCResult_InvoiceErrorDecodeErrorZ { +/** + * Base key used in conjunction with a `per_commitment_point` to generate a [`DelayedPaymentKey`]. + * + * The delayed payment key is used to pay the commitment state broadcaster their + * non-HTLC-encumbered funds after a delay to give their counterparty a chance to punish if the + * state broadcasted was previously revoked. + */ +typedef struct MUST_USE_STRUCT LDKDelayedPaymentBasepoint { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDelayedPaymentBasepoint *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; +} LDKDelayedPaymentBasepoint; + +/** + * The contents of CResult_DelayedPaymentBasepointDecodeErrorZ + */ +typedef union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDelayedPaymentBasepoint *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_DelayedPaymentBasepointDecodeErrorZPtr; + +/** + * A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint 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_DelayedPaymentBasepointDecodeErrorZ { + /** + * The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr contents; + /** + * Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_DelayedPaymentBasepointDecodeErrorZ; + + + +/** + * A derived key built from a [`DelayedPaymentBasepoint`] and `per_commitment_point`. + * + * The delayed payment key is used to pay the commitment state broadcaster their + * non-HTLC-encumbered funds after a delay. This delay gives their counterparty a chance to + * punish and claim all the channel funds if the state broadcasted was previously revoked. + * + * [See the BOLT specs] + * (https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation) + * for more information on key derivation details. + */ +typedef struct MUST_USE_STRUCT LDKDelayedPaymentKey { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDelayedPaymentKey *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; +} LDKDelayedPaymentKey; + +/** + * The contents of CResult_DelayedPaymentKeyDecodeErrorZ + */ +typedef union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDelayedPaymentKey *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_DelayedPaymentKeyDecodeErrorZPtr; + +/** + * A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::DelayedPaymentKey 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_DelayedPaymentKeyDecodeErrorZ { + /** + * The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr contents; + /** + * Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_DelayedPaymentKeyDecodeErrorZ; + + + +/** + * Base key used in conjunction with a `per_commitment_point` to generate an [`HtlcKey`]. + * + * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC + * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out. + * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script. + */ +typedef struct MUST_USE_STRUCT LDKHtlcBasepoint { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHtlcBasepoint *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; +} LDKHtlcBasepoint; + +/** + * The contents of CResult_HtlcBasepointDecodeErrorZ + */ +typedef union LDKCResult_HtlcBasepointDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHtlcBasepoint *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_HtlcBasepointDecodeErrorZPtr; + +/** + * A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::HtlcBasepoint 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_HtlcBasepointDecodeErrorZ { + /** + * The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HtlcBasepointDecodeErrorZPtr contents; + /** + * Whether this CResult_HtlcBasepointDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_HtlcBasepointDecodeErrorZ; + + + +/** + * A derived key built from a [`HtlcBasepoint`] and `per_commitment_point`. + * + * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC + * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out. + * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script. + * + * [See the BOLT specs] + * (https://github.com/lightning/bolts/blob/master/03-transactions.md#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation) + * for more information on key derivation details. + */ +typedef struct MUST_USE_STRUCT LDKHtlcKey { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHtlcKey *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; +} LDKHtlcKey; + +/** + * The contents of CResult_HtlcKeyDecodeErrorZ + */ +typedef union LDKCResult_HtlcKeyDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHtlcKey *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_HtlcKeyDecodeErrorZPtr; + +/** + * A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::HtlcKey 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_HtlcKeyDecodeErrorZ { + /** + * The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HtlcKeyDecodeErrorZPtr contents; + /** + * Whether this CResult_HtlcKeyDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_HtlcKeyDecodeErrorZ; + + + +/** + * Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel. + * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions. + */ +typedef struct MUST_USE_STRUCT LDKRevocationBasepoint { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRevocationBasepoint *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; +} LDKRevocationBasepoint; + +/** + * The contents of CResult_RevocationBasepointDecodeErrorZ + */ +typedef union LDKCResult_RevocationBasepointDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRevocationBasepoint *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_RevocationBasepointDecodeErrorZPtr; + +/** + * A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::RevocationBasepoint 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_RevocationBasepointDecodeErrorZ { + /** + * The contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RevocationBasepointDecodeErrorZPtr contents; + /** + * Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RevocationBasepointDecodeErrorZ; + + + +/** + * The revocation key is used to allow a channel party to revoke their state - giving their + * counterparty the required material to claim all of their funds if they broadcast that state. + * + * Each commitment transaction has a revocation key based on the basepoint and + * per_commitment_point which is used in both commitment and HTLC transactions. + * + * See [the BOLT spec for derivation details] + * (https://github.com/lightning/bolts/blob/master/03-transactions.md#revocationpubkey-derivation) + */ +typedef struct MUST_USE_STRUCT LDKRevocationKey { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRevocationKey *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; +} LDKRevocationKey; + +/** + * The contents of CResult_RevocationKeyDecodeErrorZ + */ +typedef union LDKCResult_RevocationKeyDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRevocationKey *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_RevocationKeyDecodeErrorZPtr; + +/** + * A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::RevocationKey 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_RevocationKeyDecodeErrorZ { + /** + * The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RevocationKeyDecodeErrorZPtr contents; + /** + * Whether this CResult_RevocationKeyDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RevocationKeyDecodeErrorZ; + + + /** * A transaction output watched by a [`ChannelMonitor`] for spends on-chain. * @@ -16409,6 +19100,85 @@ typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { uintptr_t datalen; } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; +/** + * Provides an interface that allows storage and retrieval of persisted values that are associated + * with given keys. + * + * In order to avoid collisions the key space is segmented based on the given `primary_namespace`s + * and `secondary_namespace`s. Implementations of this trait are free to handle them in different + * ways, as long as per-namespace key uniqueness is asserted. + * + * Keys and namespaces are required to be valid ASCII strings in the range of + * [`KVSTORE_NAMESPACE_KEY_ALPHABET`] and no longer than [`KVSTORE_NAMESPACE_KEY_MAX_LEN`]. Empty + * primary namespaces and secondary namespaces (`\"\"`) are assumed to be a valid, however, if + * `primary_namespace` is empty, `secondary_namespace` is required to be empty, too. This means + * that concerns should always be separated by primary namespace first, before secondary + * namespaces are used. While the number of primary namespaces will be relatively small and is + * determined at compile time, there may be many secondary namespaces per primary namespace. Note + * that per-namespace uniqueness needs to also hold for keys *and* namespaces in any given + * namespace, i.e., conflicts between keys and equally named + * primary namespaces/secondary namespaces must be avoided. + * + * **Note:** Users migrating custom persistence backends from the pre-v0.0.117 `KVStorePersister` + * interface can use a concatenation of `[{primary_namespace}/[{secondary_namespace}/]]{key}` to + * recover a `key` compatible with the data model previously assumed by `KVStorePersister::persist`. + */ +typedef struct LDKKVStore { + /** + * 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 data stored for the given `primary_namespace`, `secondary_namespace`, and + * `key`. + * + * Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given + * `primary_namespace` and `secondary_namespace`. + * + * [`ErrorKind::NotFound`]: io::ErrorKind::NotFound + */ + struct LDKCResult_CVec_u8ZIOErrorZ (*read)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key); + /** + * Persists the given data under the given `key`. + * + * Will create the given `primary_namespace` and `secondary_namespace` if not already present + * in the store. + */ + struct LDKCResult_NoneIOErrorZ (*write)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKu8slice buf); + /** + * Removes any data that had previously been persisted under the given `key`. + * + * If the `lazy` flag is set to `true`, the backend implementation might choose to lazily + * remove the given `key` at some point in time after the method returns, e.g., as part of an + * eventual batch deletion of multiple keys. As a consequence, subsequent calls to + * [`KVStore::list`] might include the removed key until the changes are actually persisted. + * + * Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent + * `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could + * potentially get lost on crash after the method returns. Therefore, this flag should only be + * set for `remove` operations that can be safely replayed at a later time. + * + * Returns successfully if no data will be stored for the given `primary_namespace`, + * `secondary_namespace`, and `key`, independently of whether it was present before its + * invokation or not. + */ + struct LDKCResult_NoneIOErrorZ (*remove)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, bool lazy); + /** + * Returns a list of keys that are stored under the given `secondary_namespace` in + * `primary_namespace`. + * + * Returns the keys in arbitrary order, so users requiring a particular order need to sort the + * returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown. + */ + struct LDKCResult_CVec_StrZIOErrorZ (*list)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace); + /** + * 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); +} LDKKVStore; + /** * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. */ @@ -16421,15 +19191,15 @@ typedef struct LDKPersister { /** * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); + struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); /** * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + struct LDKCResult_NoneIOErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); /** * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ - struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); + struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *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. @@ -16439,6 +19209,234 @@ typedef struct LDKPersister { +/** + * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and + * [`ChannelMonitorUpdate`]s. + * + * # Overview + * + * The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased + * I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and + * deleting) and complexity. This is because it writes channel monitor differential updates, + * whereas the other (default) implementation rewrites the entire monitor on each update. For + * routing nodes, updates can happen many times per second to a channel, and monitors can be tens + * of megabytes (or more). Updates can be as small as a few hundred bytes. + * + * Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with + * the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence, + * [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other + * persisters. This is because monitors written by this struct _may_ have unapplied updates. In + * order to downgrade, you must ensure that all updates are applied to the monitor, and remove the + * sentinel bytes. + * + * # Storing monitors + * + * Monitors are stored by implementing the [`Persist`] trait, which has two functions: + * + * - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s. + * - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`] + * + * Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`], + * using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`). + * + * Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows: + * + * - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`] + * - secondary namespace: [the monitor's encoded outpoint name] + * + * Under that secondary namespace, each update is stored with a number string, like `21`, which + * represents its `update_id` value. + * + * For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * Full channel monitors would be stored at a single key: + * + * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): + * + * ```text + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3 + * ``` + * ... and so on. + * + * # Reading channel state from storage + * + * Channel state can be reconstructed by calling + * [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can + * list channel monitors themselves and load channels individually using + * [`MonitorUpdatingPersister::read_channel_monitor_with_updates`]. + * + * ## EXTREMELY IMPORTANT + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in + * that circumstance (not when there is really a permissions error, for example). This is because + * neither channel monitor reading function lists updates. Instead, either reads the monitor, and + * using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until + * one is not found. All _other_ errors will be bubbled up in the function's [`Result`]. + * + * # Pruning stale channel updates + * + * Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`. + * Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates` + * are deleted. + * The `lazy` flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions + * will complete. However, stale updates are not a problem for data integrity, since updates are + * only read that are higher than the stored [`ChannelMonitor`]'s `update_id`. + * + * If you have many stale updates stored (such as after a crash with pending lazy deletes), and + * would like to get rid of them, consider using the + * [`MonitorUpdatingPersister::cleanup_stale_updates`] function. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdatingPersister *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; +} LDKMonitorUpdatingPersister; + +/** + * `Persist` defines behavior for persisting channel monitors: this could mean + * writing once to disk, and/or uploading to one or more backup services. + * + * Persistence can happen in one of two ways - synchronously completing before the trait method + * calls return or asynchronously in the background. + * + * # For those implementing synchronous persistence + * + * * If persistence completes fully (including any relevant `fsync()` calls), the implementation + * should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation + * should continue. + * + * * If persistence fails for some reason, implementations should consider returning + * [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in + * the background with [`ChainMonitor::list_pending_monitor_updates`] and + * [`ChainMonitor::get_monitor`]. + * + * Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can + * be marked as complete via [`ChainMonitor::channel_monitor_updated`]. + * + * If at some point no further progress can be made towards persisting the pending updates, the + * node should simply shut down. + * + * * If the persistence has failed and cannot be retried further (e.g. because of an outage), + * [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in + * an immediate panic and future operations in LDK generally failing. + * + * # For those implementing asynchronous persistence + * + * All calls should generally spawn a background task and immediately return + * [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes, + * [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding + * [`MonitorUpdateId`]. + * + * Note that unlike the direct [`chain::Watch`] interface, + * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. + * + * If at some point no further progress can be made towards persisting a pending update, the node + * should simply shut down. Until then, the background task should either loop indefinitely, or + * persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`] + * and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending + * monitor updates may be marked completed). + * + * # Using remote watchtowers + * + * Watchtowers may be updated as a part of an implementation of this trait, utilizing the async + * update process described above while the watchtower is being updated. The following methods are + * provided for bulding transactions for a watchtower: + * [`ChannelMonitor::initial_counterparty_commitment_tx`], + * [`ChannelMonitor::counterparty_commitment_txs_from_update`], + * [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`], + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]. + * + * [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx + */ +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 in response to a [`chain::Watch::watch_channel`] call. This is + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. + * + * The data can be stored any way you want, but the identifier provided by LDK is the + * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint + * and the stored channel data). Note that you **must** persist every new monitor to disk. + * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` + * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`Writeable::write`]: crate::util::ser::Writeable::write + */ + enum LDKChannelMonitorUpdateStatus (*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. + * + * 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, and in some rare cases, 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* + * the set of channel monitors is given to the `ChannelManager` + * deserialization routine. See [`ChannelMonitor::update_monitor`] for + * applying a monitor update to a monitor. If full `ChannelMonitors` are + * persisted, then there is no need to persist individual updates. + * + * Note that there could be a performance tradeoff between persisting complete + * channel monitors on every update vs. persisting only updates and applying + * them in batches. The size of each monitor grows `O(number of state updates)` + * whereas updates are small and `O(1)`. + * + * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], + * if you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, + * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and + * [`ChannelMonitorUpdateStatus`] 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 + */ + enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate 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. + */ + void (*free)(void *this_arg); +} LDKPersist; + + + /** * A string that displays only printable characters, replacing control characters with * [`core::char::REPLACEMENT_CHARACTER`]. @@ -16741,7 +19739,7 @@ typedef struct LDKConfirm { void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); /** * Returns transactions that must be monitored for reorganization out of the chain along - * with the hash of the block as part of which it had been previously confirmed. + * with the height and the hash of the block as part of which it had been previously confirmed. * * Note that the returned `Option` might be `None` for channels created with LDK * 0.0.112 and prior, in which case you need to manually track previous confirmations. @@ -16756,13 +19754,13 @@ typedef struct LDKConfirm { * given to [`transaction_unconfirmed`]. * * If any of the returned transactions are confirmed in a block other than the one with the - * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and - * [`transactions_confirmed`], respectively. + * given hash at the given height, they need to be unconfirmed and reconfirmed via + * [`transaction_unconfirmed`] and [`transactions_confirmed`], respectively. * * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ (*get_relevant_txids)(const void *this_arg); + struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ (*get_relevant_txids)(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. @@ -16770,151 +19768,60 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; + + /** - * `Persist` defines behavior for persisting channel monitors: this could mean - * writing once to disk, and/or uploading to one or more backup services. + * An implementation of [`chain::Watch`] for monitoring channels. + * + * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by + * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally + * or used independently to monitor channels remotely. See the [module-level documentation] for + * details. * - * Each method can return three possible values: - * * If persistence (including any relevant `fsync()` calls) happens immediately, the - * implementation should return [`ChannelMonitorUpdateStatus::Completed`], 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 - * [`ChannelMonitorUpdateStatus::InProgress`] while the update continues in the background. - * Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be called with - * the corresponding [`MonitorUpdateId`]. + * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from + * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, + * detecting substantial mempool feerate changes between blocks, and ensuring reliability if + * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an + * environment with spotty connections, like on mobile. * - * Note that unlike the direct [`chain::Watch`] interface, - * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [module-level documentation]: crate::chain::chainmonitor + * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims + */ +typedef struct MUST_USE_STRUCT LDKChainMonitor { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChainMonitor *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; +} LDKChainMonitor; + +/** + * A trait implemented for objects handling events from [`EventsProvider`]. * - * * If persistence fails for some reason, implementations should return - * [`ChannelMonitorUpdateStatus::PermanentFailure`], in which case the channel will likely be - * closed without broadcasting the latest state. See - * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more details. + * An async variation also exists for implementations of [`EventsProvider`] that support async + * event handling. The async event handler should satisfy the generic bounds: `F: + * core::future::Future, H: Fn(Event) -> F`. */ -typedef struct LDKPersist { +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; /** - * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is - * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. - * - * The data can be stored any way you want, but the identifier provided by LDK is the - * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint - * and the stored channel data). Note that you **must** persist every new monitor to disk. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` - * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * Handles the given [`Event`]. * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`Writeable::write`]: crate::util::ser::Writeable::write + * See [`EventsProvider`] for details that must be considered when implementing this method. */ - enum LDKChannelMonitorUpdateStatus (*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. - * - * 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* - * the set of channel monitors is given to the `ChannelManager` - * deserialization routine. See [`ChannelMonitor::update_monitor`] for - * applying a monitor update to a monitor. If full `ChannelMonitors` are - * persisted, then there is no need to persist individual updates. - * - * Note that there could be a performance tradeoff between persisting complete - * channel monitors on every update vs. persisting only updates and applying - * them in batches. The size of each monitor grows `O(number of state updates)` - * whereas updates are small and `O(1)`. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, - * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and - * [`ChannelMonitorUpdateStatus`] 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 - */ - enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, struct LDKChannelMonitorUpdate 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. - */ - void (*free)(void *this_arg); -} LDKPersist; - - - -/** - * An implementation of [`chain::Watch`] for monitoring channels. - * - * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by - * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally - * or used independently to monitor channels remotely. See the [module-level documentation] for - * details. - * - * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from - * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, - * detecting substantial mempool feerate changes between blocks, and ensuring reliability if - * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an - * environment with spotty connections, like on mobile. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [module-level documentation]: crate::chain::chainmonitor - * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims - */ -typedef struct MUST_USE_STRUCT LDKChainMonitor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChainMonitor *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; -} LDKChainMonitor; - -/** - * A trait implemented for objects handling events from [`EventsProvider`]. - * - * An async variation also exists for implementations of [`EventsProvider`] that support async - * event handling. The async event handler should satisfy the generic bounds: `F: - * core::future::Future, H: Fn(Event) -> F`. - */ -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, struct LDKEvent event); + void (*handle_event)(const void *this_arg, struct LDKEvent 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. @@ -16979,6 +19886,53 @@ typedef struct LDKEventsProvider { void (*free)(void *this_arg); } LDKEventsProvider; +/** + * This enum is used to specify which error data to send to peers when failing back an HTLC + * using [`ChannelManager::fail_htlc_backwards_with_reason`]. + * + * For more info on failure codes, see . + */ +typedef enum LDKFailureCode_Tag { + /** + * We had a temporary error processing the payment. Useful if no other error codes fit + * and you want to indicate that the payer may want to retry. + */ + LDKFailureCode_TemporaryNodeFailure, + /** + * We have a required feature which was not in this onion. For example, you may require + * some additional metadata that was not provided with this payment. + */ + LDKFailureCode_RequiredNodeFeatureMissing, + /** + * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of + * the HTLC is too close to the current block height for safe handling. + * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is + * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. + */ + LDKFailureCode_IncorrectOrUnknownPaymentDetails, + /** + * We failed to process the payload after the onion was decrypted. You may wish to + * use this when receiving custom HTLC TLVs with even type numbers that you don't recognize. + * + * If available, the tuple data may include the type number and byte offset in the + * decrypted byte stream where the failure occurred. + */ + LDKFailureCode_InvalidOnionPayload, + /** + * Must be last for serialization purposes + */ + LDKFailureCode_Sentinel, +} LDKFailureCode_Tag; + +typedef struct MUST_USE_STRUCT LDKFailureCode { + LDKFailureCode_Tag tag; + union { + struct { + struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload; + }; + }; +} LDKFailureCode; + /** @@ -17003,43 +19957,6 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { bool is_owned; } LDKChainParameters; -/** - * Strategies available to retry payment path failures. - */ -typedef enum LDKRetry_Tag { - /** - * Max number of attempts to retry payment. - * - * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a - * retry, and may retry multiple failed HTLCs at once if they failed around the same time and - * were retried along a route from a single call to [`Router::find_route_with_id`]. - */ - LDKRetry_Attempts, - /** - * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; - * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. - * - * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time - */ - LDKRetry_Timeout, - /** - * Must be last for serialization purposes - */ - LDKRetry_Sentinel, -} LDKRetry_Tag; - -typedef struct MUST_USE_STRUCT LDKRetry { - LDKRetry_Tag tag; - union { - struct { - uintptr_t attempts; - }; - struct { - uint64_t timeout; - }; - }; -} LDKRetry; - /** * A trait indicating an object may generate message send events */ @@ -17109,6 +20026,22 @@ typedef struct LDKChannelMessageHandler { * Handle an incoming `closing_signed` message from the given peer. */ void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); + /** + * Handle an incoming `stfu` message from the given peer. + */ + void (*handle_stfu)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg); + /** + * Handle an incoming `splice` message from the given peer. + */ + void (*handle_splice)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSplice *NONNULL_PTR msg); + /** + * Handle an incoming `splice_ack` message from the given peer. + */ + void (*handle_splice_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSpliceAck *NONNULL_PTR msg); + /** + * Handle an incoming `splice_locked` message from the given peer. + */ + void (*handle_splice_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSpliceLocked *NONNULL_PTR msg); /** * Handle an incoming `tx_add_input message` from the given peer. */ @@ -17216,12 +20149,12 @@ typedef struct LDKChannelMessageHandler { */ struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); /** - * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports. + * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * * If it's `None`, then no particular network chain hash compatibility will be enforced when * connecting to peers. */ - struct LDKCOption_CVec_ChainHashZZ (*get_genesis_hashes)(const void *this_arg); + struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); /** * Implementation of MessageSendEventsProvider for this object. */ @@ -17233,6 +20166,40 @@ typedef struct LDKChannelMessageHandler { void (*free)(void *this_arg); } LDKChannelMessageHandler; +/** + * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef struct LDKOffersMessageHandler { + /** + * 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 message by either responding with an [`Bolt12Invoice`], sending a payment, + * or replying with an error. + * + * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + */ + struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message); + /** + * Releases any [`OffersMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a payment flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_message`]. + */ + struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ (*release_pending_messages)(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); +} LDKOffersMessageHandler; + /** @@ -17307,6 +20274,26 @@ typedef struct MUST_USE_STRUCT LDKExpandedKey { bool is_owned; } LDKExpandedKey; + + +/** + * Packet of hop data for next peer + */ +typedef struct MUST_USE_STRUCT LDKPacket { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePacket *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; +} LDKPacket; + /** * A 3-byte byte array. */ @@ -17429,40 +20416,34 @@ typedef struct LDKRoutingMessageHandler { } LDKRoutingMessageHandler; /** - * A trait indicating an object may generate onion messages to send + * A handler for received [`OnionMessage`]s and for providing generated ones to send. */ -typedef struct LDKOnionMessageProvider { +typedef struct LDKOnionMessageHandler { /** * 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 next pending onion message for the peer with the given node id. + * Because much of the lightning network does not yet support forwarding onion messages, we + * may need to directly connect to a node which will forward a message for us. In such a case, + * this method will return the set of nodes which need connection by node_id and the + * corresponding socket addresses where they may accept incoming connections. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Thus, this method should be polled regularly to detect messages await such a direct + * connection. */ - struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_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); -} LDKOnionMessageProvider; - -/** - * A trait to describe an object that can receive onion messages. - */ -typedef struct LDKOnionMessageHandler { - /** - * 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; + struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ (*get_and_clear_connections_needed)(const void *this_arg); /** * Handle an incoming `onion_message` message from the given peer. */ void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); + /** + * Returns the next pending onion message for the peer with the given node id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); /** * Called when a connection is established with a peer. Can be used to track which peers * advertise onion message support and are online. @@ -17477,6 +20458,11 @@ typedef struct LDKOnionMessageHandler { * drop and refuse to forward onion messages to this peer. */ void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Performs actions that should happen roughly every ten seconds after startup. Allows handlers + * to drop any buffered onion messages intended for prospective peers. + */ + void (*timer_tick_occurred)(const void *this_arg); /** * Gets the node feature flags which this handler itself supports. All available handlers are * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] @@ -17491,10 +20477,6 @@ typedef struct LDKOnionMessageHandler { * Note that this method is called before [`Self::peer_connected`]. */ struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Implementation of OnionMessageProvider for this object. - */ - struct LDKOnionMessageProvider OnionMessageProvider; /** * 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. @@ -17602,29 +20584,6 @@ typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler { bool is_owned; } LDKIgnoringMessageHandler; -/** - * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. - * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage - */ -typedef struct LDKOffersMessageHandler { - /** - * 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 message by either responding with an [`Bolt12Invoice`], sending a payment, - * or replying with an error. - */ - struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message); - /** - * 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); -} LDKOffersMessageHandler; - /** * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`], * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages, @@ -17645,13 +20604,22 @@ typedef struct LDKCustomOnionMessageHandler { void *this_arg; /** * Called with the custom message that was received, returning a response to send, if any. + * + * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. */ - struct LDKCOption_CustomOnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKCustomOnionMessageContents msg); + struct LDKCOption_OnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents msg); /** * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the * message type is unknown. */ - struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); + struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); + /** + * Releases any [`Self::CustomMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a message flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_custom_message`]. + */ + struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ (*release_pending_custom_messages)(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. @@ -17871,116 +20839,93 @@ typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { bool is_owned; } LDKInvoiceRequestFeatures; -/** - * Integer in the range `0..=16` - */ -typedef struct LDKWitnessVersion { - uint8_t _0; -} LDKWitnessVersion; - /** - * A semantically valid [`Bolt12Invoice`] that hasn't been signed. - */ -typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedBolt12Invoice *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; -} LDKUnsignedBolt12Invoice; - - - -/** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or + * another currency. */ -typedef struct MUST_USE_STRUCT LDKErroneousField { +typedef struct MUST_USE_STRUCT LDKAmount { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeErroneousField *inner; + LDKnativeAmount *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; -} LDKErroneousField; +} LDKAmount; /** - * A semantically valid [`InvoiceRequest`] that hasn't been signed. + * Quantity of items supported by an [`Offer`]. */ -typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { +typedef struct MUST_USE_STRUCT LDKQuantity { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUnsignedInvoiceRequest *inner; + LDKnativeQuantity *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; -} LDKUnsignedInvoiceRequest; +} LDKQuantity; /** - * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or - * another currency. + * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340] + * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12]. + * + * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki + * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation */ -typedef struct MUST_USE_STRUCT LDKAmount { +typedef struct MUST_USE_STRUCT LDKTaggedHash { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeAmount *inner; + LDKnativeTaggedHash *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; -} LDKAmount; +} LDKTaggedHash; /** - * Quantity of items supported by an [`Offer`]. + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -typedef struct MUST_USE_STRUCT LDKQuantity { +typedef struct MUST_USE_STRUCT LDKErroneousField { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeQuantity *inner; + LDKnativeErroneousField *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; -} LDKQuantity; +} LDKErroneousField; @@ -18153,12 +21098,12 @@ typedef struct MUST_USE_STRUCT LDKDefaultRouter { /** - * [`Score`] implementation that factors in in-flight HTLC liquidity. + * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. * - * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling + * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling * [`find_route`]. * - * [`Score`]: crate::routing::scoring::Score + * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp */ typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { /** @@ -18246,6 +21191,39 @@ typedef struct MUST_USE_STRUCT LDKPayee { }; } LDKPayee; +/** + * A trait which can both lookup and update routing channel penalty scores. + * + * This is used in places where both bounds are required and implemented for all types which + * implement [`ScoreLookUp`] and [`ScoreUpdate`]. + * + * Bindings users may need to manually implement this for their custom scoring implementations. + */ +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; + /** + * Implementation of ScoreLookUp for this object. + */ + struct LDKScoreLookUp ScoreLookUp; + /** + * Implementation of ScoreUpdate for this object. + */ + struct LDKScoreUpdate ScoreUpdate; + /** + * 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; + /** @@ -18271,20 +21249,40 @@ typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { /** * A locked `MultiThreadedLockableScore`. */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock { +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockRead { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMultiThreadedScoreLockRead *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; +} LDKMultiThreadedScoreLockRead; + + + +/** + * A locked `MultiThreadedLockableScore`. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockWrite { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMultiThreadedScoreLock *inner; + LDKnativeMultiThreadedScoreLockWrite *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; -} LDKMultiThreadedScoreLock; +} LDKMultiThreadedScoreLockWrite; @@ -18376,100 +21374,72 @@ typedef struct MUST_USE_STRUCT LDKPhantomKeysManager { bool is_owned; } LDKPhantomKeysManager; -/** - * The destination of an onion message. - */ -typedef enum LDKDestination_Tag { - /** - * We're sending this onion message to a node. - */ - LDKDestination_Node, - /** - * We're sending this onion message to a blinded path. - */ - LDKDestination_BlindedPath, - /** - * Must be last for serialization purposes - */ - LDKDestination_Sentinel, -} LDKDestination_Tag; -typedef struct MUST_USE_STRUCT LDKDestination { - LDKDestination_Tag tag; - union { - struct { - struct LDKPublicKey node; - }; - struct { - struct LDKBlindedPath blinded_path; - }; - }; -} LDKDestination; /** - * A trait defining behavior for routing an [`OnionMessage`]. + * A sender, receiver and forwarder of [`OnionMessage`]s. * - * [`OnionMessage`]: msgs::OnionMessage - */ -typedef struct LDKMessageRouter { - /** - * 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 a route for sending an [`OnionMessage`] to the given [`Destination`]. - * - * [`OnionMessage`]: msgs::OnionMessage - */ - struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); - /** - * 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); -} LDKMessageRouter; - - - -/** - * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be - * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending - * and receiving custom onion messages is supported. + * # Handling Messages + * + * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding + * messages to peers or delegating to the appropriate handler for the message type. Currently, the + * available handlers are: + * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s + * * [`CustomOnionMessageHandler`], for handling user-defined message types + * + * # Sending Messages + * + * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling + * a message, the matched handler may return a response message which `OnionMessenger` will send + * on its behalf. * * # Example * * ``` * # extern crate bitcoin; * # use bitcoin::hashes::_export::_core::time::Duration; - * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; + * # use bitcoin::hashes::hex::FromHex; + * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey, self}; * # use lightning::blinded_path::BlindedPath; - * # use lightning::sign::KeysManager; + * # use lightning::sign::{EntropySource, KeysManager}; * # use lightning::ln::peer_handler::IgnoringMessageHandler; - * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath}; - * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents}; + * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath, OnionMessenger}; + * # use lightning::onion_message::packet::OnionMessageContents; * # use lightning::util::logger::{Logger, Record}; * # use lightning::util::ser::{Writeable, Writer}; * # use lightning::io; * # use std::sync::Arc; * # struct FakeLogger; * # impl Logger for FakeLogger { - * # fn log(&self, record: &Record) { unimplemented!() } + * # fn log(&self, record: Record) { println!(\"{:?}\" , record); } * # } * # struct FakeMessageRouter {} * # impl MessageRouter for FakeMessageRouter { * # fn find_path(&self, sender: PublicKey, peers: Vec, destination: Destination) -> Result { - * # unimplemented!() + * # let secp_ctx = Secp256k1::new(); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let hop_node_id2 = hop_node_id1; + * # Ok(OnionMessagePath { + * # intermediate_nodes: vec![hop_node_id1, hop_node_id2], + * # destination, + * # first_node_addresses: None, + * # }) + * # } + * # fn create_blinded_paths( + * # &self, _recipient: PublicKey, _peers: Vec, _secp_ctx: &Secp256k1 + * # ) -> Result, ()> { + * # unreachable!() * # } * # } * # let seed = [42u8; 32]; * # let time = Duration::from_secs(123456); * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); * # let logger = Arc::new(FakeLogger {}); - * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); * # let secp_ctx = Secp256k1::new(); * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); - * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1); + * # let (hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1); * # let destination_node_id = hop_node_id1; * # let message_router = Arc::new(FakeMessageRouter {}); * # let custom_message_handler = IgnoringMessageHandler {}; @@ -18481,6 +21451,7 @@ typedef struct LDKMessageRouter { * &custom_message_handler * ); * + * # #[derive(Debug, Clone)] * # struct YourCustomMessage {} * impl Writeable for YourCustomMessage { * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { @@ -18488,21 +21459,17 @@ typedef struct LDKMessageRouter { * \t\t// Write your custom onion message to `w` * \t} * } - * impl CustomOnionMessageContents for YourCustomMessage { + * impl OnionMessageContents for YourCustomMessage { * \tfn tlv_type(&self) -> u64 { * \t\t# let your_custom_message_type = 42; * \t\tyour_custom_message_type * \t} * } * // Send a custom onion message to a node id. - * let path = OnionMessagePath { - * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2], - * \tdestination: Destination::Node(destination_node_id), - * }; + * let destination = Destination::Node(destination_node_id); * let reply_path = None; - * # let your_custom_message = YourCustomMessage {}; - * let message = OnionMessageContents::Custom(your_custom_message); - * onion_messenger.send_onion_message(path, message, reply_path); + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, destination, reply_path); * * // Create a blinded path to yourself, for someone to send an onion message to. * # let your_node_id = hop_node_id1; @@ -18510,18 +21477,14 @@ typedef struct LDKMessageRouter { * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap(); * * // Send a custom onion message to a blinded path. - * let path = OnionMessagePath { - * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2], - * \tdestination: Destination::BlindedPath(blinded_path), - * }; + * let destination = Destination::BlindedPath(blinded_path); * let reply_path = None; - * # let your_custom_message = YourCustomMessage {}; - * let message = OnionMessageContents::Custom(your_custom_message); - * onion_messenger.send_onion_message(path, message, reply_path); + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, destination, reply_path); * ``` * - * [offers]: - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ typedef struct MUST_USE_STRUCT LDKOnionMessenger { /** @@ -18541,7 +21504,7 @@ typedef struct MUST_USE_STRUCT LDKOnionMessenger { /** - * A [`MessageRouter`] that always fails. + * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. */ typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { /** @@ -18558,56 +21521,25 @@ typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { bool is_owned; } LDKDefaultMessageRouter; -/** - * The contents of an onion message. In the context of offers, this would be the invoice, invoice - * request, or invoice error. - */ -typedef enum LDKOnionMessageContents_Tag { - /** - * A message related to BOLT 12 Offers. - */ - LDKOnionMessageContents_Offers, - /** - * A custom onion message specified by the user. - */ - LDKOnionMessageContents_Custom, - /** - * Must be last for serialization purposes - */ - LDKOnionMessageContents_Sentinel, -} LDKOnionMessageContents_Tag; - -typedef struct MUST_USE_STRUCT LDKOnionMessageContents { - LDKOnionMessageContents_Tag tag; - union { - struct { - struct LDKOffersMessage offers; - }; - struct { - struct LDKCustomOnionMessageContents custom; - }; - }; -} LDKOnionMessageContents; - /** - * The parameters required to derive a channel signer via [`SignerProvider`]. + * Data to construct a [`BlindedHop`] for forwarding a payment. */ -typedef struct MUST_USE_STRUCT LDKChannelDerivationParameters { +typedef struct MUST_USE_STRUCT LDKForwardTlvs { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelDerivationParameters *inner; + LDKnativeForwardTlvs *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; -} LDKChannelDerivationParameters; +} LDKForwardTlvs; /** * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can @@ -18653,8 +21585,11 @@ typedef struct LDKCoinSelectionSource { /** * Signs and provides the full witness for all inputs within the transaction known to the * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. */ - struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx); + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); /** * 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. @@ -18680,13 +21615,16 @@ typedef struct LDKWalletSource { * Returns a script to use for change above dust resulting from a successful coin selection * attempt. */ - struct LDKCResult_ScriptNoneZ (*get_change_script)(const void *this_arg); + struct LDKCResult_CVec_u8ZNoneZ (*get_change_script)(const void *this_arg); /** * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within * the transaction known to the wallet (i.e., any provided via * [`WalletSource::list_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. */ - struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx); + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); /** * 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. @@ -18743,33 +21681,22 @@ typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler { /** - * FilesystemPersister persists channel data on disk, where each channel's - * data is stored in a file named after its funding outpoint. - * - * Warning: this module does the best it can with calls to persist data, but it - * can only guarantee that the data is passed to the drive. It is up to the - * drive manufacturers to do the actual persistence properly, which they often - * don't (especially on consumer-grade hardware). Therefore, it is up to the - * user to validate their entire storage stack, to ensure the writes are - * persistent. - * Corollary: especially when dealing with larger amounts of money, it is best - * practice to have multiple channel data backups and not rely only on one - * FilesystemPersister. + * A [`KVStore`] implementation that writes to and reads from the file system. */ -typedef struct MUST_USE_STRUCT LDKFilesystemPersister { +typedef struct MUST_USE_STRUCT LDKFilesystemStore { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFilesystemPersister *inner; + LDKnativeFilesystemStore *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; -} LDKFilesystemPersister; +} LDKFilesystemStore; @@ -19005,6 +21932,8 @@ typedef struct MUST_USE_STRUCT LDKFallback { extern const uintptr_t MAX_BUF_SIZE; +extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; + extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; @@ -19083,6 +22012,34 @@ struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); */ struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); +/** + * Constructs a new WitnessProgram given a version and program bytes. + * + * The program MUST be at least 2 bytes and no longer than 40 bytes long. + * Further, if the version is 0, the program MUST be either exactly 20 or exactly 32 bytes long. + */ +struct LDKWitnessProgram WitnessProgram_new(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); + +/** + * Gets the `WitnessVersion` of the given `WitnessProgram` + */ +struct LDKWitnessVersion WitnessProgram_get_version(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Gets the witness program bytes of the given `WitnessProgram` + */ +struct LDKu8slice WitnessProgram_get_program(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Creates a new WitnessProgram which has the same data as `orig` + */ +struct LDKWitnessProgram WitnessProgram_clone(const struct LDKWitnessProgram *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `WitnessProgram` (which is currently none) + */ +void WitnessProgram_free(struct LDKWitnessProgram o); + /** * Convenience function for constructing a new BigEndianScalar */ @@ -19114,68 +22071,77 @@ struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig); void Witness_free(struct LDKWitness _res); /** - * Frees the witness and script_sig in a TxIn + * Convenience function for constructing a new TxIn */ -void TxIn_free(struct LDKTxIn _res); +struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); /** - * Convenience function for constructing a new TxIn + * Gets the `witness` in the given `TxIn`. */ -struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); +struct LDKWitness TxIn_get_witness(const struct LDKTxIn *NONNULL_PTR txin); /** - * Convenience function for constructing a new TxOut + * Gets the `script_sig` in the given `TxIn`. */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +struct LDKu8slice TxIn_get_script_sig(const struct LDKTxIn *NONNULL_PTR txin); /** - * Frees the data pointed to by script_pubkey. + * Gets the `sequence` in the given `TxIn`. */ -void TxOut_free(struct LDKTxOut _res); +uint32_t TxIn_get_sequence(const struct LDKTxIn *NONNULL_PTR txin); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Gets the previous outpoint txid in the given `TxIn`. */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +struct LDKThirtyTwoBytes TxIn_get_previous_txid(const struct LDKTxIn *NONNULL_PTR txin); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Gets the previout outpoint index in the given `TxIn`. */ -void Str_free(struct LDKStr _res); +uint32_t TxIn_get_previous_vout(const struct LDKTxIn *NONNULL_PTR txin); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Frees the witness and script_sig in a TxIn */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +void TxIn_free(struct LDKTxIn _res); /** - * Constructs a new COption_DurationZ containing a u64 + * Convenience function for constructing a new TxOut */ -struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o); +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); /** - * Constructs a new COption_DurationZ containing nothing + * Gets the `script_pubkey` in the given `TxOut`. */ -struct LDKCOption_DurationZ COption_DurationZ_none(void); +struct LDKu8slice TxOut_get_script_pubkey(const struct LDKTxOut *NONNULL_PTR txout); /** - * Frees any resources associated with the u64, if we are in the Some state + * Gets the value in the given `TxOut`. */ -void COption_DurationZ_free(struct LDKCOption_DurationZ _res); +uint64_t TxOut_get_value(const struct LDKTxOut *NONNULL_PTR txout); /** - * Creates a new COption_DurationZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the data pointed to by script_pubkey. */ -struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig); +void TxOut_free(struct LDKTxOut _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. */ -void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res); +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +/** + * Frees the data buffer, if chars_is_owned is set and len > 0. + */ +void Str_free(struct LDKStr _res); + +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif /** * Constructs a new COption_u64Z containing a u64 @@ -19198,6 +22164,11 @@ void COption_u64Z_free(struct LDKCOption_u64Z _res); */ struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res); + /** * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. */ @@ -19224,6 +22195,32 @@ void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErr */ struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_RetryDecodeErrorZ in the success state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); + +/** + * Creates a new CResult_RetryDecodeErrorZ in the error state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RetryDecodeErrorZ. + */ +void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); + +/** + * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_NoneAPIErrorZ in the success state. */ @@ -19261,25 +22258,25 @@ void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); /** - * Constructs a new COption_PaymentSecretZ containing a crate::c_types::ThirtyTwoBytes + * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_some(struct LDKThirtyTwoBytes o); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); /** - * Constructs a new COption_PaymentSecretZ containing nothing + * Constructs a new COption_ThirtyTwoBytesZ containing nothing */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_none(void); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void); /** * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state */ -void COption_PaymentSecretZ_free(struct LDKCOption_PaymentSecretZ _res); +void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); /** - * Creates a new COption_PaymentSecretZ which has the same data as `orig` + * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentSecretZ COption_PaymentSecretZ_clone(const struct LDKCOption_PaymentSecretZ *NONNULL_PTR orig); +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -19333,6 +22330,105 @@ void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOn */ struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b); + +/** + * Frees any resources used by the C2Tuple_u64CVec_u8ZZ. + */ +void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. + */ +void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state + */ +void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res); + +/** + * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_clone(const struct LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. + */ +void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig); + /** * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. */ @@ -19448,171 +22544,145 @@ void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescript void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * Constructs a new COption_PackedLockTimeZ containing a u32 + * Constructs a new COption_u32Z containing a u32 */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_some(uint32_t o); +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); /** - * Constructs a new COption_PackedLockTimeZ containing nothing + * Constructs a new COption_u32Z containing nothing */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_none(void); +struct LDKCOption_u32Z COption_u32Z_none(void); /** * Frees any resources associated with the u32, if we are in the Some state */ -void COption_PackedLockTimeZ_free(struct LDKCOption_PackedLockTimeZ _res); +void COption_u32Z_free(struct LDKCOption_u32Z _res); /** - * Creates a new COption_PackedLockTimeZ which has the same data as `orig` + * Creates a new COption_u32Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PackedLockTimeZ COption_PackedLockTimeZ_clone(const struct LDKCOption_PackedLockTimeZ *NONNULL_PTR orig); +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_clone(const struct LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR orig); +struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_clone(const struct LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PartiallySignedTransactionusizeZ from the contained elements. + * Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. */ -struct LDKC2Tuple_PartiallySignedTransactionusizeZ C2Tuple_PartiallySignedTransactionusizeZ_new(struct LDKCVec_u8Z a, uintptr_t b); +struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_new(struct LDKCVec_u8Z a, uint64_t b); /** - * Frees any resources used by the C2Tuple_PartiallySignedTransactionusizeZ. + * Frees any resources used by the C2Tuple_CVec_u8Zu64Z. */ -void C2Tuple_PartiallySignedTransactionusizeZ_free(struct LDKC2Tuple_PartiallySignedTransactionusizeZ _res); +void C2Tuple_CVec_u8Zu64Z_free(struct LDKC2Tuple_CVec_u8Zu64Z _res); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the success state. + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(struct LDKC2Tuple_PartiallySignedTransactionusizeZ o); +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu64Z o); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ in the error state. + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err(void); +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR o); +bool CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ. + * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. */ -void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res); +void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res); /** - * Creates a new CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res); - -/** - * Creates a new CResult_NoneNoneZ in the success state. + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); /** - * Creates a new CResult_NoneNoneZ in the error state. + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_NoneNoneZ. - */ -void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); - -/** - * Creates a new CResult_NoneNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); +bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. */ -void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); +void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. - */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. */ -void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); - -/** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. - */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); +bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. + * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. */ -void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); +void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` + * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignatureNoneZ in the success state. + * Creates a new CResult_NoneNoneZ in the success state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); /** - * Creates a new CResult_SignatureNoneZ in the error state. + * Creates a new CResult_NoneNoneZ in the error state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SignatureNoneZ. + * Frees any resources used by the CResult_NoneNoneZ. */ -void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); +void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); /** - * Creates a new CResult_SignatureNoneZ which has the same data as `orig` + * Creates a new CResult_NoneNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_PublicKeyNoneZ in the success state. @@ -19641,82 +22711,108 @@ void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar + * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar */ -struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); /** - * Constructs a new COption_ScalarZ containing nothing + * Constructs a new COption_BigEndianScalarZ containing nothing */ -struct LDKCOption_ScalarZ COption_ScalarZ_none(void); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void); /** * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state */ -void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); +void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); /** - * Creates a new COption_ScalarZ which has the same data as `orig` + * Creates a new COption_BigEndianScalarZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig); +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_U5Z_free(struct LDKCVec_U5Z _res); /** - * Creates a new CResult_SharedSecretNoneZ in the success state. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Creates a new CResult_SharedSecretNoneZ in the error state. + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o); +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SharedSecretNoneZ. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SchnorrSignatureNoneZ in the success state. */ -void CVec_U5Z_free(struct LDKCVec_U5Z _res); +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Creates a new CResult_SchnorrSignatureNoneZ in the error state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SchnorrSignatureNoneZ. + */ +void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); + +/** + * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ECDSASignatureNoneZ in the success state. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); + +/** + * Creates a new CResult_ECDSASignatureNoneZ in the error state. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); +bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Frees any resources used by the CResult_ECDSASignatureNoneZ. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. @@ -19739,30 +22835,36 @@ bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResu void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); /** - * Creates a new CResult_ScriptNoneZ in the success state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ScriptNoneZ in the error state. + * Creates a new CResult_CVec_u8ZNoneZ in the success state. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_err(void); +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZNoneZ in the error state. + */ +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ScriptNoneZ_is_ok(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR o); +bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ScriptNoneZ. + * Frees any resources used by the CResult_CVec_u8ZNoneZ. */ -void CResult_ScriptNoneZ_free(struct LDKCResult_ScriptNoneZ _res); +void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); /** - * Creates a new CResult_ScriptNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ScriptNoneZ CResult_ScriptNoneZ_clone(const struct LDKCResult_ScriptNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); /** * Creates a new CResult_ShutdownScriptNoneZ in the success state. @@ -19791,87 +22893,145 @@ void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_u16Z containing a u16 */ -void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. + * Constructs a new COption_u16Z containing nothing */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); +struct LDKCOption_u16Z COption_u16Z_none(void); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. + * Frees any resources associated with the u16, if we are in the Some state */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); +void COption_u16Z_free(struct LDKCOption_u16Z _res); + +/** + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); + +/** + * Constructs a new COption_boolZ containing a bool + */ +struct LDKCOption_boolZ COption_boolZ_some(bool o); + +/** + * Constructs a new COption_boolZ containing nothing + */ +struct LDKCOption_boolZ COption_boolZ_none(void); + +/** + * Frees any resources associated with the bool, if we are in the Some state + */ +void COption_boolZ_free(struct LDKCOption_boolZ _res); + +/** + * Creates a new COption_boolZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_boolZ COption_boolZ_clone(const struct LDKCOption_boolZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_WitnessNoneZ in the success state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_ok(struct LDKWitness o); + +/** + * Creates a new CResult_WitnessNoneZ in the error state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); +bool CResult_WitnessNoneZ_is_ok(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. + * Frees any resources used by the CResult_WitnessNoneZ. */ -void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); +void CResult_WitnessNoneZ_free(struct LDKCResult_WitnessNoneZ _res); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` + * Creates a new CResult_WitnessNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_clone(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); +void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ 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_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. + */ +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); + +/** + * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. + */ +void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); + +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); + +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); +void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_PartiallySignedTransactionNoneZ in the success state. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. */ -struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); /** - * Creates a new CResult_PartiallySignedTransactionNoneZ in the error state. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. */ -struct LDKCResult_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_err(void); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PartiallySignedTransactionNoneZ_is_ok(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR o); +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PartiallySignedTransactionNoneZ. + * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. */ -void CResult_PartiallySignedTransactionNoneZ_free(struct LDKCResult_PartiallySignedTransactionNoneZ _res); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); /** - * Creates a new CResult_PartiallySignedTransactionNoneZ 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_PartiallySignedTransactionNoneZ CResult_PartiallySignedTransactionNoneZ_clone(const struct LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR orig); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_TransactionNoneZ in the success state. @@ -19915,30 +23075,30 @@ struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Creates a new CResult_NoneIOErrorZ in the success state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Creates a new CResult_NoneIOErrorZ in the error state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_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); +bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Frees any resources used by the CResult_NoneIOErrorZ. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -19971,6 +23131,110 @@ void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _r */ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements. + */ +struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b); + +/** + * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ. + */ +void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ. + */ +void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(const struct LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +/** + * Creates a new CResult_OnionMessagePathNoneZ in the success state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); + +/** + * Creates a new CResult_OnionMessagePathNoneZ in the error state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionMessagePathNoneZ. + */ +void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); + +/** + * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_BlindedPathZNoneZ in the success state. + */ +struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_ok(struct LDKCVec_BlindedPathZ o); + +/** + * Creates a new CResult_CVec_BlindedPathZNoneZ in the error state. + */ +struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_BlindedPathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_BlindedPathZNoneZ. + */ +void CResult_CVec_BlindedPathZNoneZ_free(struct LDKCResult_CVec_BlindedPathZNoneZ _res); + +/** + * Creates a new CResult_CVec_BlindedPathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_BlindedPathZNoneZ CResult_CVec_BlindedPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR orig); + /** * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ @@ -20059,27 +23323,6 @@ struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone( */ void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); -/** - * Constructs a new COption_u32Z containing a u32 - */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); - -/** - * Constructs a new COption_u32Z containing nothing - */ -struct LDKCOption_u32Z COption_u32Z_none(void); - -/** - * Frees any resources associated with the u32, if we are in the Some state - */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); - -/** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -20168,27 +23411,6 @@ void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParamet */ struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements. - */ -struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b); - -/** - * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ. - */ -void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -20251,11 +23473,6 @@ void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeE */ 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_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); - /** * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. */ @@ -20324,16 +23541,10 @@ void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); */ struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_Z C2Tuple_Z_clone(const struct LDKC2Tuple_Z *NONNULL_PTR orig); - /** * Creates a new C2Tuple_Z from the contained elements. */ -struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b); +struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); /** * Frees any resources used by the C2Tuple_Z. @@ -20341,41 +23552,50 @@ struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKEightU16s a, struct LDKEightU16s b); void C2Tuple_Z_free(struct LDKC2Tuple_Z _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__u1632_u1632Z from the contained elements. */ -struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig); +struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); /** - * Creates a new C2Tuple__u168_u168Z from the contained elements. + * Frees any resources used by the C2Tuple__u1632_u1632Z. */ -struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b); +void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res); /** - * Frees any resources used by the C2Tuple__u168_u168Z. + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z */ -void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res); +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); /** - * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o); +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); /** - * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing + * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void); +void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state + * Constructs a new COption_f64Z containing a f64 */ -void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res); +struct LDKCOption_f64Z COption_f64Z_some(double o); /** - * Creates a new COption_C2Tuple_EightU16sEightU16sZZ which has the same data as `orig` + * Constructs a new COption_f64Z containing nothing + */ +struct LDKCOption_f64Z COption_f64Z_none(void); + +/** + * Frees any resources associated with the f64, if we are in the Some state + */ +void COption_f64Z_free(struct LDKCOption_f64Z _res); + +/** + * Creates a new COption_f64Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_clone(const struct LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR orig); +struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); /** * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. @@ -20419,46 +23639,51 @@ void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** - * Constructs a new COption_BlockHashZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_BlockHashZ COption_BlockHashZ_some(struct LDKThirtyTwoBytes o); +struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR orig); /** - * Constructs a new COption_BlockHashZ containing nothing + * Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. */ -struct LDKCOption_BlockHashZ COption_BlockHashZ_none(void); +struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, uint32_t b, struct LDKCOption_ThirtyTwoBytesZ c); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. */ -void COption_BlockHashZ_free(struct LDKCOption_BlockHashZ _res); +void C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res); /** - * Creates a new COption_BlockHashZ 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 LDKCOption_BlockHashZ COption_BlockHashZ_clone(const struct LDKCOption_BlockHashZ *NONNULL_PTR orig); +void CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _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 CResult_ChannelMonitorUpdateStatusNoneZ in the success state. */ -struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_clone(const struct LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR orig); +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); /** - * Creates a new C2Tuple_TxidCOption_BlockHashZZ from the contained elements. + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. */ -struct LDKC2Tuple_TxidCOption_BlockHashZZ C2Tuple_TxidCOption_BlockHashZZ_new(struct LDKThirtyTwoBytes a, struct LDKCOption_BlockHashZ b); +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); /** - * Frees any resources used by the C2Tuple_TxidCOption_BlockHashZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_TxidCOption_BlockHashZZ_free(struct LDKC2Tuple_TxidCOption_BlockHashZZ _res); +bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. + */ +void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res); +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -20668,11 +23893,6 @@ void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeF */ struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res); - /** * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. */ @@ -20700,30 +23920,30 @@ void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseError struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyErrorZ in the success state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_PublicKeyErrorZ in the error state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_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); +bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyErrorZ. + * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); +void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); /** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NodeIdDecodeErrorZ in the success state. @@ -20988,7 +24208,7 @@ struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone( /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); +void CVec_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); /** * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. @@ -21089,46 +24309,45 @@ bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraph void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ + * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); /** - * Constructs a new COption_CVec_NetAddressZZ containing nothing + * Constructs a new COption_CVec_SocketAddressZZ containing nothing */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); /** - * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state + * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state */ -void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); +void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); /** - * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` + * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentPreimageZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_some(struct LDKThirtyTwoBytes o); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_ok(struct LDKPendingHTLCInfo o); /** - * Constructs a new COption_PaymentPreimageZ containing nothing + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_none(void); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_err(struct LDKInboundHTLCErr e); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_PaymentPreimageZ_free(struct LDKCOption_PaymentPreimageZ _res); +bool CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR o); /** - * Creates a new COption_PaymentPreimageZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. */ -struct LDKCOption_PaymentPreimageZ COption_PaymentPreimageZ_clone(const struct LDKCOption_PaymentPreimageZ *NONNULL_PTR orig); +void CResult_PendingHTLCInfoInboundHTLCErrZ_free(struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -21224,93 +24443,88 @@ void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing a u16 - */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); - -/** - * Constructs a new COption_u16Z containing nothing + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u16Z COption_u16Z_none(void); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); /** - * Frees any resources associated with the u16, if we are in the Some state + * Creates a new C2Tuple_u64u16Z from the contained elements. */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); /** - * 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 C2Tuple_u64u16Z. */ -struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); /** - * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState + * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); /** - * Constructs a new COption_ChannelShutdownStateZ containing nothing + * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); /** - * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state */ -void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); +void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); /** - * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` + * Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentHashZ containing a crate::c_types::ThirtyTwoBytes + * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_some(struct LDKThirtyTwoBytes o); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); /** - * Constructs a new COption_PaymentHashZ containing nothing + * Constructs a new COption_ChannelShutdownStateZ containing nothing */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_none(void); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state */ -void COption_PaymentHashZ_free(struct LDKCOption_PaymentHashZ _res); +void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); /** - * Creates a new COption_PaymentHashZ which has the same data as `orig` + * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentHashZ COption_PaymentHashZ_clone(const struct LDKCOption_PaymentHashZ *NONNULL_PTR orig); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); /** - * Creates a new CResult__u832APIErrorZ in the success state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult__u832APIErrorZ in the error state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult__u832APIErrorZ. + * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. */ -void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); +void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); /** - * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -21370,218 +24584,265 @@ void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendF struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. + * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. */ -void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); +void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ 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_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ. + * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. */ -void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res); +void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); /** - * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig` + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. */ -void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); +void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. */ -void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); +void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_new(struct LDKThirtyTwoBytes a, struct LDKPublicKey b); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ. */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); +void C2Tuple_ThirtyTwoBytesPublicKeyZ_free(struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); +void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. + * Constructs a new COption_StrZ containing a crate::c_types::Str */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); +struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_StrZ containing nothing */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); +struct LDKCOption_StrZ COption_StrZ_none(void); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + * Frees any resources associated with the crate::c_types::Str, if we are in the Some state */ -void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); +void COption_StrZ_free(struct LDKCOption_StrZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` + * Creates a new COption_StrZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); +struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentSecretNoneZ in the success state. + * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); /** - * Creates a new CResult_PaymentSecretNoneZ in the error state. + * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); +bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentSecretNoneZ. + * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. */ -void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); +void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); /** - * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. */ -void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_ChainHashZZ containing a crate::c_types::derived::CVec_ChainHashZ + * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_some(struct LDKCVec_ChainHashZ o); +struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o); /** - * Constructs a new COption_CVec_ChainHashZZ containing nothing + * Constructs a new COption_OffersMessageZ containing nothing */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_none(void); +struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void); /** - * Frees any resources associated with the crate::c_types::derived::CVec_ChainHashZ, if we are in the Some state + * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state */ -void COption_CVec_ChainHashZZ_free(struct LDKCOption_CVec_ChainHashZZ _res); +void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res); /** - * Creates a new COption_CVec_ChainHashZZ which has the same data as `orig` + * Creates a new COption_OffersMessageZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_ChainHashZZ COption_CVec_ChainHashZZ_clone(const struct LDKCOption_CVec_ChainHashZZ *NONNULL_PTR orig); +struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements. + */ +struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_new(struct LDKOffersMessage a, struct LDKDestination b, struct LDKBlindedPath c); + +/** + * Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ. + */ +void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res); /** * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. @@ -21687,6 +24948,110 @@ void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHi */ struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_ok(struct LDKBlindedForward o); + +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedForwardDecodeErrorZ_is_ok(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. + */ +void CResult_BlindedForwardDecodeErrorZ_free(struct LDKCResult_BlindedForwardDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_clone(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_ok(struct LDKPendingHTLCRouting o); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. + */ +void CResult_PendingHTLCRoutingDecodeErrorZ_free(struct LDKCResult_PendingHTLCRoutingDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_ok(struct LDKPendingHTLCInfo o); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PendingHTLCInfoDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. + */ +void CResult_PendingHTLCInfoDecodeErrorZ_free(struct LDKCResult_PendingHTLCInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_ok(enum LDKBlindedFailure o); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedFailureDecodeErrorZ_is_ok(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. + */ +void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. */ @@ -21719,34 +25084,34 @@ struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateD void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); +void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); /** * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. @@ -21971,59 +25336,64 @@ struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(co * Creates a new tuple 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 LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C2Tuple_OutPointScriptZ. + * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. */ -void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); +void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -22055,17 +25425,17 @@ void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -22078,34 +25448,52 @@ void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. */ -struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. */ -void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); +void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); /** * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. @@ -22123,60 +25511,93 @@ void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o); +struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR orig); /** - * Constructs a new COption_OffersMessageZ containing nothing + * Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements. */ -struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void); +struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ C2Tuple_PublicKeyCVec_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKCVec_SocketAddressZ b); /** - * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state + * Frees any resources used by the C2Tuple_PublicKeyCVec_SocketAddressZZ. */ -void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res); +void C2Tuple_PublicKeyCVec_SocketAddressZZ_free(struct LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res); /** - * Creates a new COption_OffersMessageZ 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 LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig); +void CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents + * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing nothing + * Constructs a new COption_OnionMessageContentsZ containing nothing */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state */ -void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); +void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. + * Creates a new COption_OnionMessageContentsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); + +/** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. + */ +void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements. + */ +struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(struct LDKOnionMessageContents a, struct LDKDestination b, struct LDKBlindedPath c); + +/** + * Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ. + */ +void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res); /** * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type @@ -22193,6 +25614,12 @@ struct LDKCOption_TypeZ COption_TypeZ_none(void); */ void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +/** + * Creates a new COption_TypeZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig); + /** * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ @@ -22214,46 +25641,52 @@ bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_Typ void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); /** - * Constructs a new COption_NetAddressZ containing nothing + * Constructs a new COption_SocketAddressZ containing nothing */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); /** - * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state + * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new COption_SocketAddressZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig); +struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. + * Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements. */ -struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b); +struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_SocketAddressZ b); /** - * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ. + * Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ. */ -void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res); +void C2Tuple_PublicKeyCOption_SocketAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res); +void CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res); /** * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. @@ -22354,72 +25787,165 @@ bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); /** - * Constructs a new COption_KeyPairZ containing a crate::c_types::SecretKey + * Creates a new CResult_CVec_u8ZIOErrorZ in the success state. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_some(struct LDKSecretKey o); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); /** - * Constructs a new COption_KeyPairZ containing nothing + * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_none(void); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); /** - * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. */ -void COption_KeyPairZ_free(struct LDKCOption_KeyPairZ _res); +void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); /** - * Creates a new COption_KeyPairZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_KeyPairZ COption_KeyPairZ_clone(const struct LDKCOption_KeyPairZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_StrZ_free(struct LDKCVec_StrZ _res); /** - * Creates a new CResult_COption_KeyPairZNoneZ in the success state. + * Creates a new CResult_CVec_StrZIOErrorZ in the success state. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_ok(struct LDKCOption_KeyPairZ o); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o); /** - * Creates a new CResult_COption_KeyPairZNoneZ in the error state. + * Creates a new CResult_CVec_StrZIOErrorZ in the error state. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_err(void); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_KeyPairZNoneZ_is_ok(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR o); +bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_KeyPairZNoneZ. + * Frees any resources used by the CResult_CVec_StrZIOErrorZ. */ -void CResult_COption_KeyPairZNoneZ_free(struct LDKCResult_COption_KeyPairZNoneZ _res); +void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); /** - * Creates a new CResult_COption_KeyPairZNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_KeyPairZNoneZ CResult_COption_KeyPairZNoneZ_clone(const struct LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ScriptZ containing a crate::c_types::derived::CVec_u8Z + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_ScriptZ COption_ScriptZ_some(struct LDKCVec_u8Z o); +void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); /** - * Constructs a new COption_ScriptZ containing nothing + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. */ -struct LDKCOption_ScriptZ COption_ScriptZ_none(void); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); /** - * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. */ -void COption_ScriptZ_free(struct LDKCOption_ScriptZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); /** - * Creates a new COption_ScriptZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ScriptZ COption_ScriptZ_clone(const struct LDKCOption_ScriptZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_some(struct LDKSecretKey o); + +/** + * Constructs a new COption_SecretKeyZ containing nothing + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state + */ +void COption_SecretKeyZ_free(struct LDKCOption_SecretKeyZ _res); + +/** + * Creates a new COption_SecretKeyZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_SecretKeyZ COption_SecretKeyZ_clone(const struct LDKCOption_SecretKeyZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. + */ +void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig); /** * Constructs a new COption_NoneZ containing a @@ -22463,51 +25989,56 @@ void COption_i64Z_free(struct LDKCOption_i64Z _res); struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); /** - * Constructs a new COption_TxidZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new CResult_SocketAddressDecodeErrorZ in the success state. */ -struct LDKCOption_TxidZ COption_TxidZ_some(struct LDKThirtyTwoBytes o); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); /** - * Constructs a new COption_TxidZ containing nothing + * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. */ -struct LDKCOption_TxidZ COption_TxidZ_none(void); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Checks if the given object is currently in the success state + */ +bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. */ -void COption_TxidZ_free(struct LDKCOption_TxidZ _res); +void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); /** - * Creates a new COption_TxidZ which has the same data as `orig` + * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TxidZ COption_TxidZ_clone(const struct LDKCOption_TxidZ *NONNULL_PTR orig); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the success state. + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the error state. + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); +bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NetAddressDecodeErrorZ. + * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. */ -void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); +void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); /** - * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -22581,6 +26112,110 @@ void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2D */ struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_StfuDecodeErrorZ in the success state. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_ok(struct LDKStfu o); + +/** + * Creates a new CResult_StfuDecodeErrorZ in the error state. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_StfuDecodeErrorZ_is_ok(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_StfuDecodeErrorZ. + */ +void CResult_StfuDecodeErrorZ_free(struct LDKCResult_StfuDecodeErrorZ _res); + +/** + * Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_clone(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_ok(struct LDKSplice o); + +/** + * Creates a new CResult_SpliceDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceDecodeErrorZ_is_ok(const struct LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceDecodeErrorZ. + */ +void CResult_SpliceDecodeErrorZ_free(struct LDKCResult_SpliceDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceDecodeErrorZ CResult_SpliceDecodeErrorZ_clone(const struct LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_ok(struct LDKSpliceAck o); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceAckDecodeErrorZ_is_ok(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceAckDecodeErrorZ. + */ +void CResult_SpliceAckDecodeErrorZ_free(struct LDKCResult_SpliceAckDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_clone(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_ok(struct LDKSpliceLocked o); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceLockedDecodeErrorZ_is_ok(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. + */ +void CResult_SpliceLockedDecodeErrorZ_free(struct LDKCResult_SpliceLockedDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_clone(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_TxAddInputDecodeErrorZ in the success state. */ @@ -23257,6 +26892,32 @@ void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillH */ struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_OnionPacketDecodeErrorZ in the success state. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_ok(struct LDKOnionPacket o); + +/** + * Creates a new CResult_OnionPacketDecodeErrorZ in the error state. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionPacketDecodeErrorZ. + */ +void CResult_OnionPacketDecodeErrorZ_free(struct LDKCResult_OnionPacketDecodeErrorZ _res); + +/** + * Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_clone(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. */ @@ -23309,6 +26970,32 @@ void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeE */ struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_ok(struct LDKFinalOnionHopData o); + +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FinalOnionHopDataDecodeErrorZ_is_ok(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. + */ +void CResult_FinalOnionHopDataDecodeErrorZ_free(struct LDKCResult_FinalOnionHopDataDecodeErrorZ _res); + +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_clone(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_PingDecodeErrorZ in the success state. */ @@ -24051,30 +27738,51 @@ bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_Tru void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_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); +bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_usizeZ containing a usize + */ +struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); + +/** + * Constructs a new COption_usizeZ containing nothing + */ +struct LDKCOption_usizeZ COption_usizeZ_none(void); + +/** + * Frees any resources associated with the usize, if we are in the Some state + */ +void COption_usizeZ_free(struct LDKCOption_usizeZ _res); + +/** + * Creates a new COption_usizeZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); /** * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. @@ -24154,6 +27862,32 @@ void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDec */ struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o); + +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. + */ +void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure */ @@ -24322,46 +28056,30 @@ void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFail struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u128Z containing a crate::c_types::U128 + * Constructs a new COption_U128Z containing a crate::c_types::U128 */ -struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); +struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); /** - * Constructs a new COption_u128Z containing nothing + * Constructs a new COption_U128Z containing nothing */ -struct LDKCOption_u128Z COption_u128Z_none(void); +struct LDKCOption_U128Z COption_U128Z_none(void); /** * Frees any resources associated with the crate::c_types::U128, if we are in the Some state */ -void COption_u128Z_free(struct LDKCOption_u128Z _res); +void COption_U128Z_free(struct LDKCOption_U128Z _res); /** - * Creates a new COption_u128Z which has the same data as `orig` + * Creates a new COption_U128Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); +struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes - */ -struct LDKCOption_PaymentIdZ COption_PaymentIdZ_some(struct LDKThirtyTwoBytes o); - -/** - * Constructs a new COption_PaymentIdZ containing nothing - */ -struct LDKCOption_PaymentIdZ COption_PaymentIdZ_none(void); - -/** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state - */ -void COption_PaymentIdZ_free(struct LDKCOption_PaymentIdZ _res); - -/** - * Creates a new COption_PaymentIdZ 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 LDKCOption_PaymentIdZ COption_PaymentIdZ_clone(const struct LDKCOption_PaymentIdZ *NONNULL_PTR orig); +void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); /** * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason @@ -24431,31 +28149,6 @@ void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDec */ struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. - */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); - /** * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. */ @@ -24551,30 +28244,30 @@ struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11 void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -24659,11 +28352,6 @@ void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11Invo */ struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_AddressZ_free(struct LDKCVec_AddressZ _res); - /** * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ @@ -24873,82 +28561,140 @@ void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringD struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ 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 LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_clone(const struct LDKC2Tuple__u832u16Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple__u832u16Z from the contained elements. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_new(struct LDKThirtyTwoBytes a, uint16_t b); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Frees any resources used by the C2Tuple__u832u16Z. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +void C2Tuple__u832u16Z_free(struct LDKC2Tuple__u832u16Z _res); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. + */ +void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); + +/** + * Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); + +/** + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); +bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. + */ +struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(struct LDKThirtyTwoBytes a, struct LDKRecipientOnionFields b, struct LDKRouteParameters c); + +/** + * Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. + */ +void C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res); /** - * Creates a new CResult_NonePaymentErrorZ in the success state. + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o); /** - * Creates a new CResult_NonePaymentErrorZ in the error state. + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o); +bool CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentErrorZ. + * Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. */ -void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); +void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res); /** - * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_StringErrorZ in the success state. + * Creates a new CResult_StrSecp256k1ErrorZ in the success state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_ok(struct LDKStr o); /** - * Creates a new CResult_StringErrorZ in the error state. + * Creates a new CResult_StrSecp256k1ErrorZ in the error state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +bool CResult_StrSecp256k1ErrorZ_is_ok(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_StringErrorZ. + * Frees any resources used by the CResult_StrSecp256k1ErrorZ. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +void CResult_StrSecp256k1ErrorZ_free(struct LDKCResult_StrSecp256k1ErrorZ _res); /** - * Creates a new CResult_StringErrorZ which has the same data as `orig` + * Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); +struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_clone(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. @@ -24977,50 +28723,80 @@ void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OnionMessagePathNoneZ 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_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); +struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(const struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_OnionMessagePathNoneZ in the error state. + * Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements. */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); +struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(struct LDKPublicKey a, struct LDKOnionMessage b, struct LDKCOption_CVec_SocketAddressZZ c); + +/** + * Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ. + */ +void C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res); + +/** + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state. + */ +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o); + +/** + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state. + */ +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); +bool CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OnionMessagePathNoneZ. + * Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ. */ -void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); +void CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res); /** - * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PeeledOnionNoneZ in the success state. */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); + +/** + * Creates a new CResult_PeeledOnionNoneZ in the error state. + */ +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PeeledOnionNoneZ. + */ +void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * Creates a new CResult_SendSuccessSendErrorZ in the success state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_ok(struct LDKSendSuccess o); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * Creates a new CResult_SendSuccessSendErrorZ in the error state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); +bool CResult_SendSuccessSendErrorZ_is_ok(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * Frees any resources used by the CResult_SendSuccessSendErrorZ. */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void CResult_SendSuccessSendErrorZ_free(struct LDKCResult_SendSuccessSendErrorZ _res); /** * Creates a new CResult_BlindedPathNoneZ in the success state. @@ -25048,6 +28824,37 @@ void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); */ struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ o); + +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ. + */ +void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ForwardNodeZ_free(struct LDKCVec_ForwardNodeZ _res); + /** * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. */ @@ -25126,6 +28933,162 @@ void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeE */ struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state. + */ +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_ok(struct LDKDelayedPaymentBasepoint o); + +/** + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state. + */ +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ. + */ +void CResult_DelayedPaymentBasepointDecodeErrorZ_free(struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res); + +/** + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state. + */ +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_ok(struct LDKDelayedPaymentKey o); + +/** + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state. + */ +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ. + */ +void CResult_DelayedPaymentKeyDecodeErrorZ_free(struct LDKCResult_DelayedPaymentKeyDecodeErrorZ _res); + +/** + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state. + */ +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_ok(struct LDKHtlcBasepoint o); + +/** + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state. + */ +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HtlcBasepointDecodeErrorZ_is_ok(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ. + */ +void CResult_HtlcBasepointDecodeErrorZ_free(struct LDKCResult_HtlcBasepointDecodeErrorZ _res); + +/** + * Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_clone(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HtlcKeyDecodeErrorZ in the success state. + */ +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_ok(struct LDKHtlcKey o); + +/** + * Creates a new CResult_HtlcKeyDecodeErrorZ in the error state. + */ +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HtlcKeyDecodeErrorZ_is_ok(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HtlcKeyDecodeErrorZ. + */ +void CResult_HtlcKeyDecodeErrorZ_free(struct LDKCResult_HtlcKeyDecodeErrorZ _res); + +/** + * Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_clone(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state. + */ +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_ok(struct LDKRevocationBasepoint o); + +/** + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state. + */ +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RevocationBasepointDecodeErrorZ_is_ok(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ. + */ +void CResult_RevocationBasepointDecodeErrorZ_free(struct LDKCResult_RevocationBasepointDecodeErrorZ _res); + +/** + * Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_clone(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RevocationKeyDecodeErrorZ in the success state. + */ +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_ok(struct LDKRevocationKey o); + +/** + * Creates a new CResult_RevocationKeyDecodeErrorZ in the error state. + */ +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RevocationKeyDecodeErrorZ_is_ok(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RevocationKeyDecodeErrorZ. + */ +void CResult_RevocationKeyDecodeErrorZ_free(struct LDKCResult_RevocationKeyDecodeErrorZ _res); + +/** + * Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_clone(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR orig); + /** * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ @@ -25299,6 +29262,11 @@ void Hostname_free(struct LDKHostname this_obj); */ struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the Hostname. + */ +uint64_t Hostname_hash(const struct LDKHostname *NONNULL_PTR o); + /** * Checks if two Hostnames contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -25331,6 +29299,11 @@ void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj); */ struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited. + */ +uint64_t TransactionU16LenLimited_hash(const struct LDKTransactionU16LenLimited *NONNULL_PTR o); + /** * Checks if two TransactionU16LenLimiteds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -25364,12 +29337,12 @@ struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_ * 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]); +struct LDKCResult_StrSecp256k1ErrorZ 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); +struct LDKCResult_PublicKeySecp256k1ErrorZ 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, @@ -25382,11 +29355,92 @@ bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); */ struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature); +/** + * Calls the free function if one is set + */ +void KVStore_free(struct LDKKVStore this_ptr); + /** * Calls the free function if one is set */ void Persister_free(struct LDKPersister this_ptr); +/** + * Read previously persisted [`ChannelMonitor`]s from the store. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); + +/** + * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. + */ +void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); + +/** + * Constructs a new [`MonitorUpdatingPersister`]. + * + * The `maximum_pending_updates` parameter controls how many updates may be stored before a + * [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that + * consolidation will frequently occur with fewer updates than what you set here; this number + * is merely the maximum that may be stored. When setting this value, consider that for higher + * values of `maximum_pending_updates`: + * + * - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than + * [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every + * `maximum_pending_updates` [`ChannelMonitorUpdate`]s. + * - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in + * \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger, + * less frequent \"waves.\" + * - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run + * [`MonitorUpdatingPersister::cleanup_stale_updates`]. + */ +MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStore kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); + +/** + * Reads all stored channel monitors, along with any stored updates for them. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator); + +/** + * Read a single channel monitor, along with any stored updates for it. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + * + * For `monitor_key`, channel storage keys be the channel's transaction ID and index, or + * [`OutPoint`], with an underscore `_` between them. For example, given: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * The correct `monitor_key` would be: + * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Loading a large number of monitors will be faster if done in parallel. You can use this + * function to accomplish this. Take care to limit the number of parallel readers. + */ +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, struct LDKStr monitor_key); + +/** + * Cleans up stale updates for all monitors. + * + * This function works by first listing all monitors, and then for each of them, listing all + * updates. The updates that have an `update_id` less than or equal to than the stored monitor + * are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will + * be passed to [`KVStore::remove`]. + */ +MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); + +/** + * Constructs a new Persist which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is + */ +struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); + /** * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. */ @@ -25413,6 +29467,11 @@ struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString */ bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); +/** + * Generates a non-cryptographic 64-bit hash of the UntrustedString. + */ +uint64_t UntrustedString_hash(const struct LDKUntrustedString *NONNULL_PTR o); + /** * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read */ @@ -25568,6 +29627,40 @@ enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); */ void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); +/** + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKPublicKey Record_get_peer_id(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void Record_set_peer_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + */ +struct LDKCOption_ThirtyTwoBytesZ Record_get_channel_id(const struct LDKRecord *NONNULL_PTR this_ptr); + +/** + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + */ +void Record_set_channel_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); + /** * The message body. */ @@ -25608,6 +29701,13 @@ uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); */ void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); +/** + * Constructs a new Record given each field + * + * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKRecord Record_new(enum LDKLevel level_arg, struct LDKPublicKey peer_id_arg, struct LDKCOption_ThirtyTwoBytesZ channel_id_arg, struct LDKStr args_arg, struct LDKStr module_path_arg, struct LDKStr file_arg, uint32_t line_arg); + /** * Creates a copy of the Record */ @@ -26466,20 +30566,20 @@ void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_P * 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 + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] 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 + * [`NonAnchorChannelFee`] 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. + * [`ChannelCloseMinimum`] 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 + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); @@ -26492,20 +30592,20 @@ uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct L * 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 + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] 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 + * [`NonAnchorChannelFee`] 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. + * [`ChannelCloseMinimum`] 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 + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); @@ -26519,7 +30619,9 @@ void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelC * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call * [`forward_intercepted_htlc`] with less than the amount provided in * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. * * # Note * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is @@ -26552,7 +30654,9 @@ bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *N * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call * [`forward_intercepted_htlc`] with less than the amount provided in * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. * * # Note * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is @@ -26907,9 +31011,9 @@ enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); /** - * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus + * Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_unrecoverable_error(void); /** * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. @@ -26935,12 +31039,12 @@ void WatchedOutput_free(struct LDKWatchedOutput this_obj); /** * First block where the transaction output may have been spent. */ -struct LDKCOption_BlockHashZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** * First block where the transaction output may have been spent. */ -void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_BlockHashZ val); +void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * Outpoint identifying the transaction output. @@ -26955,7 +31059,7 @@ void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, s /** * Spending condition of the transaction output. */ -struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** * Spending condition of the transaction output. @@ -26965,7 +31069,7 @@ void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_p /** * Constructs a new WatchedOutput given each field */ -MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_BlockHashZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); +MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_ThirtyTwoBytesZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); /** * Creates a copy of the WatchedOutput @@ -26995,24 +31099,34 @@ void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); /** - * Utility method to constructs a new MempoolMinimum-variant ConfirmationTarget + * Utility method to constructs a new OnChainSweep-variant ConfirmationTarget */ -enum LDKConfirmationTarget ConfirmationTarget_mempool_minimum(void); +enum LDKConfirmationTarget ConfirmationTarget_on_chain_sweep(void); /** - * Utility method to constructs a new Background-variant ConfirmationTarget + * Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget */ -enum LDKConfirmationTarget ConfirmationTarget_background(void); +enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void); /** - * Utility method to constructs a new Normal-variant ConfirmationTarget + * Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget */ -enum LDKConfirmationTarget ConfirmationTarget_normal(void); +enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void); /** - * Utility method to constructs a new HighPriority-variant ConfirmationTarget + * Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget */ -enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); +enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void); + +/** + * Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void); + +/** + * Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget + */ +enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void); /** * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget. @@ -27256,20 +31370,15 @@ struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_ struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent + * Utility method to constructs a new HolderForceClosed-variant MonitorEvent */ -struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a); +struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a); /** * Utility method to constructs a new Completed-variant MonitorEvent */ struct LDKMonitorEvent MonitorEvent_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); - /** * Checks if two MonitorEvents contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -27326,32 +31435,32 @@ 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); +struct LDKBalance Balance_claimable_on_channel_close(uint64_t 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); +struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t 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, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); +struct LDKBalance Balance_contentious_claimable(uint64_t amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); /** * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance */ -struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash); +struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash); /** * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance */ -struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); +struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); /** * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance */ -struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis); +struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t amount_satoshis); /** * Checks if two Balances contain equal inner contents. @@ -27374,6 +31483,11 @@ MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance */ void ChannelMonitor_free(struct LDKChannelMonitor this_obj); +/** + * Creates a copy of the ChannelMonitor + */ +struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig); + /** * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read */ @@ -27385,7 +31499,7 @@ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_ * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this @@ -27396,20 +31510,20 @@ MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChanne /** * 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); +MUST_USE_RES struct LDKC2Tuple_OutPointCVec_u8ZZ 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); +MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ 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); +void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter, const struct LDKLogger *NONNULL_PTR logger); /** * Get the list of HTLCs who's status has been updated on chain. This should be called by @@ -27434,6 +31548,69 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m */ void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler); +/** + * Gets the counterparty's initial commitment transaction. The returned commitment + * transaction is unsigned. This is intended to be called during the initial persistence of + * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for + * watchtowers in the persistence pipeline to have enough data to form justice transactions. + * + * This is similar to [`Self::counterparty_commitment_txs_from_update`], except + * that for the initial commitment transaction, we don't have a corresponding update. + * + * This will only return `Some` for channel monitors that have been created after upgrading + * to LDK 0.0.117+. + * + * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKCommitmentTransaction ChannelMonitor_initial_counterparty_commitment_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets all of the counterparty commitment transactions provided by the given update. This + * may be empty if the update doesn't include any new counterparty commitments. Returned + * commitment transactions are unsigned. + * + * This is provided so that watchtower clients in the persistence pipeline are able to build + * justice transactions for each counterparty commitment upon each update. It's intended to be + * used within an implementation of [`Persist::update_persisted_channel`], which is provided + * with a monitor and an update. Once revoked, signing a justice transaction can be done using + * [`Self::sign_to_local_justice_tx`]. + * + * It is expected that a watchtower client may use this method to retrieve the latest counterparty + * commitment transaction(s), and then hold the necessary data until a later update in which + * the monitor has been updated with the corresponding revocation data, at which point the + * monitor can sign the justice transaction. + * + * This will only return a non-empty list for monitor updates that have been created after + * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which + * may have been created prior to upgrading. + * + * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel + */ +MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_commitment_txs_from_update(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); + +/** + * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make + * signing the justice transaction easier for implementors of + * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction + * signing the input at `input_idx`. This method will only produce a valid signature for + * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot + * be used for revoked HTLC outputs. + * + * `Value` is the value of the output being spent by the input at `input_idx`, committed + * in the BIP 143 signature. + * + * This method will only succeed if this monitor has received the revocation secret for the + * provided `commitment_number`. If a commitment number is provided that does not correspond + * to the commitment transaction being revoked, this will return a signed transaction, but + * the signature will not be valid. + * + * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output + * [`Persist`]: crate::chain::chainmonitor::Persist + */ +MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_justice_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input_idx, uint64_t value, uint64_t commitment_number); + /** * Gets the `node_id` of the counterparty for this channel. * @@ -27445,21 +31622,20 @@ void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNU MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(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. + * Used by [`ChannelManager`] deserialization to broadcast the latest holder state if its copy + * of the channel state was out-of-date. * * You may also use this to broadcast the latest local commitment transaction, either because - * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've - * fallen behind (i.e. we've received proof that our counterparty side knows a revocation - * secret we gave them that they shouldn't know). + * a monitor update failed or because we've fallen behind (i.e. we've received proof that our + * counterparty side knows a revocation secret we gave them that they shouldn't know). * * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't * close channel with their commitment transaction after a substantial amount of time. Best * may be to contact the other node operator out-of-band to coordinate other options available - * to you. In any-case, the choice is up to you. + * to you. * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ 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); @@ -27476,13 +31652,13 @@ MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commit * * [`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); +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, const struct LDKLogger *NONNULL_PTR 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); +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, const struct LDKLogger *NONNULL_PTR logger); /** * Processes transactions confirmed in a block with the given header and height, returning new @@ -27493,7 +31669,7 @@ void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_P * * [`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); +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, const struct LDKLogger *NONNULL_PTR logger); /** * Processes a transaction that was reorganized out of the chain. @@ -27503,7 +31679,7 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_conf * * [`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); +void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Updates the monitor with the current best chain tip, returning new outputs to watch. See @@ -27514,12 +31690,12 @@ void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONN * * [`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); +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, const struct LDKLogger *NONNULL_PTR logger); /** * Returns the set of txids that should be monitored for re-organization out of the chain. */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ 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 @@ -27534,7 +31710,29 @@ MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct * invoking this every 30 seconds, or lower if running in an environment with spotty * connections, like on mobile. */ -void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); + +/** + * Returns the descriptors for relevant outputs (i.e., those that we can spend) within the + * transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`] + * confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be + * returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)` + * confirmations. + * + * Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`] + * once they are no longer under reorg risk. This method serves as a way to retrieve these + * descriptors at a later time, either for historical purposes, or to replay any + * missed/unhandled descriptors. For the purpose of gathering historical records, if the + * channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns + * an empty set), you can retrieve all spendable outputs by providing all descendant spending + * transactions starting from the channel's funding transaction and going down three levels. + * + * `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any + * outputs which can be spent by us are found, at least one descriptor is returned. + * + * `confirmation_height` must be the height of the block in which `tx` was included in. + */ +MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spendable_outputs(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction tx, uint32_t confirmation_height); /** * Gets the balances in this channel which are either claimable by us if we were to @@ -27547,8 +31745,7 @@ void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *N * confirmations on the claim transaction. * * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of - * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted - * a revoked state. + * LDK prior to 0.0.111, not all or excess balances may be included. * * See [`Balance`] for additional details on the types of claimable balances which * may be returned here and their meanings. @@ -27556,9 +31753,9 @@ void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *N 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 + * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); /** * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. @@ -27622,25 +31819,327 @@ struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); */ struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +/** + * Frees any resources used by the InboundHTLCErr, if is_owned is set and inner is non-NULL. + */ +void InboundHTLCErr_free(struct LDKInboundHTLCErr this_obj); + +/** + * BOLT 4 error code. + */ +uint16_t InboundHTLCErr_get_err_code(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); + +/** + * BOLT 4 error code. + */ +void InboundHTLCErr_set_err_code(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Data attached to this error. + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z InboundHTLCErr_get_err_data(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); + +/** + * Data attached to this error. + */ +void InboundHTLCErr_set_err_data(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Error message text. + */ +struct LDKStr InboundHTLCErr_get_msg(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); + +/** + * Error message text. + */ +void InboundHTLCErr_set_msg(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * Constructs a new InboundHTLCErr given each field + */ +MUST_USE_RES struct LDKInboundHTLCErr InboundHTLCErr_new(uint16_t err_code_arg, struct LDKCVec_u8Z err_data_arg, struct LDKStr msg_arg); + +/** + * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information + * about the intended next-hop for the HTLC. + * + * This does all the relevant context-free checks that LDK requires for payment relay or + * acceptance. If the payment is to be received, and the amount matches the expected amount for + * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the + * channel, will generate an [`Event::PaymentClaimable`]. + * + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + */ +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKLogger *NONNULL_PTR logger, uint32_t cur_height, bool accept_mpp_keysend, bool allow_skimmed_fees); + +/** + * Frees any resources used by the PendingHTLCRouting + */ +void PendingHTLCRouting_free(struct LDKPendingHTLCRouting this_ptr); + +/** + * Creates a copy of the PendingHTLCRouting + */ +struct LDKPendingHTLCRouting PendingHTLCRouting_clone(const struct LDKPendingHTLCRouting *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Forward-variant PendingHTLCRouting + */ +struct LDKPendingHTLCRouting PendingHTLCRouting_forward(struct LDKOnionPacket onion_packet, uint64_t short_channel_id, struct LDKBlindedForward blinded); + +/** + * Utility method to constructs a new Receive-variant PendingHTLCRouting + */ +struct LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopData payment_data, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKThirtyTwoBytes phantom_shared_secret, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); + +/** + * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting + */ +struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); + +/** + * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL. + */ +void BlindedForward_free(struct LDKBlindedForward this_obj); + +/** + * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. + */ +struct LDKPublicKey BlindedForward_get_inbound_blinding_point(const struct LDKBlindedForward *NONNULL_PTR this_ptr); + +/** + * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. + */ +void BlindedForward_set_inbound_blinding_point(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. + */ +enum LDKBlindedFailure BlindedForward_get_failure(const struct LDKBlindedForward *NONNULL_PTR this_ptr); + +/** + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. + */ +void BlindedForward_set_failure(struct LDKBlindedForward *NONNULL_PTR this_ptr, enum LDKBlindedFailure val); + +/** + * Constructs a new BlindedForward given each field + */ +MUST_USE_RES struct LDKBlindedForward BlindedForward_new(struct LDKPublicKey inbound_blinding_point_arg, enum LDKBlindedFailure failure_arg); + +/** + * Creates a copy of the BlindedForward + */ +struct LDKBlindedForward BlindedForward_clone(const struct LDKBlindedForward *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the BlindedForward. + */ +uint64_t BlindedForward_hash(const struct LDKBlindedForward *NONNULL_PTR o); + +/** + * Checks if two BlindedForwards 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 BlindedForward_eq(const struct LDKBlindedForward *NONNULL_PTR a, const struct LDKBlindedForward *NONNULL_PTR b); + +/** + * Frees any resources used by the PendingHTLCInfo, if is_owned is set and inner is non-NULL. + */ +void PendingHTLCInfo_free(struct LDKPendingHTLCInfo this_obj); + +/** + * Further routing details based on whether the HTLC is being forwarded or received. + */ +struct LDKPendingHTLCRouting PendingHTLCInfo_get_routing(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); + +/** + * Further routing details based on whether the HTLC is being forwarded or received. + */ +void PendingHTLCInfo_set_routing(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKPendingHTLCRouting val); + +/** + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. + */ +const uint8_t (*PendingHTLCInfo_get_incoming_shared_secret(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; + +/** + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. + */ +void PendingHTLCInfo_set_incoming_shared_secret(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. + */ +const uint8_t (*PendingHTLCInfo_get_payment_hash(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; + +/** + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. + */ +void PendingHTLCInfo_set_payment_hash(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. + */ +struct LDKCOption_u64Z PendingHTLCInfo_get_incoming_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); + +/** + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. + */ +void PendingHTLCInfo_set_incoming_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. + * + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). + * + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. + */ +uint64_t PendingHTLCInfo_get_outgoing_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); + +/** + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. + * + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). + * + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. + */ +void PendingHTLCInfo_set_outgoing_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). + */ +uint32_t PendingHTLCInfo_get_outgoing_cltv_value(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); + +/** + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). + */ +void PendingHTLCInfo_set_outgoing_cltv_value(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. + */ +struct LDKCOption_u64Z PendingHTLCInfo_get_skimmed_fee_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); + +/** + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. + */ +void PendingHTLCInfo_set_skimmed_fee_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * Constructs a new PendingHTLCInfo given each field + */ +MUST_USE_RES struct LDKPendingHTLCInfo PendingHTLCInfo_new(struct LDKPendingHTLCRouting routing_arg, struct LDKThirtyTwoBytes incoming_shared_secret_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u64Z incoming_amt_msat_arg, uint64_t outgoing_amt_msat_arg, uint32_t outgoing_cltv_value_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg); + +/** + * Creates a copy of the PendingHTLCInfo + */ +struct LDKPendingHTLCInfo PendingHTLCInfo_clone(const struct LDKPendingHTLCInfo *NONNULL_PTR orig); + +/** + * Creates a copy of the BlindedFailure + */ +enum LDKBlindedFailure BlindedFailure_clone(const enum LDKBlindedFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new FromIntroductionNode-variant BlindedFailure + */ +enum LDKBlindedFailure BlindedFailure_from_introduction_node(void); + +/** + * Utility method to constructs a new FromBlindedNode-variant BlindedFailure + */ +enum LDKBlindedFailure BlindedFailure_from_blinded_node(void); + +/** + * Generates a non-cryptographic 64-bit hash of the BlindedFailure. + */ +uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o); + +/** + * Checks if two BlindedFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b); + +/** + * Frees any resources used by the FailureCode + */ +void FailureCode_free(struct LDKFailureCode this_ptr); + /** * Creates a copy of the FailureCode */ -enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig); +struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); /** * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode */ -enum LDKFailureCode FailureCode_temporary_node_failure(void); +struct LDKFailureCode FailureCode_temporary_node_failure(void); /** * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode */ -enum LDKFailureCode FailureCode_required_node_feature_missing(void); +struct LDKFailureCode FailureCode_required_node_feature_missing(void); /** * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode */ -enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); +struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); + +/** + * Utility method to constructs a new InvalidOnionPayload-variant FailureCode + */ +struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); /** * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. @@ -27828,6 +32327,8 @@ void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounter /** * Constructs a new ChannelCounterparty given each field + * + * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); @@ -28032,16 +32533,28 @@ struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const s void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); @@ -28361,6 +32874,10 @@ void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelDetails given each field + * + * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg); @@ -28435,20 +32952,25 @@ void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); */ struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); +/** + * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + */ +struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); + /** * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKCOption_PaymentHashZ payment_hash); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); /** * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); /** * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. @@ -28543,6 +33065,9 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * connection is available, the outbound `open_channel` message may fail to send, resulting in * the channel eventually being silently forgotten (dropped on reload). * + * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the + * channel. Otherwise, a random one will be generated for you. + * * Returns the new Channel's temporary `channel_id`. This ID will appear as * [`Event::FundingGenerationReady::temporary_channel_id`] and in * [`ChannelDetails::channel_id`] until after @@ -28556,7 +33081,7 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKCOption_ThirtyTwoBytesZ temporary_channel_id, struct LDKUserConfig override_config); /** * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for @@ -28596,11 +33121,11 @@ MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_pay * 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 we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate. * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`Background`] feerate or the feerate which + * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which * would appear on a force-closure transaction, whichever is lower. We will allow our * counterparty to pay as much fee as they'd like, however. * @@ -28612,8 +33137,8 @@ MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_pay * channel. * * [`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 + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); @@ -28627,8 +33152,8 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const * 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). + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). * * If our counterparty is the channel initiator, we will refuse to accept a channel closure * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which * will appear on a force-closure transaction, whichever is lower). @@ -28646,8 +33171,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const * channel. * * [`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 + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown * * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -28721,9 +33245,8 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * In general, a path may raise: * * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, * node public key) is specified. - * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates - * (including due to previous monitor update failure or new permanent monitor update - * failure). + * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available as it has been + * closed, doesn't exist, or the peer is currently disconnected. * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the * relevant updates. * @@ -28747,10 +33270,12 @@ MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payme MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Signals that no further retries for the given payment should occur. Useful if you have a + * Signals that no further attempts for the given payment should occur. Useful if you have a * pending outbound payment with retries remaining, but wish to stop retrying the payment before * retries are exhausted. * + * # Event Generation + * * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon * as there are no remaining pending HTLCs for this payment. * @@ -28758,11 +33283,20 @@ MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_pay * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * - * If an [`Event::PaymentFailed`] event is generated and we restart without this - * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated. + * # Requested Invoices * - * [`Event::PaymentFailed`]: events::Event::PaymentFailed - * [`Event::PaymentSent`]: events::Event::PaymentSent + * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning + * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`] + * and prevent any attempts at paying it once received. The other events may only be generated + * once the invoice has been received. + * + * # Restart Behavior + * + * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for + * [`Event::InvoiceRequestFailed`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); @@ -28781,7 +33315,7 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * * [`send_payment`]: Self::send_payment */ -MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route @@ -28792,14 +33326,40 @@ MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_sen * * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend */ -MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** * Send a payment that is probing the given route for liquidity. We calculate the * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows * us to easily discern them from real payments. */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); + +/** + * Sends payment probes over all paths of a route that would be used to pay the given + * amount to the given `node_id`. + * + * See [`ChannelManager::send_preflight_probes`] for more information. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); + +/** + * Sends payment probes over all paths of a route that would be used to pay a route found + * according to the given [`RouteParameters`]. + * + * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting + * the actual payment. Note this is only useful if there likely is sufficient time for the + * probe to settle before sending out the actual payment, e.g., when waiting for user + * confirmation in a wallet UI. + * + * Otherwise, there is a chance the probe could take up some liquidity needed to complete the + * actual payment. Users should therefore be cautious and might avoid sending probes if + * liquidity is scarce and/or they don't expect the probe to return before they send the + * payment. To mitigate this issue, channels with available liquidity less than the required + * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight + * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. + */ +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); /** * Call this upon creation of a funding transaction for the given channel. @@ -28835,6 +33395,20 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ */ 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 LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); +/** + * Call this upon creation of a batch funding transaction for the given channels. + * + * Return values are identical to [`Self::funding_transaction_generated`], respective to + * each individual channel and transaction output. + * + * Do NOT broadcast the funding transaction yourself. This batch funding transaction + * will only be broadcast when we have safely received and persisted the counterparty's + * signature for each channel. + * + * If there is an error, all channels in the batch are to be considered closed. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); + /** * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. * @@ -28945,6 +33519,10 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * with the current [`ChannelConfig`]. * * Removing peers which have disconnected but and no longer have any channels. * * Force-closing and removing channels which have not completed establishment in a timely manner. + * * Forgetting about stale outbound payments, either those that have already been fulfilled + * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. + * The latter is determined using the system clock in `std` and the highest seen block time + * minus two hours in `no-std`. * * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate * estimate fetches. @@ -28977,7 +33555,7 @@ void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_ * * See [`FailureCode`] for valid failure codes. */ -void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); /** * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any @@ -28993,15 +33571,33 @@ void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManag * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * + * This function will fail the payment if it has custom TLVs with even type numbers, as we + * will assume they are unknown. If you intend to accept even custom TLVs, you should use + * [`claim_funds_with_known_custom_tlvs`]. + * * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed * [`process_pending_events`]: EventsProvider::process_pending_events * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs */ void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +/** + * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with + * even type numbers. + * + * # Note + * + * You MUST check you've understood all even TLVs before using this to + * claim, otherwise you may unintentionally agree to some protocol you do not understand. + * + * [`claim_funds`]: Self::claim_funds + */ +void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); + /** * Gets the node_id held by this ChannelManager */ @@ -29049,6 +33645,87 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); +/** + * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and + * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual + * [`Bolt12Invoice`] once it is received. + * + * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by + * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. + * The optional parameters are used in the builder, if `Some`: + * - `quantity` for [`InvoiceRequest::quantity`] which must be set if + * [`Offer::expects_quantity`] is `true`. + * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and + * - `payer_note` for [`InvoiceRequest::payer_note`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`Event::InvoiceRequestFailed`]. + * + * # Privacy + * + * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`] + * as the introduction node and a derived payer id for payer privacy. As such, currently, the + * node must be announced. Otherwise, there is no way to find a path to the introduction node + * in order to send the [`Bolt12Invoice`]. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Offer::paths`] or to + * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding + * [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - the provided parameters are invalid for the offer, + * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice + * request. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note + * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + */ +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); + +/** + * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion + * message. + * + * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a + * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding + * [`PaymentPreimage`]. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Refund::paths`] or to + * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each + * node meeting the aforementioned criteria, but there's no guarantee that they will be + * received and no retries will be made. + * + * # Errors + * + * Errors if the parameterized [`Router`] is unable to create a blinded payment path or reply + * path for the invoice. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); + /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing * to pay us. @@ -29083,7 +33760,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * [`PaymentPurpose::InvoicePayment::payment_preimage`]: events::PaymentPurpose::InvoicePayment::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -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, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is @@ -29133,7 +33810,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelMan * [`create_inbound_payment`]: Self::create_inbound_payment * [`PaymentClaimable`]: events::Event::PaymentClaimable */ -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, struct LDKCOption_u16Z min_final_cltv_expiry); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); /** * Gets an LDK-generated payment preimage from a payment hash and payment secret that were @@ -29141,7 +33818,7 @@ MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_ * * [`create_inbound_payment`]: Self::create_inbound_payment */ -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); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids @@ -29199,13 +33876,21 @@ struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNUL struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted. + * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or + * may have events that need processing. + * + * In order to check if this [`ChannelManager`] needs persisting, call + * [`Self::get_and_clear_needs_persistence`]. * * Note that callbacks registered on the [`Future`] MUST NOT call back into this * [`ChannelManager`] and should instead register actions to be taken later. - * */ -MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Returns true if this [`ChannelManager`] needs to be persisted. + */ +MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Gets the latest best block which was connected either via the [`chain::Listen`] or @@ -29214,25 +33899,25 @@ MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * Fetches the set of [`NodeFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by + * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by + * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * Fetches the set of [`InitFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -29244,7 +33929,13 @@ MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LD struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + */ +struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Fetches the set of [`InitFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); @@ -29289,6 +33980,46 @@ struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NO */ struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); +/** + * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read + */ +struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); + +/** + * Read a BlindedForward from a byte array, created by BlindedForward_write + */ +struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); + +/** + * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read + */ +struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); + +/** + * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); + +/** + * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read + */ +struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); + +/** + * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); + +/** + * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read + */ +struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); + +/** + * Read a BlindedFailure from a byte array, created by BlindedFailure_write + */ +struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); + /** * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ @@ -29437,9 +34168,308 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); /** - * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write + * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); + +/** + * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. + */ +void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); + +struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); + +void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new DelayedPaymentBasepoint given each field + */ +MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); + +/** + * Checks if two DelayedPaymentBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); + +/** + * Creates a copy of the DelayedPaymentBasepoint + */ +struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. + */ +uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); + +/** + * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read + */ +struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); + +/** + * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write + */ +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. + */ +void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); + +struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); + +void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new DelayedPaymentKey given each field + */ +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); + +/** + * Checks if two DelayedPaymentKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); + +/** + * Creates a copy of the DelayedPaymentKey + */ +struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); + +/** + *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + */ +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); + +/** + *Build a delayedpubkey directly from an already-derived private key + */ +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); + +/** + * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read + */ +struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); + +/** + * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write + */ +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. + */ +void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); + +struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); + +void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new HtlcBasepoint given each field + */ +MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); + +/** + * Checks if two HtlcBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); + +/** + * Creates a copy of the HtlcBasepoint + */ +struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. + */ +uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); + +/** + * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read + */ +struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); + +/** + * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write + */ +struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. + */ +void HtlcKey_free(struct LDKHtlcKey this_obj); + +struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); + +void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new HtlcKey given each field + */ +MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); + +/** + * Checks if two HtlcKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); + +/** + * Creates a copy of the HtlcKey + */ +struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); + +/** + *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + */ +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); + +/** + *Build a htlcpubkey directly from an already-derived private key + */ +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); + +/** + * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read + */ +struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); + +/** + * Read a HtlcKey from a byte array, created by HtlcKey_write + */ +struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. + */ +void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); + +struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); + +void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new RevocationBasepoint given each field + */ +MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); + +/** + * Checks if two RevocationBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); + +/** + * Creates a copy of the RevocationBasepoint + */ +struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. + */ +uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); + +/** + * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read + */ +struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); + +/** + * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write + */ +struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. + */ +void RevocationKey_free(struct LDKRevocationKey this_obj); + +struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); + +void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new RevocationKey given each field + */ +MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); + +/** + * Checks if two RevocationKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); + +/** + * Creates a copy of the RevocationKey + */ +struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the RevocationKey. + */ +uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); + +/** + * Derives a per-commitment-transaction revocation public key from one party's per-commitment + * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of + * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public + * key instead of private keys. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). + * + * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key + */ +MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); + +/** + * Get inner Public Key + */ +MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); + +/** + * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read + */ +struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); + +/** + * Read a RevocationKey from a byte array, created by RevocationKey_write + */ +struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); /** * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. @@ -29470,7 +34500,7 @@ MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material) * [phantom node payments]: crate::sign::PhantomKeysManager * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], @@ -29484,7 +34514,7 @@ struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDK * * [phantom node payments]: crate::sign::PhantomKeysManager */ -struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_ThirtyTwoBytesNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Frees any resources used by the DecodeError @@ -29531,6 +34561,11 @@ struct LDKDecodeError DecodeError_io(enum LDKIOError a); */ struct LDKDecodeError DecodeError_unsupported_compression(void); +/** + * Generates a non-cryptographic 64-bit hash of the DecodeError. + */ +uint64_t DecodeError_hash(const struct LDKDecodeError *NONNULL_PTR o); + /** * Checks if two DecodeErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29559,14 +34594,14 @@ void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatu * * Returns a copy of the field. */ -struct LDKCOption_CVec_ChainHashZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); /** * Indicates chains the sender is interested in. * * If there are no common chains, the connection will be closed. */ -void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ChainHashZZ val); +void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); /** * The receipient's network address. @@ -29576,7 +34611,7 @@ void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_C * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ -struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); /** * The receipient's network address. @@ -29586,18 +34621,23 @@ struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKIn * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing * the new address. */ -void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val); +void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** * Constructs a new Init given each field */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ChainHashZZ networks_arg, struct LDKCOption_NetAddressZ remote_network_address_arg); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); /** * Creates a copy of the Init */ struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the Init. + */ +uint64_t Init_hash(const struct LDKInit *NONNULL_PTR o); + /** * Checks if two Inits contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29654,6 +34694,11 @@ MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes ch */ struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ErrorMessage. + */ +uint64_t ErrorMessage_hash(const struct LDKErrorMessage *NONNULL_PTR o); + /** * Checks if two ErrorMessages contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29708,6 +34753,11 @@ MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoByte */ struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the WarningMessage. + */ +uint64_t WarningMessage_hash(const struct LDKWarningMessage *NONNULL_PTR o); + /** * Checks if two WarningMessages contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29754,6 +34804,11 @@ MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg */ struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the Ping. + */ +uint64_t Ping_hash(const struct LDKPing *NONNULL_PTR o); + /** * Checks if two Pings contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29790,6 +34845,11 @@ MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); */ struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the Pong. + */ +uint64_t Pong_hash(const struct LDKPong *NONNULL_PTR o); + /** * Checks if two Pongs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -29989,12 +35049,12 @@ void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, /** * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close */ -struct LDKCOption_ScriptZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close */ -void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent @@ -30018,14 +35078,21 @@ void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, s /** * Constructs a new OpenChannel given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** * Creates a copy of the OpenChannel */ struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the OpenChannel. + */ +uint64_t OpenChannel_hash(const struct LDKOpenChannel *NONNULL_PTR o); + /** * Checks if two OpenChannels contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30238,13 +35305,13 @@ void OpenChannelV2_set_channel_flags(struct LDKOpenChannelV2 *NONNULL_PTR this_p * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we * collaboratively close */ -struct LDKCOption_ScriptZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we * collaboratively close */ -void OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. If none is set, we derive the channel @@ -30276,14 +35343,21 @@ void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL /** * Constructs a new OpenChannelV2 given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** * Creates a copy of the OpenChannelV2 */ struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the OpenChannelV2. + */ +uint64_t OpenChannelV2_hash(const struct LDKOpenChannelV2 *NONNULL_PTR o); + /** * Checks if two OpenChannelV2s contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30439,12 +35513,12 @@ void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNU /** * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close */ -struct LDKCOption_ScriptZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close */ -void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. @@ -30470,14 +35544,21 @@ void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_pt /** * Constructs a new AcceptChannel given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, 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, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** * Creates a copy of the AcceptChannel */ struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the AcceptChannel. + */ +uint64_t AcceptChannel_hash(const struct LDKAcceptChannel *NONNULL_PTR o); + /** * Checks if two AcceptChannels contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30650,13 +35731,13 @@ void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 * * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we * collaboratively close */ -struct LDKCOption_ScriptZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCOption_CVec_u8ZZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we * collaboratively close */ -void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_ScriptZ val); +void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** * The channel type that this channel will represent. If none is set, we derive the channel @@ -30692,14 +35773,21 @@ void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NON /** * Constructs a new AcceptChannelV2 given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_ScriptZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** * Creates a copy of the AcceptChannelV2 */ struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2. + */ +uint64_t AcceptChannelV2_hash(const struct LDKAcceptChannelV2 *NONNULL_PTR o); + /** * Checks if two AcceptChannelV2s contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30745,23 +35833,28 @@ void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_P /** * The signature of the channel initiator (funder) on the initial commitment transaction */ -struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** * The signature of the channel initiator (funder) on the initial commitment transaction */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new FundingCreated given each field */ -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); +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 LDKECDSASignature signature_arg); /** * Creates a copy of the FundingCreated */ struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the FundingCreated. + */ +uint64_t FundingCreated_hash(const struct LDKFundingCreated *NONNULL_PTR o); + /** * Checks if two FundingCreateds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30787,23 +35880,28 @@ void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, /** * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new FundingSigned given each field */ -MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg); /** * Creates a copy of the FundingSigned */ struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the FundingSigned. + */ +uint64_t FundingSigned_hash(const struct LDKFundingSigned *NONNULL_PTR o); + /** * Checks if two FundingSigneds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30862,6 +35960,11 @@ MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes ch */ struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelReady. + */ +uint64_t ChannelReady_hash(const struct LDKChannelReady *NONNULL_PTR o); + /** * Checks if two ChannelReadys contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30869,6 +35972,228 @@ struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_ */ bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); +/** + * Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL. + */ +void Stfu_free(struct LDKStfu this_obj); + +/** + * The channel ID where quiescence is intended + */ +const uint8_t (*Stfu_get_channel_id(const struct LDKStfu *NONNULL_PTR this_ptr))[32]; + +/** + * The channel ID where quiescence is intended + */ +void Stfu_set_channel_id(struct LDKStfu *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Initiator flag, 1 if initiating, 0 if replying to an stfu. + */ +uint8_t Stfu_get_initiator(const struct LDKStfu *NONNULL_PTR this_ptr); + +/** + * Initiator flag, 1 if initiating, 0 if replying to an stfu. + */ +void Stfu_set_initiator(struct LDKStfu *NONNULL_PTR this_ptr, uint8_t val); + +/** + * Constructs a new Stfu given each field + */ +MUST_USE_RES struct LDKStfu Stfu_new(struct LDKThirtyTwoBytes channel_id_arg, uint8_t initiator_arg); + +/** + * Creates a copy of the Stfu + */ +struct LDKStfu Stfu_clone(const struct LDKStfu *NONNULL_PTR orig); + +/** + * Checks if two Stfus 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 Stfu_eq(const struct LDKStfu *NONNULL_PTR a, const struct LDKStfu *NONNULL_PTR b); + +/** + * Frees any resources used by the Splice, if is_owned is set and inner is non-NULL. + */ +void Splice_free(struct LDKSplice this_obj); + +/** + * The channel ID where splicing is intended + */ +const uint8_t (*Splice_get_channel_id(const struct LDKSplice *NONNULL_PTR this_ptr))[32]; + +/** + * The channel ID where splicing is intended + */ +void Splice_set_channel_id(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The genesis hash of the blockchain where the channel is intended to be spliced + */ +const uint8_t (*Splice_get_chain_hash(const struct LDKSplice *NONNULL_PTR this_ptr))[32]; + +/** + * The genesis hash of the blockchain where the channel is intended to be spliced + */ +void Splice_set_chain_hash(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The intended change in channel capacity: the amount to be added (positive value) + * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel. + */ +int64_t Splice_get_relative_satoshis(const struct LDKSplice *NONNULL_PTR this_ptr); + +/** + * The intended change in channel capacity: the amount to be added (positive value) + * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel. + */ +void Splice_set_relative_satoshis(struct LDKSplice *NONNULL_PTR this_ptr, int64_t val); + +/** + * The feerate for the new funding transaction, set by the splice initiator + */ +uint32_t Splice_get_funding_feerate_perkw(const struct LDKSplice *NONNULL_PTR this_ptr); + +/** + * The feerate for the new funding transaction, set by the splice initiator + */ +void Splice_set_funding_feerate_perkw(struct LDKSplice *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The locktime for the new funding transaction + */ +uint32_t Splice_get_locktime(const struct LDKSplice *NONNULL_PTR this_ptr); + +/** + * The locktime for the new funding transaction + */ +void Splice_set_locktime(struct LDKSplice *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The key of the sender (splice initiator) controlling the new funding transaction + */ +struct LDKPublicKey Splice_get_funding_pubkey(const struct LDKSplice *NONNULL_PTR this_ptr); + +/** + * The key of the sender (splice initiator) controlling the new funding transaction + */ +void Splice_set_funding_pubkey(struct LDKSplice *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new Splice given each field + */ +MUST_USE_RES struct LDKSplice Splice_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes chain_hash_arg, int64_t relative_satoshis_arg, uint32_t funding_feerate_perkw_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg); + +/** + * Creates a copy of the Splice + */ +struct LDKSplice Splice_clone(const struct LDKSplice *NONNULL_PTR orig); + +/** + * Checks if two Splices 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 Splice_eq(const struct LDKSplice *NONNULL_PTR a, const struct LDKSplice *NONNULL_PTR b); + +/** + * Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL. + */ +void SpliceAck_free(struct LDKSpliceAck this_obj); + +/** + * The channel ID where splicing is intended + */ +const uint8_t (*SpliceAck_get_channel_id(const struct LDKSpliceAck *NONNULL_PTR this_ptr))[32]; + +/** + * The channel ID where splicing is intended + */ +void SpliceAck_set_channel_id(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The genesis hash of the blockchain where the channel is intended to be spliced + */ +const uint8_t (*SpliceAck_get_chain_hash(const struct LDKSpliceAck *NONNULL_PTR this_ptr))[32]; + +/** + * The genesis hash of the blockchain where the channel is intended to be spliced + */ +void SpliceAck_set_chain_hash(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The intended change in channel capacity: the amount to be added (positive value) + * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel. + */ +int64_t SpliceAck_get_relative_satoshis(const struct LDKSpliceAck *NONNULL_PTR this_ptr); + +/** + * The intended change in channel capacity: the amount to be added (positive value) + * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel. + */ +void SpliceAck_set_relative_satoshis(struct LDKSpliceAck *NONNULL_PTR this_ptr, int64_t val); + +/** + * The key of the sender (splice acceptor) controlling the new funding transaction + */ +struct LDKPublicKey SpliceAck_get_funding_pubkey(const struct LDKSpliceAck *NONNULL_PTR this_ptr); + +/** + * The key of the sender (splice acceptor) controlling the new funding transaction + */ +void SpliceAck_set_funding_pubkey(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new SpliceAck given each field + */ +MUST_USE_RES struct LDKSpliceAck SpliceAck_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes chain_hash_arg, int64_t relative_satoshis_arg, struct LDKPublicKey funding_pubkey_arg); + +/** + * Creates a copy of the SpliceAck + */ +struct LDKSpliceAck SpliceAck_clone(const struct LDKSpliceAck *NONNULL_PTR orig); + +/** + * Checks if two SpliceAcks 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 SpliceAck_eq(const struct LDKSpliceAck *NONNULL_PTR a, const struct LDKSpliceAck *NONNULL_PTR b); + +/** + * Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL. + */ +void SpliceLocked_free(struct LDKSpliceLocked this_obj); + +/** + * The channel ID + */ +const uint8_t (*SpliceLocked_get_channel_id(const struct LDKSpliceLocked *NONNULL_PTR this_ptr))[32]; + +/** + * The channel ID + */ +void SpliceLocked_set_channel_id(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constructs a new SpliceLocked given each field + */ +MUST_USE_RES struct LDKSpliceLocked SpliceLocked_new(struct LDKThirtyTwoBytes channel_id_arg); + +/** + * Creates a copy of the SpliceLocked + */ +struct LDKSpliceLocked SpliceLocked_clone(const struct LDKSpliceLocked *NONNULL_PTR orig); + +/** + * Checks if two SpliceLockeds 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 SpliceLocked_eq(const struct LDKSpliceLocked *NONNULL_PTR a, const struct LDKSpliceLocked *NONNULL_PTR b); + /** * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL. */ @@ -30938,6 +36263,11 @@ MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKThirtyTwoBytes channe */ struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxAddInput. + */ +uint64_t TxAddInput_hash(const struct LDKTxAddInput *NONNULL_PTR o); + /** * Checks if two TxAddInputs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30985,7 +36315,7 @@ void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t /** * The scriptPubKey for the output */ -struct LDKu8slice TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** * The scriptPubKey for the output @@ -31002,6 +36332,11 @@ MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKThirtyTwoBytes chan */ struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxAddOutput. + */ +uint64_t TxAddOutput_hash(const struct LDKTxAddOutput *NONNULL_PTR o); + /** * Checks if two TxAddOutputs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31044,6 +36379,11 @@ MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKThirtyTwoBytes */ struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxRemoveInput. + */ +uint64_t TxRemoveInput_hash(const struct LDKTxRemoveInput *NONNULL_PTR o); + /** * Checks if two TxRemoveInputs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31086,6 +36426,11 @@ MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKThirtyTwoByte */ struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxRemoveOutput. + */ +uint64_t TxRemoveOutput_hash(const struct LDKTxRemoveOutput *NONNULL_PTR o); + /** * Checks if two TxRemoveOutputs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31118,6 +36463,11 @@ MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKThirtyTwoBytes channe */ struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxComplete. + */ +uint64_t TxComplete_hash(const struct LDKTxComplete *NONNULL_PTR o); + /** * Checks if two TxCompletes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31172,6 +36522,11 @@ MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKThirtyTwoBytes ch */ struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxSignatures. + */ +uint64_t TxSignatures_hash(const struct LDKTxSignatures *NONNULL_PTR o); + /** * Checks if two TxSignaturess contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31236,6 +36591,11 @@ MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKThirtyTwoBytes channel_ */ struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxInitRbf. + */ +uint64_t TxInitRbf_hash(const struct LDKTxInitRbf *NONNULL_PTR o); + /** * Checks if two TxInitRbfs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31280,6 +36640,11 @@ MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKThirtyTwoBytes channel_id */ struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxAckRbf. + */ +uint64_t TxAckRbf_hash(const struct LDKTxAckRbf *NONNULL_PTR o); + /** * Checks if two TxAckRbfs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31324,6 +36689,11 @@ MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKThirtyTwoBytes channel_id_a */ struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the TxAbort. + */ +uint64_t TxAbort_hash(const struct LDKTxAbort *NONNULL_PTR o); + /** * Checks if two TxAborts contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31351,7 +36721,7 @@ void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LD * * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** * The destination of this peer's funds on closing. @@ -31370,6 +36740,11 @@ MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id */ struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the Shutdown. + */ +uint64_t Shutdown_hash(const struct LDKShutdown *NONNULL_PTR o); + /** * Checks if two Shutdowns contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31416,6 +36791,11 @@ MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t */ struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ClosingSignedFeeRange. + */ +uint64_t ClosingSignedFeeRange_hash(const struct LDKClosingSignedFeeRange *NONNULL_PTR o); + /** * Checks if two ClosingSignedFeeRanges contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31451,12 +36831,12 @@ void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_pt /** * A signature on the closing transaction */ -struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** * A signature on the closing transaction */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The minimum and maximum fees which the sender is willing to accept, provided only by new @@ -31476,14 +36856,21 @@ void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, /** * Constructs a new ClosingSigned given each field + * + * Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** * Creates a copy of the ClosingSigned */ struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ClosingSigned. + */ +uint64_t ClosingSigned_hash(const struct LDKClosingSigned *NONNULL_PTR o); + /** * Checks if two ClosingSigneds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31562,11 +36949,49 @@ struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdate */ void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +/** + * The onion routing packet with encrypted data for the next hop. + */ +struct LDKOnionPacket UpdateAddHTLC_get_onion_routing_packet(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); + +/** + * The onion routing packet with encrypted data for the next hop. + */ +void UpdateAddHTLC_set_onion_routing_packet(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKOnionPacket val); + +/** + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKPublicKey UpdateAddHTLC_get_blinding_point(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); + +/** + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void UpdateAddHTLC_set_blinding_point(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new UpdateAddHTLC given each field + * + * Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKUpdateAddHTLC UpdateAddHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, uint64_t amount_msat_arg, struct LDKThirtyTwoBytes payment_hash_arg, uint32_t cltv_expiry_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, struct LDKOnionPacket onion_routing_packet_arg, struct LDKPublicKey blinding_point_arg); + /** * Creates a copy of the UpdateAddHTLC */ struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. + */ +uint64_t UpdateAddHTLC_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR o); + /** * Checks if two UpdateAddHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31589,11 +37014,31 @@ struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage */ void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * The full onion packet including hop data, pubkey, and hmac + */ +struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); + +/** + * The full onion packet including hop data, pubkey, and hmac + */ +void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); + +/** + * Constructs a new OnionMessage given each field + */ +MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); + /** * Creates a copy of the OnionMessage */ struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the OnionMessage. + */ +uint64_t OnionMessage_hash(const struct LDKOnionMessage *NONNULL_PTR o); + /** * Checks if two OnionMessages contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31646,6 +37091,11 @@ MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyT */ struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. + */ +uint64_t UpdateFulfillHTLC_hash(const struct LDKUpdateFulfillHTLC *NONNULL_PTR o); + /** * Checks if two UpdateFulfillHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31683,6 +37133,11 @@ void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, */ struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. + */ +uint64_t UpdateFailHTLC_hash(const struct LDKUpdateFailHTLC *NONNULL_PTR o); + /** * Checks if two UpdateFailHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31730,6 +37185,11 @@ void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC */ struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. + */ +uint64_t UpdateFailMalformedHTLC_hash(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR o); + /** * Checks if two UpdateFailMalformedHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31755,35 +37215,40 @@ void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR thi /** * A signature on the commitment transaction */ -struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * A signature on the commitment transaction */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Signatures on the HTLC transactions * * Returns a copy of the field. */ -struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** * Signatures on the HTLC transactions */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** * Constructs a new CommitmentSigned 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 LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg); /** * Creates a copy of the CommitmentSigned */ struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the CommitmentSigned. + */ +uint64_t CommitmentSigned_hash(const struct LDKCommitmentSigned *NONNULL_PTR o); + /** * Checks if two CommitmentSigneds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31836,6 +37301,11 @@ MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes ch */ struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the RevokeAndACK. + */ +uint64_t RevokeAndACK_hash(const struct LDKRevokeAndACK *NONNULL_PTR o); + /** * Checks if two RevokeAndACKs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31878,6 +37348,11 @@ MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_ */ struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UpdateFee. + */ +uint64_t UpdateFee_hash(const struct LDKUpdateFee *NONNULL_PTR o); + /** * Checks if two UpdateFees contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31945,23 +37420,28 @@ void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelRee /** * The next funding transaction ID */ -struct LDKCOption_TxidZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** * The next funding transaction ID */ -void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_TxidZ val); +void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * Constructs a new ChannelReestablish given each field */ -MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_TxidZ next_funding_txid_arg); +MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg); /** * Creates a copy of the ChannelReestablish */ struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelReestablish. + */ +uint64_t ChannelReestablish_hash(const struct LDKChannelReestablish *NONNULL_PTR o); + /** * Checks if two ChannelReestablishs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31997,33 +37477,38 @@ void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignature /** * A signature by the node key */ -struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the node key */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * A signature by the funding key */ -struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** * A signature by the funding key */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Constructs a new AnnouncementSignatures given each field */ -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); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); /** * Creates a copy of the AnnouncementSignatures */ struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. + */ +uint64_t AnnouncementSignatures_hash(const struct LDKAnnouncementSignatures *NONNULL_PTR o); + /** * Checks if two AnnouncementSignaturess contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32032,55 +37517,113 @@ struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAn bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); /** - * Frees any resources used by the NetAddress + * Frees any resources used by the SocketAddress + */ +void SocketAddress_free(struct LDKSocketAddress this_ptr); + +/** + * Creates a copy of the SocketAddress + */ +struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); + +/** + * Utility method to constructs a new TcpIpV4-variant SocketAddress */ -void NetAddress_free(struct LDKNetAddress this_ptr); +struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); /** - * Creates a copy of the NetAddress + * Utility method to constructs a new TcpIpV6-variant SocketAddress */ -struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); +struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); /** - * Utility method to constructs a new IPv4-variant NetAddress + * Utility method to constructs a new OnionV2-variant SocketAddress */ -struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); +struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); /** - * Utility method to constructs a new IPv6-variant NetAddress + * Utility method to constructs a new OnionV3-variant SocketAddress */ -struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); +struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Utility method to constructs a new OnionV2-variant NetAddress + * Utility method to constructs a new Hostname-variant SocketAddress */ -struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); +struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); /** - * Utility method to constructs a new OnionV3-variant NetAddress + * Generates a non-cryptographic 64-bit hash of the SocketAddress. */ -struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +uint64_t SocketAddress_hash(const struct LDKSocketAddress *NONNULL_PTR o); /** - * Utility method to constructs a new Hostname-variant NetAddress + * Checks if two SocketAddresss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); + +/** + * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read + */ +struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj); + +/** + * Read a SocketAddress from a byte array, created by SocketAddress_write + */ +struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); + +/** + * Creates a copy of the SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); + +/** + * Utility method to constructs a new InvalidInput-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); + +/** + * Utility method to constructs a new InvalidPort-variant SocketAddressParseError + */ +enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); + +/** + * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError */ -struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); /** - * Checks if two NetAddresss contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. + */ +uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NONNULL_PTR o); + +/** + * Checks if two SocketAddressParseErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b); +bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); /** - * Serialize the NetAddress object into a byte array which can be read by NetAddress_read + * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. + * + * The host part must end with \".onion\". */ -struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); /** - * Read a NetAddress from a byte array, created by NetAddress_write + * Get the string representation of a SocketAddress object */ -struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); +struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); + +/** + * Read a SocketAddress object from a string + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); /** * Frees any resources used by the UnsignedGossipMessage @@ -32178,18 +37721,23 @@ void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONN * * Returns a copy of the field. */ -struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** * List of addresses on which this node is reachable */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** * Creates a copy of the UnsignedNodeAnnouncement */ struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. + */ +uint64_t UnsignedNodeAnnouncement_hash(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR o); + /** * Checks if two UnsignedNodeAnnouncements contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32205,12 +37753,12 @@ void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** * The signature by the node key */ -struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** * The signature by the node key */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual content of the announcement @@ -32225,13 +37773,18 @@ void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ /** * Constructs a new NodeAnnouncement given each field */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** * Creates a copy of the NodeAnnouncement */ struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. + */ +uint64_t NodeAnnouncement_hash(const struct LDKNodeAnnouncement *NONNULL_PTR o); + /** * Checks if two NodeAnnouncements contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32314,11 +37867,39 @@ struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKU */ void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + */ +void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new UnsignedChannelAnnouncement given each field + */ +MUST_USE_RES struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_new(struct LDKChannelFeatures features_arg, struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, struct LDKNodeId node_id_1_arg, struct LDKNodeId node_id_2_arg, struct LDKNodeId bitcoin_key_1_arg, struct LDKNodeId bitcoin_key_2_arg, struct LDKCVec_u8Z excess_data_arg); + /** * Creates a copy of the UnsignedChannelAnnouncement */ struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. + */ +uint64_t UnsignedChannelAnnouncement_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR o); + /** * Checks if two UnsignedChannelAnnouncements contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32334,42 +37915,42 @@ void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** * Authentication of the announcement by the first public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the first public node */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Authentication of the announcement by the second public node */ -struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Authentication of the announcement by the second public node */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Proof of funding UTXO ownership by the first public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the first public node */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * Proof of funding UTXO ownership by the second public node */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** * Proof of funding UTXO ownership by the second public node */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual announcement @@ -32384,13 +37965,18 @@ void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR /** * Constructs a new ChannelAnnouncement given each field */ -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); +MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKECDSASignature node_signature_1_arg, struct LDKECDSASignature node_signature_2_arg, struct LDKECDSASignature bitcoin_signature_1_arg, struct LDKECDSASignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); /** * Creates a copy of the ChannelAnnouncement */ struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. + */ +uint64_t ChannelAnnouncement_hash(const struct LDKChannelAnnouncement *NONNULL_PTR o); + /** * Checks if two ChannelAnnouncements contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32539,6 +38125,11 @@ MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LD */ struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. + */ +uint64_t UnsignedChannelUpdate_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR o); + /** * Checks if two UnsignedChannelUpdates contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32554,12 +38145,12 @@ void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** * A signature of the channel update */ -struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** * A signature of the channel update */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * The actual channel update @@ -32574,13 +38165,18 @@ void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelUpdate given each field */ -MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** * Creates a copy of the ChannelUpdate */ struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelUpdate. + */ +uint64_t ChannelUpdate_hash(const struct LDKChannelUpdate *NONNULL_PTR o); + /** * Checks if two ChannelUpdates contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32633,6 +38229,11 @@ MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyT */ struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the QueryChannelRange. + */ +uint64_t QueryChannelRange_hash(const struct LDKQueryChannelRange *NONNULL_PTR o); + /** * Checks if two QueryChannelRanges contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32707,6 +38308,11 @@ MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyT */ struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. + */ +uint64_t ReplyChannelRange_hash(const struct LDKReplyChannelRange *NONNULL_PTR o); + /** * Checks if two ReplyChannelRanges contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32751,6 +38357,11 @@ MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKT */ struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. + */ +uint64_t QueryShortChannelIds_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR o); + /** * Checks if two QueryShortChannelIdss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32795,6 +38406,11 @@ MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struc */ struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. + */ +uint64_t ReplyShortChannelIdsEnd_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR o); + /** * Checks if two ReplyShortChannelIdsEnds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32847,6 +38463,11 @@ MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LD */ struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. + */ +uint64_t GossipTimestampFilter_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR o); + /** * Checks if two GossipTimestampFilters contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -32899,6 +38520,11 @@ struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg) */ struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); +/** + * Generates a non-cryptographic 64-bit hash of the ErrorAction. + */ +uint64_t ErrorAction_hash(const struct LDKErrorAction *NONNULL_PTR o); + /** * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. */ @@ -33005,6 +38631,8 @@ void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_ /** * Constructs a new CommitmentUpdate given each field + * + * Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ 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); @@ -33013,6 +38641,11 @@ MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_Upda */ struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. + */ +uint64_t CommitmentUpdate_hash(const struct LDKCommitmentUpdate *NONNULL_PTR o); + /** * Checks if two CommitmentUpdates contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -33035,6 +38668,111 @@ void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); */ void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); +/** + * Frees any resources used by the FinalOnionHopData, if is_owned is set and inner is non-NULL. + */ +void FinalOnionHopData_free(struct LDKFinalOnionHopData this_obj); + +/** + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. + */ +const uint8_t (*FinalOnionHopData_get_payment_secret(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr))[32]; + +/** + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. + */ +void FinalOnionHopData_set_payment_secret(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. + */ +uint64_t FinalOnionHopData_get_total_msat(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr); + +/** + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. + */ +void FinalOnionHopData_set_total_msat(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new FinalOnionHopData given each field + */ +MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyTwoBytes payment_secret_arg, uint64_t total_msat_arg); + +/** + * Creates a copy of the FinalOnionHopData + */ +struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig); + +/** + * Frees any resources used by the OnionPacket, if is_owned is set and inner is non-NULL. + */ +void OnionPacket_free(struct LDKOnionPacket this_obj); + +/** + * BOLT 4 version number. + */ +uint8_t OnionPacket_get_version(const struct LDKOnionPacket *NONNULL_PTR this_ptr); + +/** + * BOLT 4 version number. + */ +void OnionPacket_set_version(struct LDKOnionPacket *NONNULL_PTR this_ptr, uint8_t val); + +/** + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. + * + * Returns a copy of the field. + */ +struct LDKCResult_PublicKeySecp256k1ErrorZ OnionPacket_get_public_key(const struct LDKOnionPacket *NONNULL_PTR this_ptr); + +/** + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. + */ +void OnionPacket_set_public_key(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKCResult_PublicKeySecp256k1ErrorZ val); + +/** + * HMAC to verify the integrity of hop_data. + */ +const uint8_t (*OnionPacket_get_hmac(const struct LDKOnionPacket *NONNULL_PTR this_ptr))[32]; + +/** + * HMAC to verify the integrity of hop_data. + */ +void OnionPacket_set_hmac(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Creates a copy of the OnionPacket + */ +struct LDKOnionPacket OnionPacket_clone(const struct LDKOnionPacket *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the OnionPacket. + */ +uint64_t OnionPacket_hash(const struct LDKOnionPacket *NONNULL_PTR o); + +/** + * Checks if two OnionPackets 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 OnionPacket_eq(const struct LDKOnionPacket *NONNULL_PTR a, const struct LDKOnionPacket *NONNULL_PTR b); + /** * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ @@ -33055,6 +38793,46 @@ struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNUL */ struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser); +/** + * Serialize the Stfu object into a byte array which can be read by Stfu_read + */ +struct LDKCVec_u8Z Stfu_write(const struct LDKStfu *NONNULL_PTR obj); + +/** + * Read a Stfu from a byte array, created by Stfu_write + */ +struct LDKCResult_StfuDecodeErrorZ Stfu_read(struct LDKu8slice ser); + +/** + * Serialize the Splice object into a byte array which can be read by Splice_read + */ +struct LDKCVec_u8Z Splice_write(const struct LDKSplice *NONNULL_PTR obj); + +/** + * Read a Splice from a byte array, created by Splice_write + */ +struct LDKCResult_SpliceDecodeErrorZ Splice_read(struct LDKu8slice ser); + +/** + * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read + */ +struct LDKCVec_u8Z SpliceAck_write(const struct LDKSpliceAck *NONNULL_PTR obj); + +/** + * Read a SpliceAck from a byte array, created by SpliceAck_write + */ +struct LDKCResult_SpliceAckDecodeErrorZ SpliceAck_read(struct LDKu8slice ser); + +/** + * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read + */ +struct LDKCVec_u8Z SpliceLocked_write(const struct LDKSpliceLocked *NONNULL_PTR obj); + +/** + * Read a SpliceLocked from a byte array, created by SpliceLocked_write + */ +struct LDKCResult_SpliceLockedDecodeErrorZ SpliceLocked_read(struct LDKu8slice ser); + /** * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read */ @@ -33315,6 +39093,16 @@ struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NO */ struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); +/** + * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read + */ +struct LDKCVec_u8Z OnionPacket_write(const struct LDKOnionPacket *NONNULL_PTR obj); + +/** + * Read a OnionPacket from a byte array, created by OnionPacket_write + */ +struct LDKCResult_OnionPacketDecodeErrorZ OnionPacket_read(struct LDKu8slice ser); + /** * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read */ @@ -33335,6 +39123,16 @@ struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice s */ struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); +/** + * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read + */ +struct LDKCVec_u8Z FinalOnionHopData_write(const struct LDKFinalOnionHopData *NONNULL_PTR obj); + +/** + * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ FinalOnionHopData_read(struct LDKu8slice ser); + /** * Serialize the Ping object into a byte array which can be read by Ping_read */ @@ -33507,6 +39305,12 @@ void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); */ MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); +/** + * 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 IgnoringMessageHandler_as_EventsProvider(const struct LDKIgnoringMessageHandler *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 @@ -33519,12 +39323,6 @@ struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsP */ struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); -/** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is - */ -struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); - /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is @@ -33618,7 +39416,7 @@ void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this * A message handler which handles onion messages. This should generally be an * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. * - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); @@ -33626,7 +39424,7 @@ const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(co * A message handler which handles onion messages. This should generally be an * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. * - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); @@ -33702,7 +39500,7 @@ MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler mess * The returned `Option`s will only be `Some` if an address had been previously given via * [`Self::new_outbound_connection`] or [`Self::new_inbound_connection`]. */ -MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** * Indicates a new outbound connection has been established to a node with the given `node_id` @@ -33721,7 +39519,7 @@ MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_g * * [`socket_disconnected`]: PeerManager::socket_disconnected */ -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, struct LDKCOption_NetAddressZ remote_network_address); +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, struct LDKCOption_SocketAddressZ remote_network_address); /** * Indicates a new inbound connection has been established to a node with an optional remote @@ -33740,7 +39538,7 @@ MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound * * [`socket_disconnected`]: PeerManager::socket_disconnected */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); /** * Indicates that there is room to write data to the given socket descriptor. @@ -33854,7 +39652,7 @@ void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR th * * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ -void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); /** * Gets the weight for an HTLC-Success transaction. @@ -33968,13 +39766,6 @@ struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitme */ struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); -/** - * 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. - */ -struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); - /** * Derives a per-commitment-transaction revocation key from its constituent parts. * @@ -33985,21 +39776,6 @@ struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, */ struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); -/** - * 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). - */ -struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); - /** * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. */ @@ -34020,49 +39796,49 @@ void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_P * transaction to provide their counterparty the ability to punish them if they broadcast * an old state. */ -struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKRevocationKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * 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 TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKRevocationKey val); /** * Broadcaster's HTLC Key */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKHtlcKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's HTLC Key */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** * Countersignatory's HTLC Key */ -struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKHtlcKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Countersignatory's HTLC Key */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +struct LDKDelayedPaymentKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentKey val); /** * Constructs a new TxCreationKeys given each field */ -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); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKRevocationKey revocation_key_arg, struct LDKHtlcKey broadcaster_htlc_key_arg, struct LDKHtlcKey countersignatory_htlc_key_arg, struct LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg); /** * Checks if two TxCreationKeyss contain equal inner contents. @@ -34109,7 +39885,7 @@ void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_P * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKRevocationBasepoint ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * The base point which is used (with derive_public_revocation_key) to derive per-commitment @@ -34117,7 +39893,7 @@ struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKC * counterparty to create a secret which the counterparty can reveal to revoke previous * states. */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKRevocationBasepoint val); /** * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately @@ -34138,37 +39914,42 @@ void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PT * 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). */ -struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKDelayedPaymentBasepoint ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * 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 ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentBasepoint val); /** * 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 LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKHtlcBasepoint ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** * 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 ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKHtlcBasepoint val); /** * Constructs a new ChannelPublicKeys given each field */ -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 LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKRevocationBasepoint revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg, struct LDKHtlcBasepoint htlc_basepoint_arg); /** * Creates a copy of the ChannelPublicKeys */ struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. + */ +uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); + /** * Checks if two ChannelPublicKeyss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34190,7 +39971,7 @@ struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LD * 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. */ -MUST_USE_RES struct LDKTxCreationKeys 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); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR broadcaster_delayed_payment_base, const struct LDKHtlcBasepoint *NONNULL_PTR broadcaster_htlc_base, const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_revocation_base, const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_htlc_base); /** * Generate per-state keys from channel static keys. @@ -34203,7 +39984,13 @@ MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(st * 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 LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +struct LDKCVec_u8Z get_revokeable_redeemscript(const struct LDKRevocationKey *NONNULL_PTR revocation_key, uint16_t contest_delay, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key); + +/** + * Returns the script for the counterparty's output on a holder's commitment transaction based on + * the channel type. + */ +struct LDKCVec_u8Z get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); /** * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. @@ -34320,12 +40107,12 @@ struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, st * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the * commitment transaction). */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key, const struct LDKRevocationKey *NONNULL_PTR revocation_key); /** * Returns the witness required to satisfy and spend a HTLC input. */ -struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKCOption_PaymentPreimageZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +struct LDKWitness build_htlc_input_witness(struct LDKECDSASignature local_sig, struct LDKECDSASignature remote_sig, struct LDKCOption_ThirtyTwoBytesZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** * Gets the witnessScript for the to_remote output when anchors are enabled. @@ -34345,7 +40132,7 @@ struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** * Returns the witness required to satisfy and spend an anchor input. */ -struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig); +struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); /** * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. @@ -34428,6 +40215,9 @@ void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTra /** * Constructs a new ChannelTransactionParameters given each field + * + * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ 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, struct LDKChannelTypeFeatures channel_type_features_arg); @@ -34436,6 +40226,11 @@ MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters */ struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. + */ +uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); + /** * Checks if two ChannelTransactionParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34478,6 +40273,11 @@ MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChan */ struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. + */ +uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); + /** * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -34573,24 +40373,24 @@ void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this /** * Our counterparty's signature for the transaction */ -struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** * Our counterparty's signature for the transaction */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction * * Returns a copy of the field. */ -struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** * Creates a copy of the HolderCommitmentTransaction @@ -34611,7 +40411,7 @@ struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransa * 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 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); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKECDSASignature counterparty_sig, struct LDKCVec_ECDSASignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); /** * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. @@ -34674,12 +40474,12 @@ MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all /** * Signs the counterparty's commitment transaction. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** * Signs the holder commitment transaction because we are about to broadcast it. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. @@ -34769,7 +40569,7 @@ MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all( * Sign a transaction, either because we are counter-signing the counterparty's transaction or * because we are about to broadcast a holder transaction. */ -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); +MUST_USE_RES struct LDKECDSASignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. @@ -34796,6 +40596,11 @@ struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(s */ MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +/** + * The per commitment point used by the broadcaster. + */ +MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); + /** * The value to be sent to the broadcaster */ @@ -34864,7 +40669,35 @@ MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_ * * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ -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, const struct LDKEntropySource *NONNULL_PTR entropy_source); +MUST_USE_RES struct LDKCResult_CVec_ECDSASignatureZNoneZ 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, const struct LDKEntropySource *NONNULL_PTR entropy_source); + +/** + * Returns the index of the revokeable output, i.e. the `to_local` output sending funds to + * the broadcaster, in the built transaction, if any exists. + * + * There are two cases where this may return `None`: + * - The balance of the revokeable output is below the dust limit (only found on commitments + * early in the channel's lifetime, i.e. before the channel reserve is met). + * - This commitment was created before LDK 0.0.117. In this case, the + * commitment transaction previously didn't contain enough information to locate the + * revokeable output. + */ +MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + +/** + * Helper method to build an unsigned justice transaction spending the revokeable + * `to_local` output to a destination script. Fee estimation accounts for the expected + * revocation witness data that will be added when signed. + * + * This method will error if the given fee rate results in a fee greater than the value + * of the output being spent, or if there exists no revokeable `to_local` output on this + * commitment transaction. See [`Self::revokeable_output_index`] for more details. + * + * The built transaction will allow fee bumping with RBF, and this method takes + * `feerate_per_kw` as an input such that multiple copies of a justice transaction at different + * fee rates may be built. + */ +MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_build_to_local_justice_tx(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, uint64_t feerate_per_kw, struct LDKCVec_u8Z destination_script); /** * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a @@ -34984,6 +40817,51 @@ struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHop */ struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the InitFeatures. + */ +uint64_t InitFeatures_hash(const struct LDKInitFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the NodeFeatures. + */ +uint64_t NodeFeatures_hash(const struct LDKNodeFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the ChannelFeatures. + */ +uint64_t ChannelFeatures_hash(const struct LDKChannelFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures. + */ +uint64_t Bolt11InvoiceFeatures_hash(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the OfferFeatures. + */ +uint64_t OfferFeatures_hash(const struct LDKOfferFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the InvoiceRequestFeatures. + */ +uint64_t InvoiceRequestFeatures_hash(const struct LDKInvoiceRequestFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the Bolt12InvoiceFeatures. + */ +uint64_t Bolt12InvoiceFeatures_hash(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the BlindedHopFeatures. + */ +uint64_t BlindedHopFeatures_hash(const struct LDKBlindedHopFeatures *NONNULL_PTR o); + +/** + * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures. + */ +uint64_t ChannelTypeFeatures_hash(const struct LDKChannelTypeFeatures *NONNULL_PTR o); + /** * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ @@ -35045,6 +40923,28 @@ MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFe */ MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35083,6 +40983,28 @@ MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFe */ MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35121,6 +41043,28 @@ MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKCha */ MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35159,6 +41103,28 @@ MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35197,6 +41163,28 @@ MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOffer */ MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35235,6 +41223,28 @@ MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35273,6 +41283,28 @@ MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct */ MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35311,6 +41343,28 @@ MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDK */ MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35349,6 +41403,28 @@ MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LD */ MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +/** + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + +/** + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); + /** * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined * by [bLIP 2] or if it is a known `T` feature. @@ -35996,6 +42072,46 @@ MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LD */ MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_route_blinding_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_route_blinding_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_route_blinding_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_route_blinding_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -36036,6 +42152,66 @@ MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitF */ MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -36303,7 +42479,7 @@ void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); * * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** * The script that did not meet the requirements from [BOLT #2]. @@ -36352,10 +42528,10 @@ MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*s * * This function may return an error if `program` is invalid for the segwit `version`. */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessProgram witness_program); /** - * Converts the shutdown script into the underlying [`Script`]. + * Converts the shutdown script into the underlying [`ScriptBuf`]. */ MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); @@ -36386,7 +42562,7 @@ struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** * Utility method to constructs a new Attempts-variant Retry */ -struct LDKRetry Retry_attempts(uintptr_t a); +struct LDKRetry Retry_attempts(uint32_t a); /** * Utility method to constructs a new Timeout-variant Retry @@ -36404,6 +42580,16 @@ bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNU */ uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); +/** + * Serialize the Retry object into a byte array which can be read by Retry_read + */ +struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); + +/** + * Read a Retry from a byte array, created by Retry_write + */ +struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); + /** * Creates a copy of the RetryableSendFailure */ @@ -36465,6 +42651,38 @@ struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); */ struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); +/** + * Checks if two PaymentSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b); + +/** + * Frees any resources used by the ProbeSendFailure + */ +void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); + +/** + * Creates a copy of the ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); + +/** + * Utility method to constructs a new SendingFailed-variant ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a); + +/** + * Checks if two ProbeSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); + /** * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. */ @@ -36483,7 +42701,7 @@ void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); * want to provide a secret for a spontaneous payment if MPP is needed and you know your * recipient will not reject it. */ -struct LDKCOption_PaymentSecretZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat @@ -36498,7 +42716,7 @@ struct LDKCOption_PaymentSecretZ RecipientOnionFields_get_payment_secret(const s * want to provide a secret for a spontaneous payment if MPP is needed and you know your * recipient will not reject it. */ -void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_PaymentSecretZ val); +void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of @@ -36534,11 +42752,6 @@ struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const stru */ void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); -/** - * Constructs a new RecipientOnionFields given each field - */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKCOption_PaymentSecretZ payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg); - /** * Creates a copy of the RecipientOnionFields */ @@ -36580,25 +42793,186 @@ MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(str */ MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); +/** + * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each + * TLV is provided as a `(u64, Vec)` for the type number and serialized value + * respectively. TLV type numbers must be unique and within the range + * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`. + * + * This method will also error for types in the experimental range which have been + * standardized within the protocol, which only includes 5482373484 (keysend) for now. + * + * See [`Self::custom_tlvs`] for more info. + */ +MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); + +/** + * Gets the custom TLVs that will be sent or have been received. + * + * Custom TLVs allow sending extra application-specific data with a payment. They provide + * additional flexibility on top of payment metadata, as while other implementations may + * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs + * do not have this restriction. + * + * Note that if this field is non-empty, it will contain strictly increasing TLVs, each + * represented by a `(u64, Vec)` for its type number and serialized value respectively. + * This is validated when setting this field using [`Self::with_custom_tlvs`]. + */ +MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); + /** * Calls the free function if one is set */ void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +/** + * Creates a copy of a Type + */ +struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); + /** * Calls the free function if one is set */ void Type_free(struct LDKType this_ptr); +/** + * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + */ +void Offer_free(struct LDKOffer this_obj); + +/** + * Creates a copy of the Offer + */ +struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Returns whether the given chain is supported by the offer. + */ +MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); + +/** + * Whether the offer has expired. + */ +MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Whether the offer has expired given the duration since the Unix epoch. + */ +MUST_USE_RES bool Offer_is_expired_no_std(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t duration_since_epoch); + +/** + * Returns whether the given quantity is valid for the offer. + */ +MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); + +/** + * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); + +/** + * Serialize the Offer object into a byte array which can be read by Offer_read + */ +struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); + +/** + * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. + */ +void Amount_free(struct LDKAmount this_obj); + +/** + * Creates a copy of the Amount + */ +struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); + +/** + * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. + */ +void Quantity_free(struct LDKQuantity this_obj); + +/** + * Creates a copy of the Quantity + */ +struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); + +/** + * Read a Offer object from a string + */ +struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); + /** * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. */ void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); /** - * The public key corresponding to the key needed to sign the invoice. + * Returns the [`TaggedHash`] of the invoice to sign. */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. @@ -36611,11 +42985,331 @@ void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); /** - * A complete description of the purpose of the originating offer or refund. Intended to be - * displayed to the user but with the caveat that it has not been verified in any way. + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains + */ +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKQuantity UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + */ +MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths + */ +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when the invoice was created. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore + * should no longer be paid. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Whether the invoice has expired. + */ +MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of the invoice. + */ +MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to paying an invoice. + */ +MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The public key corresponding to the key used to sign the invoice. + */ +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains + */ +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + */ +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description */ MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + */ +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKQuantity Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + */ +MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths + */ +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * Duration since the Unix epoch when the invoice was created. */ @@ -36645,22 +43339,33 @@ MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice * /** * Features pertaining to paying an invoice. */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** * The public key corresponding to the key used to sign the invoice. */ MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +/** + * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. + */ +MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * Hash that was used for signing the invoice. */ MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Verifies that the invoice was for a request or refund created using the given key. + * Verifies that the invoice was for a request or refund created using the given key. Returns + * the associated [`PaymentId`] to use when sending the payment. */ -MUST_USE_RES bool Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); + +/** + * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read + */ +struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); /** * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read @@ -36815,6 +43520,8 @@ void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, stru /** * Constructs a new InvoiceError given each field + * + * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); @@ -36860,6 +43567,11 @@ MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_a */ struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); +/** + * Creates an [`InvoiceError`] with the given message. + */ +MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); + /** * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read */ @@ -36875,6 +43587,11 @@ struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice s */ void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); +/** + * Returns the [`TaggedHash`] of the invoice to sign. + */ +MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + /** * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. */ @@ -36885,13 +43602,215 @@ void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); */ struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); +/** + * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. + */ +void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); + +/** + * Keys used for signing a [`Bolt12Invoice`] if they can be derived. + * + * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call + * [`respond_with`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`respond_using_derived_keys`]: Self::respond_using_derived_keys + * [`respond_with`]: Self::respond_with + */ +struct LDKCOption_SecretKeyZ VerifiedInvoiceRequest_get_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); + +/** + * Keys used for signing a [`Bolt12Invoice`] if they can be derived. + * + * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call + * [`respond_with`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`respond_using_derived_keys`]: Self::respond_using_derived_keys + * [`respond_with`]: Self::respond_with + */ +void VerifiedInvoiceRequest_set_keys(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKCOption_SecretKeyZ val); + +/** + * Creates a copy of the VerifiedInvoiceRequest + */ +struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id + */ +MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A chain from [`Offer::chains`] that the offer is valid for. + */ +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which + * must be greater than or equal to [`Offer::amount`], converted if necessary. + * + * [`chain`]: Self::chain + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to requesting an invoice. + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + */ +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A possibly transient pubkey used to sign the invoice request. + */ +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. + */ +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKAmount InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. + */ +MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Features pertaining to the offer. + */ +MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. + */ +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. + */ +MUST_USE_RES struct LDKCVec_BlindedPathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The quantity of items supported. + */ +MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * The public key used by the recipient to sign invoices. + */ +MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + /** * An unpredictable series of bytes, typically containing information about the derivation of * [`payer_id`]. * * [`payer_id`]: Self::payer_id */ -MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * A chain from [`Offer::chains`] that the offer is valid for. @@ -36909,7 +43828,7 @@ MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDK /** * Features pertaining to requesting an invoice. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. @@ -36930,76 +43849,58 @@ MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoice MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Verifies that the request was for an offer created using the given key. Returns the derived - * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the - * metadata. + * Signature of the invoice request using [`payer_id`]. * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - */ -MUST_USE_RES struct LDKCResult_COption_KeyPairZNoneZ InvoiceRequest_verify(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); - -/** - * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read - */ -struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); - -/** - * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + * [`payer_id`]: Self::payer_id */ -void Offer_free(struct LDKOffer this_obj); +MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Offer + * Verifies that the request was for an offer created using the given key. Returns the verified + * request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request + * if they could be extracted from the metadata. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) * for the selected chain. */ -MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); - -/** - * Returns whether the given chain is supported by the offer. - */ -MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Opaque bytes set by the originator. Useful for authentication and validating fields since it * is reflected in `invoice_request` messages along with all the other fields from the `offer`. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The minimum amount required for a successful payment of a single item. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKAmount VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * A complete description of the purpose of the payment. Intended to be displayed to the user * but with the caveat that it has not been verified in any way. */ -MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Features pertaining to the offer. */ -MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Duration since the Unix epoch when an invoice should no longer be requested. * * If `None`, the offer does not expire. */ -MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); - -/** - * Whether the offer has expired. - */ -MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be @@ -37007,65 +43908,102 @@ MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide * recipient privacy by obfuscating its node id. */ -MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedPathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * The quantity of items supported. */ -MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns whether the given quantity is valid for the offer. + * The public key used by the recipient to sign invoices. */ -MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`payer_id`]: Self::payer_id */ -MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * A chain from [`Offer::chains`] that the offer is valid for. */ -MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the Offer object into a byte array which can be read by Offer_read + * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which + * must be greater than or equal to [`Offer::amount`], converted if necessary. + * + * [`chain`]: Self::chain */ -struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. + * Features pertaining to requesting an invoice. */ -void Amount_free(struct LDKAmount this_obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Amount + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. + * A possibly transient pubkey used to sign the invoice request. */ -void Quantity_free(struct LDKQuantity this_obj); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the Quantity + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Read a Offer object from a string + * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read */ -struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); +struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); + +/** + * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read + */ +struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); + +/** + * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. + */ +void TaggedHash_free(struct LDKTaggedHash this_obj); + +/** + * Creates a copy of the TaggedHash + */ +struct LDKTaggedHash TaggedHash_clone(const struct LDKTaggedHash *NONNULL_PTR orig); + +/** + * Returns the digest to sign. + */ +MUST_USE_RES const uint8_t (*TaggedHash_as_digest(const struct LDKTaggedHash *NONNULL_PTR this_arg))[32]; + +/** + * Returns the tag used in the tagged hash. + */ +MUST_USE_RES struct LDKStr TaggedHash_tag(const struct LDKTaggedHash *NONNULL_PTR this_arg); + +/** + * Returns the merkle root used in the tagged hash. + */ +MUST_USE_RES struct LDKThirtyTwoBytes TaggedHash_merkle_root(const struct LDKTaggedHash *NONNULL_PTR this_arg); /** * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. @@ -37187,6 +44125,11 @@ enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); */ enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void); +/** + * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError + */ +enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); + /** * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError */ @@ -37233,13 +44176,18 @@ MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund * * If `None`, the refund does not expire. */ -MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); /** * Whether the refund has expired. */ MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); +/** + * Whether the refund has expired given the duration since the Unix epoch. + */ +MUST_USE_RES bool Refund_is_expired_no_std(const struct LDKRefund *NONNULL_PTR this_arg, uint64_t duration_since_epoch); + /** * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be * displayed to the user but with the caveat that it has not been verified in any way. @@ -37260,7 +44208,7 @@ MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NO * * [`payer_id`]: Self::payer_id */ -MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); /** * A chain that the refund is valid for. @@ -37414,10 +44362,15 @@ MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); */ MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); +/** + * Get the public key as an array from this NodeId + */ +MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR this_arg))[33]; + /** * Get the public key from this NodeId */ -MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); /** * Generates a non-cryptographic 64-bit hash of the NodeId. @@ -37503,19 +44456,21 @@ MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGr * existing announcements unless they are updated. * Add, update or remove the provider would replace the current one. */ -void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); +void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** * Handles any network updates originating from [`Event`]s. + * Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid + * leaking possibly identifying information of the sender to the public network. * * [`Event`]: crate::events::Event */ void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** - * Gets the genesis hash for this network graph. + * Gets the chain hash for this network graph. */ -MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_genesis_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** * Verifies the signature of a [`NodeAnnouncement`]. @@ -37632,6 +44587,8 @@ void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONN /** * Constructs a new ChannelUpdateInfo given each field + * + * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); @@ -37794,11 +44751,6 @@ struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirected */ MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); -/** - * Returns the maximum HTLC amount allowed over the channel in the direction. - */ -MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); - /** * Returns the [`EffectiveCapacity`] of the channel in the direction. * @@ -37985,6 +44937,8 @@ void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInf /** * Constructs a new NodeAnnouncementInfo given each field + * + * Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKNodeAnnouncement announcement_message_arg); @@ -38003,7 +44957,7 @@ bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a /** * Internet-level addresses via which one can connect to the node */ -MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read @@ -38034,6 +44988,11 @@ MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); */ struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the NodeAlias. + */ +uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o); + /** * Checks if two NodeAliass contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -38088,6 +45047,8 @@ void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, st /** * Constructs a new NodeInfo given each field + * + * Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); @@ -38260,8 +45221,8 @@ void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKN * 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 P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'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 @@ -38279,6 +45240,16 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(c */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +/** + * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. + * + * This checks whether the update currently is applicable by [`Self::update_channel`]. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. + */ +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + /** * Returns information on a channel with the given id. * @@ -38308,7 +45279,7 @@ MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct * Returns None if the requested node is completely unknown, * or if node announcement for the node was never received. */ -MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. @@ -38318,7 +45289,7 @@ void DefaultRouter_free(struct LDKDefaultRouter this_obj); /** * Creates a new router. */ -MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); +MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); /** * Constructs a new Router which calls the relevant methods on this_arg. @@ -38326,6 +45297,12 @@ MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGr */ struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +/** + * Constructs a new MessageRouter which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is + */ +struct LDKMessageRouter DefaultRouter_as_MessageRouter(const struct LDKDefaultRouter *NONNULL_PTR this_arg); + /** * Calls the free function if one is set */ @@ -38339,18 +45316,13 @@ void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlight /** * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ -MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); /** - * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj); - -/** - * Constructs a new Score which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is - */ -struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); +struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); /** * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. @@ -38483,10 +45455,34 @@ uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR th */ void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); +/** + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. + */ +bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); + +/** + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. + */ +void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); + /** * Constructs a new RouteHop given each field */ -MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); +MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg, bool maybe_announced_channel_arg); /** * Creates a copy of the RouteHop @@ -38633,6 +45629,8 @@ void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlind /** * Constructs a new Path given each field + * + * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); @@ -38688,27 +45686,33 @@ struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); /** - * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. + * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`]. + * The `route_params` parameter passed to [`find_route`]. * * This is used by `ChannelManager` to track information which may be required for retries. * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); /** * Constructs a new Route given each field + * + * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); /** * Creates a copy of the Route @@ -38730,14 +45734,21 @@ bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNU /** * 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 `route_params.final_value_msat`. + * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to + * the recipient, which can happen in excess of the amount passed to [`find_route`] via + * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than - * requested if we had to reach htlc_minimum_msat. + * Returns the total amount paid on this [`Route`], excluding the fees. + * + * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if + * we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); @@ -38776,16 +45787,41 @@ uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *N */ void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); +/** + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. + */ +struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); + +/** + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. + */ +void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + /** * Constructs a new RouteParameters given each field */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg); /** * Creates a copy of the RouteParameters */ struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the RouteParameters. + */ +uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); + /** * Checks if two RouteParameterss contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -38793,6 +45829,13 @@ struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters */ bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); +/** + * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. + * + * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats + */ +MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); + /** * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ @@ -38902,10 +45945,26 @@ struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struc */ void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +/** + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. + * + * Returns a copy of the field. + */ +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_blinded_path_idxs(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. + */ +void PaymentParameters_set_previously_failed_blinded_path_idxs(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); + /** * Constructs a new PaymentParameters given each field */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, struct LDKCVec_u64Z previously_failed_blinded_path_idxs_arg); /** * Creates a copy of the PaymentParameters @@ -38964,6 +46023,11 @@ MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LD */ MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); +/** + * Creates parameters for paying to a blinded payee from the provided blinded route hints. + */ +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints); + /** * Frees any resources used by the Payee */ @@ -39133,6 +46197,155 @@ struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR */ struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); +/** + * Frees any resources used by the FirstHopCandidate, if is_owned is set and inner is non-NULL. + */ +void FirstHopCandidate_free(struct LDKFirstHopCandidate this_obj); + +/** + * Creates a copy of the FirstHopCandidate + */ +struct LDKFirstHopCandidate FirstHopCandidate_clone(const struct LDKFirstHopCandidate *NONNULL_PTR orig); + +/** + * Frees any resources used by the PublicHopCandidate, if is_owned is set and inner is non-NULL. + */ +void PublicHopCandidate_free(struct LDKPublicHopCandidate this_obj); + +/** + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. + */ +uint64_t PublicHopCandidate_get_short_channel_id(const struct LDKPublicHopCandidate *NONNULL_PTR this_ptr); + +/** + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. + */ +void PublicHopCandidate_set_short_channel_id(struct LDKPublicHopCandidate *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Creates a copy of the PublicHopCandidate + */ +struct LDKPublicHopCandidate PublicHopCandidate_clone(const struct LDKPublicHopCandidate *NONNULL_PTR orig); + +/** + * Frees any resources used by the PrivateHopCandidate, if is_owned is set and inner is non-NULL. + */ +void PrivateHopCandidate_free(struct LDKPrivateHopCandidate this_obj); + +/** + * Creates a copy of the PrivateHopCandidate + */ +struct LDKPrivateHopCandidate PrivateHopCandidate_clone(const struct LDKPrivateHopCandidate *NONNULL_PTR orig); + +/** + * Frees any resources used by the BlindedPathCandidate, if is_owned is set and inner is non-NULL. + */ +void BlindedPathCandidate_free(struct LDKBlindedPathCandidate this_obj); + +/** + * Creates a copy of the BlindedPathCandidate + */ +struct LDKBlindedPathCandidate BlindedPathCandidate_clone(const struct LDKBlindedPathCandidate *NONNULL_PTR orig); + +/** + * Frees any resources used by the OneHopBlindedPathCandidate, if is_owned is set and inner is non-NULL. + */ +void OneHopBlindedPathCandidate_free(struct LDKOneHopBlindedPathCandidate this_obj); + +/** + * Creates a copy of the OneHopBlindedPathCandidate + */ +struct LDKOneHopBlindedPathCandidate OneHopBlindedPathCandidate_clone(const struct LDKOneHopBlindedPathCandidate *NONNULL_PTR orig); + +/** + * Frees any resources used by the CandidateRouteHop + */ +void CandidateRouteHop_free(struct LDKCandidateRouteHop this_ptr); + +/** + * Creates a copy of the CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_clone(const struct LDKCandidateRouteHop *NONNULL_PTR orig); + +/** + * Utility method to constructs a new FirstHop-variant CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_first_hop(struct LDKFirstHopCandidate a); + +/** + * Utility method to constructs a new PublicHop-variant CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_public_hop(struct LDKPublicHopCandidate a); + +/** + * Utility method to constructs a new PrivateHop-variant CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_private_hop(struct LDKPrivateHopCandidate a); + +/** + * Utility method to constructs a new Blinded-variant CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_blinded(struct LDKBlindedPathCandidate a); + +/** + * Utility method to constructs a new OneHopBlinded-variant CandidateRouteHop + */ +struct LDKCandidateRouteHop CandidateRouteHop_one_hop_blinded(struct LDKOneHopBlindedPathCandidate a); + +/** + * Returns the globally unique short channel ID for this hop, if one is known. + * + * This only returns `Some` if the channel is public (either our own, or one we've learned + * from the public network graph), and thus the short channel ID we have for this channel is + * globally unique and identifies this channel in a global namespace. + */ +MUST_USE_RES struct LDKCOption_u64Z CandidateRouteHop_globally_unique_short_channel_id(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + +/** + * Returns the required difference in HTLC CLTV expiry between the [`Self::source`] and the + * next-hop for an HTLC taking this hop. + * + * This is the time that the node(s) in this hop have to claim the HTLC on-chain if the + * next-hop goes on chain with a payment preimage. + */ +MUST_USE_RES uint32_t CandidateRouteHop_cltv_expiry_delta(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + +/** + * Returns the minimum amount that can be sent over this hop, in millisatoshis. + */ +MUST_USE_RES uint64_t CandidateRouteHop_htlc_minimum_msat(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + +/** + * Returns the fees that must be paid to route an HTLC over this channel. + */ +MUST_USE_RES struct LDKRoutingFees CandidateRouteHop_fees(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + +/** + * Returns the source node id of current hop. + * + * Source node id refers to the node forwarding the HTLC through this hop. + * + * For [`Self::FirstHop`] we return payer's node id. + */ +MUST_USE_RES struct LDKNodeId CandidateRouteHop_source(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + +/** + * Returns the target node id of this hop, if known. + * + * Target node id refers to the node receiving the HTLC after this hop. + * + * For [`Self::Blinded`] we return `None` because the ultimate destination after the blinded + * path is unknown. + * + * For [`Self::OneHopBlinded`] we return `None` because the target is the same as the source, + * and such a return value would be somewhat nonsensical. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKNodeId CandidateRouteHop_target(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); + /** * Finds a route from us (payer) to the given target node (payee). * @@ -39162,7 +46375,7 @@ struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice s * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScoreLookUp *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); /** * Construct a route from us (payer) to the target node (payee) via the given hops (which should @@ -39172,6 +46385,16 @@ struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_p */ struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]); +/** + * Calls the free function if one is set + */ +void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); + +/** + * Calls the free function if one is set + */ +void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); + /** * Calls the free function if one is set */ @@ -39215,20 +46438,31 @@ struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const stru MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. + * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. */ -void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj); +void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); /** - * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read + * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj); +void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); /** - * 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 + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + */ +struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); + +/** + * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read + */ +struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg); +struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); /** * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. @@ -39293,10 +46527,16 @@ struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenal MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** - * 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 + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + */ +struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read @@ -39333,12 +46573,13 @@ uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LD void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * @@ -39349,12 +46590,13 @@ void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabili uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * @@ -39405,14 +46647,14 @@ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -39427,14 +46669,14 @@ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(str uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -39485,13 +46727,15 @@ uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_mult void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -39507,13 +46751,15 @@ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multipli uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -39530,7 +46776,7 @@ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_m /** * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us + * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially * as this makes balance discovery attacks harder to execute, thereby creating an incentive * to restrict `htlc_maximum_msat` and improve privacy. @@ -39541,7 +46787,7 @@ uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const s /** * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat ≥ 0.5 * channel_capacity) which makes us + * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially * as this makes balance discovery attacks harder to execute, thereby creating an incentive * to restrict `htlc_maximum_msat` and improve privacy. @@ -39551,8 +46797,9 @@ uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const s void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. + * This penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * * Note that in this case all other penalties, including the * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -39572,8 +46819,9 @@ void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKP uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. + * This penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * * Note that in this case all other penalties, including the * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based @@ -39592,6 +46840,54 @@ uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msa */ void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +/** + * In order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. + * + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. + * + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. + * + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false + */ +bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); + +/** + * In order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. + * + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. + * + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. + * + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false + */ +void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); + /** * Creates a copy of the ProbabilisticScoringFeeParameters */ @@ -39650,7 +46946,7 @@ void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDeca * * Default value: 14 days * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); @@ -39665,7 +46961,7 @@ uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life * * Default value: 14 days * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -39754,26 +47050,54 @@ MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_ch * Query the historical estimated minimum and maximum liquidity available for sending a * payment over the channel with `scid` towards the given `target` node. * - * Returns two sets of 8 buckets. The first set describes the octiles for lower-bound - * liquidity estimates, the second set describes the octiles for upper-bound liquidity - * estimates. Each bucket describes the relative frequency at which we've seen a liquidity - * bound in the octile relative to the channel's total capacity, on an arbitrary scale. - * Because the values are slowly decayed, more recent data points are weighted more heavily - * than older datapoints. + * Returns two sets of 32 buckets. The first set describes the lower-bound liquidity history, + * the second set describes the upper-bound liquidity history. Each bucket describes the + * relative frequency at which we've seen a liquidity bound in the bucket's range relative to + * the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed, + * more recent data points are weighted more heavily than older datapoints. * - * When scoring, the estimated probability that an upper-/lower-bound lies in a given octile - * relative to the channel's total capacity is calculated by dividing that bucket's value with - * the total of all buckets for the given bound. + * Note that the range of each bucket varies by its location to provide more granular results + * at the edges of a channel's capacity, where it is more likely to sit. * - * For example, a value of `[0, 0, 0, 0, 0, 0, 32]` indicates that we believe the probability - * of a bound being in the top octile to be 100%, and have never (recently) seen it in any - * other octiles. A value of `[31, 0, 0, 0, 0, 0, 0, 32]` indicates we've seen the bound being - * both in the top and bottom octile, and roughly with similar (recent) frequency. + * When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket + * is calculated by dividing that bucket's value with the total value of all buckets. + * + * For example, using a lower bucket count for illustrative purposes, a value of + * `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very + * close to the channel's capacity to be 100%, and have never (recently) seen it in any other + * bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both + * in the top and bottom bucket, and roughly with similar (recent) frequency. * * Because the datapoints are decayed slowly over time, values will eventually return to - * `Some(([0; 8], [0; 8]))`. + * `Some(([0; 32], [0; 32]))` or `None` if no data remains for a channel. + * + * In order to fetch a single success probability from the buckets provided here, as used in + * the scoring model, see [`Self::historical_estimated_payment_success_probability`]. + */ +MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); + +/** + * Query the probability of payment success sending the given `amount_msat` over the channel + * with `scid` towards the given `target` node, based on the historical estimated liquidity + * bounds. + * + * These are the same bounds as returned by + * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by + * [`Self::estimated_channel_liquidity_range`]). + */ +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); + +/** + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + */ +struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + +/** + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -MUST_USE_RES struct LDKCOption_C2Tuple_EightU16sEightU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); +struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** * Constructs a new Score which calls the relevant methods on this_arg. @@ -39842,13 +47166,13 @@ void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDes * 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); +struct LDKRevocationKey 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); +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKRevocationKey val); /** * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. @@ -39875,13 +47199,18 @@ void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayed /** * 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); +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 LDKRevocationKey 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); +/** + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. + */ +uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); + /** * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -39946,16 +47275,43 @@ uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct L */ void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + * + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + * + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); + /** * Constructs a new StaticPaymentOutputDescriptor given each field + * + * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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); +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, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); /** * Creates a copy of the StaticPaymentOutputDescriptor */ struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +/** + * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. + */ +uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); + /** * Checks if two StaticPaymentOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -39963,6 +47319,21 @@ struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(cons */ bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); +/** + * Returns the `witness_script` of the spendable output. + * + * Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that + * originated from an anchor outputs channel, as they take the form of a P2WSH script. + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); + +/** + * The maximum length a well-formed witness spending one of these should have. + * Note: If you have the grind_signatures feature enabled, this will be at least 1 byte + * shorter. + */ +MUST_USE_RES uint64_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); + /** * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read */ @@ -39986,7 +47357,7 @@ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct /** * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output, struct LDKThirtyTwoBytes channel_keys_id); /** * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor @@ -39998,6 +47369,11 @@ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_ou */ struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +/** + * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. + */ +uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); + /** * Checks if two SpendableOutputDescriptors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -40032,22 +47408,227 @@ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescripto * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. */ -MUST_USE_RES struct LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_PackedLockTimeZ locktime); +MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** - * Calls the free function if one is set + * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. */ -void ChannelSigner_free(struct LDKChannelSigner this_ptr); +void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); /** - * Calls the free function if one is set + * The value in satoshis of the channel we're attempting to spend the anchor output of. */ -void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); +uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); + +/** + * The value in satoshis of the channel we're attempting to spend the anchor output of. + */ +void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The unique identifier to re-derive the signer for the associated channel. + */ +const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; + +/** + * The unique identifier to re-derive the signer for the associated channel. + */ +void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + */ +struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); + +/** + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. + */ +void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); + +/** + * Constructs a new ChannelDerivationParameters given each field + */ +MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); + +/** + * Creates a copy of the ChannelDerivationParameters + */ +struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); + +/** + * Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); + +/** + * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read + */ +struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); + +/** + * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. + */ +void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); + +/** + * The parameters required to derive the signer for the HTLC input. + */ +struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The parameters required to derive the signer for the HTLC input. + */ +void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); + +/** + * The number of the commitment transaction in which the HTLC output lives. + */ +uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The number of the commitment transaction in which the HTLC output lives. + */ +void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. + */ +struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. + */ +void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. + */ +uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. + */ +void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The details of the HTLC as it appears in the commitment transaction. + */ +struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The details of the HTLC as it appears in the commitment transaction. + */ +void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); + +/** + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. + */ +struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. + */ +void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); + +/** + * The counterparty's signature required to spend the HTLC output. + */ +struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + +/** + * The counterparty's signature required to spend the HTLC output. + */ +void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); + +/** + * Creates a copy of the HTLCDescriptor + */ +struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); + +/** + * Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); + +/** + * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read + */ +struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); + +/** + * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); + +/** + * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint + * being spent by the HTLC input in the HTLC transaction. + */ +MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + +/** + * Returns the UTXO to be spent by the HTLC input, which can be obtained via + * [`Self::unsigned_tx_input`]. + */ +MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + +/** + * Returns the unsigned transaction input spending the HTLC output in the commitment + * transaction. + */ +MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + +/** + * Returns the delayed output created as a result of spending the HTLC output in the commitment + * transaction. + */ +MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + +/** + * Returns the witness script of the HTLC output in the commitment transaction. + */ +MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + +/** + * Returns the fully signed witness required to spend the HTLC output in the commitment + * transaction. + */ +MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); + +/** + * Derives the channel signer required to sign the HTLC input. + */ +MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); /** * Calls the free function if one is set */ -void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); +void ChannelSigner_free(struct LDKChannelSigner this_ptr); /** * Creates a copy of the Recipient @@ -40159,7 +47740,10 @@ MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey fun /** * Returns the counterparty's pubkeys. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40168,30 +47752,36 @@ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(con * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Returns the `contest_delay` value specified by us and applied on transactions broadcastable * by our counterparty, i.e., the amount of time that they have to wait to recover their funds * if they broadcast a transaction. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Returns whether the holder is the initiator. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40199,7 +47789,10 @@ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDK * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40207,7 +47800,10 @@ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_p * Returns the channel type features of the channel parameters. Should be helpful for * determining a channel's category, i. e. legacy/anchors/taproot/etc. * - * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg); @@ -40221,7 +47817,7 @@ MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features( * * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::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); +MUST_USE_RES struct LDKCResult_WitnessNoneZ 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 @@ -40235,7 +47831,7 @@ MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterpa * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay */ -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); +MUST_USE_RES struct LDKCResult_WitnessNoneZ 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 EntropySource which calls the relevant methods on this_arg. @@ -40317,7 +47913,7 @@ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const stru * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ -MUST_USE_RES struct LDKCResult_PartiallySignedTransactionNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); +MUST_USE_RES struct LDKCResult_CVec_u8ZNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); /** * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an @@ -40338,7 +47934,7 @@ MUST_USE_RES struct LDKCResult_PartiallySignedTransactionNoneZ KeysManager_sign_ * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ -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, struct LDKCOption_PackedLockTimeZ locktime); +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, struct LDKCOption_u32Z locktime); /** * Constructs a new EntropySource which calls the relevant methods on this_arg. @@ -40399,7 +47995,7 @@ MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t ( /** * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *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, struct LDKCOption_PackedLockTimeZ locktime); +MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *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, struct LDKCOption_u32Z locktime); /** * See [`KeysManager::derive_channel_keys`] for documentation on this method. @@ -40417,6 +48013,21 @@ MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const st */ MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +/** + * Calls the free function if one is set + */ +void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); + +/** + * Creates a copy of a WriteableEcdsaChannelSigner + */ +struct LDKWriteableEcdsaChannelSigner WriteableEcdsaChannelSigner_clone(const struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR orig); + +/** + * Calls the free function if one is set + */ +void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); + /** * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. */ @@ -40433,9 +48044,9 @@ void MessageRouter_free(struct LDKMessageRouter this_ptr); void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj); /** - * Constructs a new DefaultMessageRouter given each field + * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`]. */ -MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(void); +MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source); /** * Constructs a new MessageRouter which calls the relevant methods on this_arg. @@ -40470,16 +48081,39 @@ struct LDKDestination OnionMessagePath_get_destination(const struct LDKOnionMess */ void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKDestination val); +/** + * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. + * + * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use + * this to initiate such a connection. + * + * Returns a copy of the field. + */ +struct LDKCOption_CVec_SocketAddressZZ OnionMessagePath_get_first_node_addresses(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); + +/** + * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. + * + * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use + * this to initiate such a connection. + */ +void OnionMessagePath_set_first_node_addresses(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCOption_CVec_SocketAddressZZ val); + /** * Constructs a new OnionMessagePath given each field */ -MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg); +MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg, struct LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg); /** * Creates a copy of the OnionMessagePath */ struct LDKOnionMessagePath OnionMessagePath_clone(const struct LDKOnionMessagePath *NONNULL_PTR orig); +/** + * Returns the first node in the path. + */ +MUST_USE_RES struct LDKPublicKey OnionMessagePath_first_node(const struct LDKOnionMessagePath *NONNULL_PTR this_arg); + /** * Frees any resources used by the Destination */ @@ -40500,6 +48134,32 @@ struct LDKDestination Destination_node(struct LDKPublicKey a); */ struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); +/** + * Frees any resources used by the SendSuccess + */ +void SendSuccess_free(struct LDKSendSuccess this_ptr); + +/** + * Creates a copy of the SendSuccess + */ +struct LDKSendSuccess SendSuccess_clone(const struct LDKSendSuccess *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Buffered-variant SendSuccess + */ +struct LDKSendSuccess SendSuccess_buffered(void); + +/** + * Utility method to constructs a new BufferedAwaitingConnection-variant SendSuccess + */ +struct LDKSendSuccess SendSuccess_buffered_awaiting_connection(struct LDKPublicKey a); + +/** + * Checks if two SendSuccesss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool SendSuccess_eq(const struct LDKSendSuccess *NONNULL_PTR a, const struct LDKSendSuccess *NONNULL_PTR b); + /** * Frees any resources used by the SendError */ @@ -40528,7 +48188,12 @@ struct LDKSendError SendError_too_few_blinded_hops(void); /** * Utility method to constructs a new InvalidFirstHop-variant SendError */ -struct LDKSendError SendError_invalid_first_hop(void); +struct LDKSendError SendError_invalid_first_hop(struct LDKPublicKey a); + +/** + * Utility method to constructs a new PathNotFound-variant SendError + */ +struct LDKSendError SendError_path_not_found(void); /** * Utility method to constructs a new InvalidMessage-variant SendError @@ -40561,6 +48226,45 @@ bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSend */ void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); +/** + * Frees any resources used by the PeeledOnion + */ +void PeeledOnion_free(struct LDKPeeledOnion this_ptr); + +/** + * Creates a copy of the PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Forward-variant PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_forward(struct LDKPublicKey a, struct LDKOnionMessage b); + +/** + * Utility method to constructs a new Receive-variant PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKThirtyTwoBytes b, struct LDKBlindedPath c); + +/** + * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of + * `path`. + * + * Returns the node id of the peer to send the message to, the message itself, and any addresses + * need to connect to the first node. + * + * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path); + +/** + * Decode one layer of an incoming [`OnionMessage`]. + * + * Returns either the next layer of the onion for forwarding or the decrypted content for the + * receiver. + */ +struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); + /** * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to * their respective handlers. @@ -40568,13 +48272,13 @@ void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler); /** - * Send an onion message with contents `message` to the destination of `path`. + * Sends an [`OnionMessage`] with the given `contents` to `destination`. * * See [`OnionMessenger`] for example usage. * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); +MUST_USE_RES struct LDKCResult_SendSuccessSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessageContents contents, struct LDKDestination destination, struct LDKBlindedPath reply_path); /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. @@ -40582,12 +48286,6 @@ MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message( */ struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); -/** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is - */ -struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); - /** * Calls the free function if one is set */ @@ -40624,9 +48322,10 @@ struct LDKOffersMessage OffersMessage_invoice_error(struct LDKInvoiceError a); MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type); /** - * The TLV record type for the message as used in an `onionmsg_tlv` TLV stream. + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ -MUST_USE_RES uint64_t OffersMessage_tlv_type(const struct LDKOffersMessage *NONNULL_PTR this_arg); +struct LDKOnionMessageContents OffersMessage_as_OnionMessageContents(const struct LDKOffersMessage *NONNULL_PTR this_arg); /** * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read @@ -40639,30 +48338,174 @@ struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PT struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b); /** - * Frees any resources used by the OnionMessageContents + * Frees any resources used by the Packet, if is_owned is set and inner is non-NULL. */ -void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); +void Packet_free(struct LDKPacket this_obj); + +/** + * Bolt 04 version number + */ +uint8_t Packet_get_version(const struct LDKPacket *NONNULL_PTR this_ptr); + +/** + * Bolt 04 version number + */ +void Packet_set_version(struct LDKPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * Utility method to constructs a new Offers-variant OnionMessageContents + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKOnionMessageContents OnionMessageContents_offers(struct LDKOffersMessage a); +struct LDKPublicKey Packet_get_public_key(const struct LDKPacket *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Custom-variant OnionMessageContents + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); +void Packet_set_public_key(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Encrypted payload for the next hop + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z Packet_get_hop_data(const struct LDKPacket *NONNULL_PTR this_ptr); + +/** + * Encrypted payload for the next hop + */ +void Packet_set_hop_data(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * HMAC to verify the integrity of hop_data + */ +const uint8_t (*Packet_get_hmac(const struct LDKPacket *NONNULL_PTR this_ptr))[32]; + +/** + * HMAC to verify the integrity of hop_data + */ +void Packet_set_hmac(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constructs a new Packet given each field + */ +MUST_USE_RES struct LDKPacket Packet_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); + +/** + * Creates a copy of the Packet + */ +struct LDKPacket Packet_clone(const struct LDKPacket *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the Packet. + */ +uint64_t Packet_hash(const struct LDKPacket *NONNULL_PTR o); + +/** + * Checks if two Packets 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 Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NONNULL_PTR b); + +/** + * Serialize the Packet object into a byte array which can be read by Packet_read + */ +struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); + +/** + * Frees any resources used by the ParsedOnionMessageContents + */ +void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents this_ptr); + +/** + * Creates a copy of the ParsedOnionMessageContents + */ +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Offers-variant ParsedOnionMessageContents + */ +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); + +/** + * Utility method to constructs a new Custom-variant ParsedOnionMessageContents + */ +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a); + +/** + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + */ +struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_arg); + +/** + * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read + */ +struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj); + +/** + * Creates a copy of a OnionMessageContents + */ +struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig); /** * Calls the free function if one is set */ -void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr); +void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); /** * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. */ void BlindedPath_free(struct LDKBlindedPath this_obj); +/** + * To send to a blinded path, the sender first finds a route to the unblinded + * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion + * message or payment's next hop and forward it along. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +struct LDKPublicKey BlindedPath_get_introduction_node_id(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * To send to a blinded path, the sender first finds a route to the unblinded + * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion + * message or payment's next hop and forward it along. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +void BlindedPath_set_introduction_node_id(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion + * message or payment. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +struct LDKPublicKey BlindedPath_get_blinding_point(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion + * message or payment. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload + */ +void BlindedPath_set_blinding_point(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The hops composing the blinded path. + */ +struct LDKCVec_BlindedHopZ BlindedPath_get_blinded_hops(const struct LDKBlindedPath *NONNULL_PTR this_ptr); + +/** + * The hops composing the blinded path. + */ +void BlindedPath_set_blinded_hops(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); + +/** + * Constructs a new BlindedPath given each field + */ +MUST_USE_RES struct LDKBlindedPath BlindedPath_new(struct LDKPublicKey introduction_node_id_arg, struct LDKPublicKey blinding_point_arg, struct LDKCVec_BlindedHopZ blinded_hops_arg); + /** * Creates a copy of the BlindedPath */ @@ -40685,6 +48528,33 @@ bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDK */ void BlindedHop_free(struct LDKBlindedHop this_obj); +/** + * The blinded node id of this hop in a [`BlindedPath`]. + */ +struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); + +/** + * The blinded node id of this hop in a [`BlindedPath`]. + */ +void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr); + +/** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + */ +void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new BlindedHop given each field + */ +MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg); + /** * Creates a copy of the BlindedHop */ @@ -40702,14 +48572,36 @@ uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); */ bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); +/** + * Create a one-hop blinded path for a message. + */ +MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_one_hop_for_message(struct LDKPublicKey recipient_node_id, const struct LDKEntropySource *NONNULL_PTR entropy_source); + /** * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node * pubkey in `node_pks` will be the destination node. * - * Errors if less than two hops are provided or if `node_pk`(s) are invalid. + * Errors if no hops are provided or if `node_pk`(s) are invalid. */ MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); +/** + * Create a one-hop blinded path for a payment. + */ +MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, const struct LDKEntropySource *NONNULL_PTR entropy_source); + +/** + * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. + * + * Errors if: + * * a provided node id is invalid + * * [`BlindedPayInfo`] calculation results in an integer overflow + * * any unknown features are required in the provided [`ForwardTlvs`] + * + * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs + */ +MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_new_for_payment(struct LDKCVec_ForwardNodeZ intermediate_nodes, struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint64_t htlc_maximum_msat, const struct LDKEntropySource *NONNULL_PTR entropy_source); + /** * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read */ @@ -40730,6 +48622,263 @@ struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj) */ struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); +/** + * Frees any resources used by the ForwardNode, if is_owned is set and inner is non-NULL. + */ +void ForwardNode_free(struct LDKForwardNode this_obj); + +/** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ +struct LDKForwardTlvs ForwardNode_get_tlvs(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. + */ +void ForwardNode_set_tlvs(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); + +/** + * This node's pubkey. + */ +struct LDKPublicKey ForwardNode_get_node_id(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * This node's pubkey. + */ +void ForwardNode_set_node_id(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The maximum value, in msat, that may be accepted by this node. + */ +uint64_t ForwardNode_get_htlc_maximum_msat(const struct LDKForwardNode *NONNULL_PTR this_ptr); + +/** + * The maximum value, in msat, that may be accepted by this node. + */ +void ForwardNode_set_htlc_maximum_msat(struct LDKForwardNode *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ForwardNode given each field + */ +MUST_USE_RES struct LDKForwardNode ForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); + +/** + * Creates a copy of the ForwardNode + */ +struct LDKForwardNode ForwardNode_clone(const struct LDKForwardNode *NONNULL_PTR orig); + +/** + * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. + */ +void ForwardTlvs_free(struct LDKForwardTlvs this_obj); + +/** + * The short channel id this payment should be forwarded out over. + */ +uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * The short channel id this payment should be forwarded out over. + */ +void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Payment parameters for relaying over [`Self::short_channel_id`]. + */ +struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Payment parameters for relaying over [`Self::short_channel_id`]. + */ +void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); + +/** + * Payment constraints for relaying over [`Self::short_channel_id`]. + */ +struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Payment constraints for relaying over [`Self::short_channel_id`]. + */ +void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. + * + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + */ +struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. + * + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + */ +void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); + +/** + * Constructs a new ForwardTlvs given each field + */ +MUST_USE_RES struct LDKForwardTlvs ForwardTlvs_new(uint64_t short_channel_id_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg); + +/** + * Creates a copy of the ForwardTlvs + */ +struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig); + +/** + * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. + */ +void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj); + +/** + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + */ +const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32]; + +/** + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + */ +void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constraints for the receiver of this payment. + */ +struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); + +/** + * Constraints for the receiver of this payment. + */ +void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Constructs a new ReceiveTlvs given each field + */ +MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg); + +/** + * Creates a copy of the ReceiveTlvs + */ +struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); + +/** + * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. + */ +void PaymentRelay_free(struct LDKPaymentRelay this_obj); + +/** + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + */ +uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + */ +void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val); + +/** + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). + */ +uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). + */ +void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + */ +uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); + +/** + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + */ +void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); + +/** + * Constructs a new PaymentRelay given each field + */ +MUST_USE_RES struct LDKPaymentRelay PaymentRelay_new(uint16_t cltv_expiry_delta_arg, uint32_t fee_proportional_millionths_arg, uint32_t fee_base_msat_arg); + +/** + * Creates a copy of the PaymentRelay + */ +struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); + +/** + * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. + */ +void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); + +/** + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + */ +uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); + +/** + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + */ +void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. + */ +uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); + +/** + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. + */ +void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new PaymentConstraints given each field + */ +MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); + +/** + * Creates a copy of the PaymentConstraints + */ +struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); + +/** + * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read + */ +struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj); + +/** + * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read + */ +struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); + +/** + * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read + */ +struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj); + +/** + * Read a PaymentRelay from a byte array, created by PaymentRelay_write + */ +struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser); + +/** + * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read + */ +struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj); + +/** + * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write + */ +struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser); + /** * Frees any resources used by the PaymentPurpose */ @@ -40743,7 +48892,7 @@ struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NO /** * Utility method to constructs a new InvoicePayment-variant PaymentPurpose */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_PaymentPreimageZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); +struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose @@ -40756,6 +48905,11 @@ struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoB */ bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); +/** + * Returns the preimage for this payment, if it is known. + */ +MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ PaymentPurpose_preimage(const struct LDKPaymentPurpose *NONNULL_PTR this_arg); + /** * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read */ @@ -40766,6 +48920,118 @@ struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_ */ struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +/** + * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. + */ +void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj); + +/** + * The `channel_id` of the channel over which the HTLC was received. + */ +const uint8_t (*ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr))[32]; + +/** + * The `channel_id` of the channel over which the HTLC was received. + */ +void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ +struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ +void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); + +/** + * The block height at which this HTLC expires. + */ +uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The block height at which this HTLC expires. + */ +void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); + +/** + * The amount (in msats) of this part of an MPP. + */ +uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The amount (in msats) of this part of an MPP. + */ +void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. + */ +uint64_t ClaimedHTLC_get_counterparty_skimmed_fee_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. + */ +void ClaimedHTLC_set_counterparty_skimmed_fee_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new ClaimedHTLC given each field + */ +MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg, uint64_t counterparty_skimmed_fee_msat_arg); + +/** + * Creates a copy of the ClaimedHTLC + */ +struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); + +/** + * Checks if two ClaimedHTLCs 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 ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); + +/** + * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read + */ +struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); + +/** + * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser); + /** * Frees any resources used by the PathFailure */ @@ -40857,6 +49123,11 @@ struct LDKClosureReason ClosureReason_outdated_channel_manager(void); */ struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); +/** + * Utility method to constructs a new FundingBatchClosure-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_funding_batch_closure(void); + /** * Checks if two ClosureReasons contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -40988,17 +49259,27 @@ struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporar /** * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKCOption_ThirtyTwoBytesZ via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); /** * Utility method to constructs a new PaymentClaimed-variant Event */ -struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat); + +/** + * Utility method to constructs a new ConnectionNeeded-variant Event + */ +struct LDKEvent Event_connection_needed(struct LDKPublicKey node_id, struct LDKCVec_SocketAddressZ addresses); + +/** + * Utility method to constructs a new InvoiceRequestFailed-variant Event + */ +struct LDKEvent Event_invoice_request_failed(struct LDKThirtyTwoBytes payment_id); /** * Utility method to constructs a new PaymentSent-variant Event */ -struct LDKEvent Event_payment_sent(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); +struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); /** * Utility method to constructs a new PaymentFailed-variant Event @@ -41008,12 +49289,12 @@ struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct /** * Utility method to constructs a new PaymentPathSuccessful-variant Event */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_PaymentHashZ payment_hash, struct LDKPath path); +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path); /** * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKEvent Event_payment_path_failed(struct LDKCOption_PaymentIdZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); +struct LDKEvent Event_payment_path_failed(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** * Utility method to constructs a new ProbeSuccessful-variant Event @@ -41038,17 +49319,17 @@ struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uin /** * Utility method to constructs a new SpendableOutputs-variant Event */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKCOption_ThirtyTwoBytesZ channel_id); /** * Utility method to constructs a new PaymentForwarded-variant Event */ -struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); +struct LDKEvent Event_payment_forwarded(struct LDKCOption_ThirtyTwoBytesZ prev_channel_id, struct LDKCOption_ThirtyTwoBytesZ next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** * Utility method to constructs a new ChannelPending-variant Event */ -struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKThirtyTwoBytes former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); +struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); /** * Utility method to constructs a new ChannelReady-variant Event @@ -41058,7 +49339,7 @@ struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct /** * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo); /** * Utility method to constructs a new DiscardFunding-variant Event @@ -41136,6 +49417,26 @@ struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPubli */ struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); +/** + * Utility method to constructs a new SendStfu-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_stfu(struct LDKPublicKey node_id, struct LDKStfu msg); + +/** + * Utility method to constructs a new SendSplice-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_splice(struct LDKPublicKey node_id, struct LDKSplice msg); + +/** + * Utility method to constructs a new SendSpliceAck-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_splice_ack(struct LDKPublicKey node_id, struct LDKSpliceAck msg); + +/** + * Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_send_splice_locked(struct LDKPublicKey node_id, struct LDKSpliceLocked msg); + /** * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent */ @@ -41179,7 +49480,7 @@ struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey /** * Utility method to constructs a new SendTxAbort-variant MessageSendEvent */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAddInput msg); +struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); /** * Utility method to constructs a new SendChannelReady-variant MessageSendEvent @@ -41271,11 +49572,6 @@ struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct */ void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); -/** - * Calls the free function if one is set - */ -void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr); - /** * Calls the free function if one is set */ @@ -41286,64 +49582,6 @@ void EventsProvider_free(struct LDKEventsProvider this_ptr); */ void EventHandler_free(struct LDKEventHandler this_ptr); -/** - * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. - */ -void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); - -/** - * The value in satoshis of the channel we're attempting to spend the anchor output of. - */ -uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); - -/** - * The value in satoshis of the channel we're attempting to spend the anchor output of. - */ -void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); - -/** - * The unique identifier to re-derive the signer for the associated channel. - */ -const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; - -/** - * The unique identifier to re-derive the signer for the associated channel. - */ -void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - -/** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. - * - * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters - */ -struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); - -/** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. - * - * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters - */ -void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); - -/** - * Constructs a new ChannelDerivationParameters given each field - */ -MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); - -/** - * Creates a copy of the ChannelDerivationParameters - */ -struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); - -/** - * Checks if two ChannelDerivationParameterss 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 ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); - /** * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. */ @@ -41409,140 +49647,13 @@ MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDK * Returns the fully signed witness required to spend the anchor output in the commitment * transaction. */ -MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature); +MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); /** * Derives the channel signer required to sign the anchor input. */ MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); -/** - * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. - */ -void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); - -/** - * The parameters required to derive the signer for the HTLC input. - */ -struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The parameters required to derive the signer for the HTLC input. - */ -void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); - -/** - * The number of the commitment transaction in which the HTLC output lives. - */ -uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The number of the commitment transaction in which the HTLC output lives. - */ -void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); - -/** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. - * - * See for more info. - */ -struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. - * - * See for more info. - */ -void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); - -/** - * The details of the HTLC as it appears in the commitment transaction. - */ -struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The details of the HTLC as it appears in the commitment transaction. - */ -void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); - -/** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. - */ -struct LDKCOption_PaymentPreimageZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. - */ -void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_PaymentPreimageZ val); - -/** - * The counterparty's signature required to spend the HTLC output. - */ -struct LDKSignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - -/** - * The counterparty's signature required to spend the HTLC output. - */ -void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKSignature val); - -/** - * Creates a copy of the HTLCDescriptor - */ -struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); - -/** - * Checks if two HTLCDescriptors 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 HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); - -/** - * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint - * being spent by the HTLC input in the HTLC transaction. - */ -MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - -/** - * Returns the UTXO to be spent by the HTLC input, which can be obtained via - * [`Self::unsigned_tx_input`]. - */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - -/** - * Returns the unsigned transaction input spending the HTLC output in the commitment - * transaction. - */ -MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - -/** - * Returns the delayed output created as a result of spending the HTLC output in the commitment - * transaction. - */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - -/** - * Returns the witness script of the HTLC output in the commitment transaction. - */ -MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - -/** - * Returns the fully signed witness required to spend the HTLC output in the commitment - * transaction. - */ -MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKSignature signature, struct LDKu8slice witness_script); - -/** - * Derives the channel signer required to sign the HTLC input. - */ -MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); - /** * Frees any resources used by the BumpTransactionEvent */ @@ -41784,25 +49895,25 @@ MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_n void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); /** - * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL. + * Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL. */ -void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); +void FilesystemStore_free(struct LDKFilesystemStore this_obj); /** - * Initialize a new FilesystemPersister and set the path to the individual channels' - * files. + * Constructs a new [`FilesystemStore`]. */ -MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data); +MUST_USE_RES struct LDKFilesystemStore FilesystemStore_new(struct LDKStr data_dir); /** - * Get the directory which was provided when this persister was initialized. + * Returns the data directory. */ -MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** - * Read `ChannelMonitor`s from disk. + * Constructs a new KVStore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned KVStore must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKEntropySource entropy_source, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +struct LDKKVStore FilesystemStore_as_KVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. @@ -41888,7 +49999,7 @@ MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKP * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); /** * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -41901,7 +50012,7 @@ MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBac * * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); /** * Frees any resources used by the Bolt11ParseError @@ -42488,7 +50599,7 @@ MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(c /** * Recovers the public key used for signing the invoice from the recoverable signature. */ -MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PayeePubKeySecp256k1ErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** * Checks if the signature is valid for the included payee public key or if none exists if it's @@ -42537,7 +50648,7 @@ MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKR */ MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); -MUST_USE_RES struct LDKCOption_PaymentSecretZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ RawBolt11Invoice_payment_secret(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawBolt11Invoice_payment_metadata(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); @@ -42682,7 +50793,7 @@ MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struc * Returns the Duration since the Unix epoch at which the invoice expires. * Returning None if overflow occurred. */ -MUST_USE_RES struct LDKCOption_DurationZ Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. @@ -42720,7 +50831,7 @@ MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDK /** * Returns a list of all fallback addresses as [`Address`]es */ -MUST_USE_RES struct LDKCVec_AddressZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_StrZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** * Returns a list of all routes included in the invoice @@ -42751,9 +50862,14 @@ MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const st MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description); /** - * Returns the underlying description [`String`] + * Returns the underlying description [`UntrustedString`] */ -MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg); +MUST_USE_RES struct LDKUntrustedString Description_into_inner(struct LDKDescription this_arg); + +/** + * Get the string representation of a Description object + */ +struct LDKStr Description_to_str(const struct LDKDescription *NONNULL_PTR o); /** * Construct an `ExpiryTime` from seconds. @@ -42929,83 +51045,35 @@ bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); /** - * Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`]. + * Builds the necessary parameters to pay or pre-flight probe the given zero-amount + * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or + * [`ChannelManager::send_preflight_probes`]. * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. * - * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. - */ -struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on - * [`Retry`]. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. - * - * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. - */ -struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount, retrying if needed based on - * [`Retry`]. - * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. + * Will always succeed unless the invoice has an amount specified, in which case + * [`payment_parameters_from_invoice`] should be used. * - * If you wish to use a different payment idempotency token, see - * [`pay_zero_value_invoice_with_id`]. + * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes */ -struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat); /** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key, - * retrying if needed based on [`Retry`]. + * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using + * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. + * Will always succeed unless the invoice has no amount specified, in which case + * [`payment_parameters_from_zero_amount_invoice`] should be used. * - * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the - * idempotency token. + * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes */ -struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * 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 Sending-variant PaymentError - */ -struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a); - -/** - * Checks if two PaymentErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct LDKPaymentError *NONNULL_PTR b); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice); /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" @@ -43049,7 +51117,7 @@ bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct L * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" @@ -43091,7 +51159,7 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struc * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_PaymentHashZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom @@ -43199,6 +51267,26 @@ struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o); */ struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o); +/** + * Frees any resources used by the GraphSyncError + */ +void GraphSyncError_free(struct LDKGraphSyncError this_ptr); + +/** + * Creates a copy of the GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new DecodeError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); + +/** + * Utility method to constructs a new LightningError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); + /** * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL. */ @@ -43242,26 +51330,6 @@ MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network */ MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); -/** - * Frees any resources used by the GraphSyncError - */ -void GraphSyncError_free(struct LDKGraphSyncError this_ptr); - -/** - * Creates a copy of the GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new DecodeError-variant GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); - -/** - * Utility method to constructs a new LightningError-variant GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); - #endif /* LDK_C_BINDINGS_H */ #include "ldk_ver.h"