X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=401ba8d4df0fed0d80860c4669a490818756a079;hb=11b997c3a0452ea1da5b7b352e7887798105db29;hp=8b6468cb4dd62e524269446a2e72364cecefa9e1;hpb=a21177846ed75d66f68a1603f768410f07a65791;p=ldk-c-bindings diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 8b6468c..401ba8d 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -10,24 +10,6 @@ #include #include "ldk_rust_types.h" -/** - * An error when accessing the chain via [`Access`]. - */ -typedef enum LDKAccessError { - /** - * The requested chain is unknown. - */ - LDKAccessError_UnknownChain, - /** - * The requested transaction doesn't exist or hasn't confirmed. - */ - LDKAccessError_UnknownTx, - /** - * Must be last for serialization purposes - */ - LDKAccessError_Sentinel, -} LDKAccessError; - /** * An enum which can either contain a or not */ @@ -185,6 +167,12 @@ typedef enum LDKCreationError { * [phantom invoices]: crate::utils::create_phantom_invoice */ LDKCreationError_MissingRouteHints, + /** + * The provided `min_final_cltv_expiry_delta` was less than [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + */ + LDKCreationError_MinFinalCltvExpiryDeltaTooShort, /** * Must be last for serialization purposes */ @@ -221,6 +209,66 @@ 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. + */ +typedef enum LDKHTLCClaim { + /** + * Claims an offered output on a commitment transaction through the timeout path. + */ + LDKHTLCClaim_OfferedTimeout, + /** + * Claims an offered output on a commitment transaction through the success path. + */ + LDKHTLCClaim_OfferedPreimage, + /** + * Claims an accepted output on a commitment transaction through the timeout path. + */ + LDKHTLCClaim_AcceptedTimeout, + /** + * Claims an accepted output on a commitment transaction through the success path. + */ + LDKHTLCClaim_AcceptedPreimage, + /** + * Claims an offered/accepted output on a commitment transaction through the revocation path. + */ + LDKHTLCClaim_Revocation, + /** + * Must be last for serialization purposes + */ + LDKHTLCClaim_Sentinel, +} LDKHTLCClaim; + /** * Represents an IO Error. Note that some information is lost in the conversion from Rust. */ @@ -310,8 +358,10 @@ typedef enum LDKNetwork { } LDKNetwork; /** - * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node - * secret key should be used to sign the invoice. + * Specifies the recipient of an invoice. + * + * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign + * the invoice. */ typedef enum LDKRecipient { /** @@ -331,6 +381,41 @@ typedef enum LDKRecipient { LDKRecipient_Sentinel, } LDKRecipient; +/** + * Indicates an immediate error on [`ChannelManager::send_payment_with_retry`]. Further errors + * may be surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`]. + * + * [`ChannelManager::send_payment_with_retry`]: crate::ln::channelmanager::ChannelManager::send_payment_with_retry + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed + */ +typedef enum LDKRetryableSendFailure { + /** + * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note + * that this error is *not* caused by [`Retry::Timeout`]. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKRetryableSendFailure_PaymentExpired, + /** + * We were unable to find a route to the destination. + */ + LDKRetryableSendFailure_RouteNotFound, + /** + * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]). + * + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed + */ + LDKRetryableSendFailure_DuplicatePayment, + /** + * Must be last for serialization purposes + */ + LDKRetryableSendFailure_Sentinel, +} LDKRetryableSendFailure; + /** * Represents an error returned from libsecp256k1 during validation of some secp256k1 data */ @@ -463,6 +548,24 @@ typedef enum LDKSiPrefix { LDKSiPrefix_Sentinel, } LDKSiPrefix; +/** + * An error when accessing the chain via [`UtxoLookup`]. + */ +typedef enum LDKUtxoLookupError { + /** + * The requested chain is unknown. + */ + LDKUtxoLookupError_UnknownChain, + /** + * The requested transaction doesn't exist or hasn't confirmed. + */ + LDKUtxoLookupError_UnknownTx, + /** + * Must be last for serialization purposes + */ + LDKUtxoLookupError_Sentinel, +} LDKUtxoLookupError; + /** * A Rust str object, ie a reference to a UTF8-valid string. * This is *not* null-terminated so cannot be used directly as a C string! @@ -482,6 +585,29 @@ typedef struct LDKStr { bool chars_is_owned; } LDKStr; +/** + * A 16-byte byte array. + */ +typedef struct LDKSixteenBytes { + /** + * The sixteen bytes + */ + uint8_t data[16]; +} LDKSixteenBytes; + +/** + * Unsigned, 128-bit integer. + * + * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here. + * See https://github.com/rust-lang/rust/issues/54341 for more details. + */ +typedef struct LDKU128 { + /** + * The 128-bit integer, as 16 little-endian bytes + */ + uint8_t le_bytes[16]; +} LDKU128; + /** * Represents a scalar value between zero and the secp256k1 curve order, in big endian. */ @@ -585,6 +711,26 @@ typedef struct LDKTransaction { bool data_is_owned; } LDKTransaction; +/** + * A serialized witness. + */ +typedef struct LDKWitness { + /** + * The serialized transaction data. + * + * This is non-const for your convenience, an object passed to Rust is never written to. + */ + uint8_t *data; + /** + * The length of the serialized transaction + */ + uintptr_t datalen; + /** + * Whether the data pointed to by `data` should be freed or not. + */ + bool data_is_owned; +} LDKWitness; + /** * A dynamically-allocated array of u8s of arbitrary size. * This corresponds to std::vector in C++ @@ -616,221 +762,223 @@ typedef struct LDKTxOut { uint64_t value; } LDKTxOut; -/** - * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. - */ -typedef struct LDKPublicKey { - /** - * The bytes of the public key - */ - uint8_t compressed_form[33]; -} LDKPublicKey; - -/** - * 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; - /** - * Onion messages can be sent and received to blinded routes, which serve to hide the identity of - * the recipient. + * A script pubkey for shutting down a channel as defined by [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -typedef struct MUST_USE_STRUCT LDKBlindedRoute { +typedef struct MUST_USE_STRUCT LDKShutdownScript { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBlindedRoute *inner; + LDKnativeShutdownScript *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; -} LDKBlindedRoute; +} LDKShutdownScript; /** - * The contents of CResult_BlindedRouteNoneZ + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) */ -typedef union LDKCResult_BlindedRouteNoneZPtr { +typedef enum LDKAPIError_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. */ - struct LDKBlindedRoute *result; + LDKAPIError_APIMisuseError, /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. */ - void *err; -} LDKCResult_BlindedRouteNoneZPtr; - -/** - * A CResult_BlindedRouteNoneZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_BlindedRouteNoneZ { + LDKAPIError_FeeRateTooHigh, /** - * The contents of this CResult_BlindedRouteNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). */ - union LDKCResult_BlindedRouteNoneZPtr contents; + LDKAPIError_InvalidRoute, /** - * Whether this CResult_BlindedRouteNoneZ represents a success state. + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. */ - bool result_ok; -} LDKCResult_BlindedRouteNoneZ; - -/** - * An error in decoding a message or struct. - */ -typedef enum LDKDecodeError_Tag { + LDKAPIError_ChannelUnavailable, /** - * A version byte specified something we don't know how to handle. - * Includes unknown realm byte in an OnionHopData packet + * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] + * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a + * monitor update is awaiting async resolution. Once it resolves the attempted action should + * complete automatically. + * + * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel + * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress */ - LDKDecodeError_UnknownVersion, + LDKAPIError_MonitorUpdateInProgress, /** - * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type) + * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * with the channel counterparty as negotiated in [`InitFeatures`]. + * + * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open + * a channel or cooperatively close one with this peer (and will have to force-close instead). + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey + * [`InitFeatures`]: crate::ln::features::InitFeatures */ - LDKDecodeError_UnknownRequiredFeature, + LDKAPIError_IncompatibleShutdownScript, /** - * Value was invalid, eg 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 + * Must be last for serialization purposes */ - LDKDecodeError_InvalidValue, + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { /** - * Buffer too short + * A human-readable error message */ - LDKDecodeError_ShortRead, + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { /** - * A length descriptor in the packet didn't describe the later data correctly + * A human-readable error message */ - LDKDecodeError_BadLengthDescriptor, + struct LDKStr err; /** - * Error from std::io + * The feerate which was too high. */ - LDKDecodeError_Io, + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKInvalidRoute_Body { /** - * The message included zlib-compressed values, which we don't support. + * A human-readable error message */ - LDKDecodeError_UnsupportedCompression, + struct LDKStr err; +} LDKAPIError_LDKInvalidRoute_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { /** - * Must be last for serialization purposes + * A human-readable error message */ - LDKDecodeError_Sentinel, -} LDKDecodeError_Tag; + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; -typedef struct MUST_USE_STRUCT LDKDecodeError { - LDKDecodeError_Tag tag; +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + /** + * The incompatible shutdown script. + */ + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; union { - struct { - enum LDKIOError io; - }; + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKInvalidRoute_Body invalid_route; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; }; -} LDKDecodeError; +} LDKAPIError; /** - * The contents of CResult_BlindedRouteDecodeErrorZ + * The contents of CResult_NoneAPIErrorZ */ -typedef union LDKCResult_BlindedRouteDecodeErrorZPtr { +typedef union LDKCResult_NoneAPIErrorZPtr { /** - * 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 LDKBlindedRoute *result; + void *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_BlindedRouteDecodeErrorZPtr; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; /** - * A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NoneAPIErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_BlindedRouteDecodeErrorZ { +typedef struct LDKCResult_NoneAPIErrorZ { /** - * The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either + * The contents of this CResult_NoneAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedRouteDecodeErrorZPtr contents; + union LDKCResult_NoneAPIErrorZPtr contents; /** - * Whether this CResult_BlindedRouteDecodeErrorZ represents a success state. + * Whether this CResult_NoneAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedRouteDecodeErrorZ; - - +} LDKCResult_NoneAPIErrorZ; /** - * Used to construct the blinded hops portion of a blinded route. These hops cannot be identified - * by outside observers and thus can be used to hide the identity of the recipient. + * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKBlindedHop { +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativeBlindedHop *inner; + struct LDKCResult_NoneAPIErrorZ *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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKBlindedHop; + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; /** - * The contents of CResult_BlindedHopDecodeErrorZ + * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_BlindedHopDecodeErrorZPtr { +typedef struct LDKCVec_APIErrorZ { /** - * 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 LDKBlindedHop *result; + struct LDKAPIError *data; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The number of elements pointed to by `data`. */ - struct LDKDecodeError *err; -} LDKCResult_BlindedHopDecodeErrorZPtr; + uintptr_t datalen; +} LDKCVec_APIErrorZ; /** - * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::blinded_route::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not */ -typedef struct LDKCResult_BlindedHopDecodeErrorZ { +typedef enum LDKCOption_HTLCClaimZ_Tag { /** - * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim */ - union LDKCResult_BlindedHopDecodeErrorZPtr contents; + LDKCOption_HTLCClaimZ_Some, /** - * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + * When we're in this state, this COption_HTLCClaimZ contains nothing */ - bool result_ok; -} LDKCResult_BlindedHopDecodeErrorZ; + LDKCOption_HTLCClaimZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_HTLCClaimZ_Sentinel, +} LDKCOption_HTLCClaimZ_Tag; + +typedef struct LDKCOption_HTLCClaimZ { + LDKCOption_HTLCClaimZ_Tag tag; + union { + struct { + enum LDKHTLCClaim some; + }; + }; +} LDKCOption_HTLCClaimZ; /** * The contents of CResult_NoneNoneZ @@ -888,113 +1036,90 @@ typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { } LDKCounterpartyCommitmentSecrets; /** - * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ + * An error in decoding a message or struct. */ -typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCounterpartyCommitmentSecrets *result; +typedef enum LDKDecodeError_Tag { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * A version byte specified something we don't know how to handle. + * + * Includes unknown realm byte in an onion hop data packet. */ - struct LDKDecodeError *err; -} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr; - -/** - * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets 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_CounterpartyCommitmentSecretsDecodeErrorZ { + LDKDecodeError_UnknownVersion, /** - * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) */ - union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; + LDKDecodeError_UnknownRequiredFeature, /** - * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + * 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. */ - bool result_ok; -} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; - -/** - * Represents a valid secp256k1 secret key serialized as a 32 byte array. - */ -typedef struct LDKSecretKey { + LDKDecodeError_InvalidValue, /** - * The bytes of the secret key + * The buffer to be read was too short. */ - uint8_t bytes[32]; -} LDKSecretKey; - -/** - * The contents of CResult_SecretKeyErrorZ - */ -typedef union LDKCResult_SecretKeyErrorZPtr { + LDKDecodeError_ShortRead, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A length descriptor in the packet didn't describe the later data correctly. */ - struct LDKSecretKey *result; + LDKDecodeError_BadLengthDescriptor, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Error from [`std::io`]. */ - enum LDKSecp256k1Error *err; -} LDKCResult_SecretKeyErrorZPtr; - -/** - * A CResult_SecretKeyErrorZ represents the result of a fallible operation, - * containing a crate::c_types::SecretKey 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_SecretKeyErrorZ { + LDKDecodeError_Io, /** - * The contents of this CResult_SecretKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The message included zlib-compressed values, which we don't support. */ - union LDKCResult_SecretKeyErrorZPtr contents; + LDKDecodeError_UnsupportedCompression, /** - * Whether this CResult_SecretKeyErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_SecretKeyErrorZ; + LDKDecodeError_Sentinel, +} LDKDecodeError_Tag; + +typedef struct MUST_USE_STRUCT LDKDecodeError { + LDKDecodeError_Tag tag; + union { + struct { + enum LDKIOError io; + }; + }; +} LDKDecodeError; /** - * The contents of CResult_PublicKeyErrorZ + * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ */ -typedef union LDKCResult_PublicKeyErrorZPtr { +typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPublicKey *result; + struct LDKCounterpartyCommitmentSecrets *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKSecp256k1Error *err; -} LDKCResult_PublicKeyErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr; /** - * A CResult_PublicKeyErrorZ represents the result of a fallible operation, - * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. + * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets 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_PublicKeyErrorZ { +typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ { /** - * The contents of this CResult_PublicKeyErrorZ, accessible via either + * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PublicKeyErrorZPtr contents; + union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; /** - * Whether this CResult_PublicKeyErrorZ represents a success state. + * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PublicKeyErrorZ; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; @@ -1112,39 +1237,6 @@ typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { bool result_ok; } LDKCResult_ChannelPublicKeysDecodeErrorZ; -/** - * The contents of CResult_TxCreationKeysErrorZ - */ -typedef union LDKCResult_TxCreationKeysErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxCreationKeys *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKSecp256k1Error *err; -} LDKCResult_TxCreationKeysErrorZPtr; - -/** - * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::TxCreationKeys 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_TxCreationKeysErrorZ { - /** - * The contents of this CResult_TxCreationKeysErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TxCreationKeysErrorZPtr contents; - /** - * Whether this CResult_TxCreationKeysErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_TxCreationKeysErrorZ; - /** * An enum which can either contain a u32 or not */ @@ -1673,28 +1765,6 @@ typedef struct LDKCResult_CVec_SignatureZNoneZ { bool result_ok; } LDKCResult_CVec_SignatureZNoneZ; - - -/** - * A script pubkey for shutting down a channel as defined by [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md - */ -typedef struct MUST_USE_STRUCT LDKShutdownScript { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeShutdownScript *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; -} LDKShutdownScript; - /** * The contents of CResult_ShutdownScriptDecodeErrorZ */ @@ -1781,71 +1851,237 @@ typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { bool result_ok; } LDKCResult_ShutdownScriptInvalidShutdownScriptZ; - +/** + * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. + */ +typedef struct LDKPublicKey { + /** + * The bytes of the public key + */ + uint8_t compressed_form[33]; +} LDKPublicKey; /** - * Represents the compressed public key of a node + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKNodeId { +typedef struct LDKCVec_PublicKeyZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativeNodeId *inner; + struct LDKPublicKey *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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKNodeId; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; /** - * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + * Onion messages can be sent and received to blinded paths, which serve to hide the identity of + * the recipient. */ -typedef struct MUST_USE_STRUCT LDKChannelUsage { +typedef struct MUST_USE_STRUCT LDKBlindedPath { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelUsage *inner; + LDKnativeBlindedPath *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; -} LDKChannelUsage; - - +} LDKBlindedPath; /** - * A hop in a route + * The contents of CResult_BlindedPathNoneZ */ -typedef struct MUST_USE_STRUCT LDKRouteHop { +typedef union LDKCResult_BlindedPathNoneZPtr { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKnativeRouteHop *inner; + struct LDKBlindedPath *result; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Note that this value is always NULL, as there are no contents in the Err variant */ - bool is_owned; -} LDKRouteHop; + void *err; +} LDKCResult_BlindedPathNoneZPtr; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_BlindedPathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_RouteHopZ { +typedef struct LDKCResult_BlindedPathNoneZ { + /** + * The contents of this CResult_BlindedPathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPathNoneZPtr contents; + /** + * Whether this CResult_BlindedPathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPathNoneZ; + +/** + * The contents of CResult_BlindedPathDecodeErrorZ + */ +typedef union LDKCResult_BlindedPathDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedPath *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_BlindedPathDecodeErrorZPtr; + +/** + * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_path::BlindedPath 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_BlindedPathDecodeErrorZ { + /** + * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPathDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedPathDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPathDecodeErrorZ; + + + +/** + * 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. + */ +typedef struct MUST_USE_STRUCT LDKBlindedHop { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedHop *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; +} LDKBlindedHop; + +/** + * The contents of CResult_BlindedHopDecodeErrorZ + */ +typedef union LDKCResult_BlindedHopDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedHop *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_BlindedHopDecodeErrorZPtr; + +/** + * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_path::BlindedHop 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_BlindedHopDecodeErrorZ { + /** + * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedHopDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedHopDecodeErrorZ; + + + +/** + * 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; + + + +/** + * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + */ +typedef struct MUST_USE_STRUCT LDKChannelUsage { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelUsage *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; +} LDKChannelUsage; + + + +/** + * A hop in a route + */ +typedef struct MUST_USE_STRUCT LDKRouteHop { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHop *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; +} LDKRouteHop; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHopZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). @@ -2019,54 +2255,41 @@ typedef struct LDKCResult_NoneErrorZ { bool result_ok; } LDKCResult_NoneErrorZ; -/** - * The contents of CResult_RouteHopDecodeErrorZ - */ -typedef union LDKCResult_RouteHopDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRouteHop *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_RouteHopDecodeErrorZPtr; + /** - * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels */ -typedef struct LDKCResult_RouteHopDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** - * The contents of this CResult_RouteHopDecodeErrorZ, 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_RouteHopDecodeErrorZPtr contents; + LDKnativeChannelDetails *inner; /** - * Whether this CResult_RouteHopDecodeErrorZ 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_RouteHopDecodeErrorZ; + bool is_owned; +} LDKChannelDetails; /** - * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_CVec_RouteHopZZ { +typedef struct LDKCVec_ChannelDetailsZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCVec_RouteHopZ *data; + struct LDKChannelDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_CVec_RouteHopZZ; +} LDKCVec_ChannelDetailsZ; @@ -2089,159 +2312,315 @@ typedef struct MUST_USE_STRUCT LDKRoute { bool is_owned; } LDKRoute; -/** - * The contents of CResult_RouteDecodeErrorZ - */ -typedef union LDKCResult_RouteDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRoute *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_RouteDecodeErrorZPtr; - -/** - * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route 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_RouteDecodeErrorZ { - /** - * The contents of this CResult_RouteDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteDecodeErrorZ; - /** - * Parameters needed to find a [`Route`]. - * - * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in - * [`Event::PaymentPathFailed`] for retrying a failed payment path. - * - * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * An Err type for failure to process messages. */ -typedef struct MUST_USE_STRUCT LDKRouteParameters { +typedef struct MUST_USE_STRUCT LDKLightningError { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRouteParameters *inner; + LDKnativeLightningError *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKRouteParameters; +} LDKLightningError; /** - * The contents of CResult_RouteParametersDecodeErrorZ + * The contents of CResult_RouteLightningErrorZ */ -typedef union LDKCResult_RouteParametersDecodeErrorZPtr { +typedef union LDKCResult_RouteLightningErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRouteParameters *result; + struct LDKRoute *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_RouteParametersDecodeErrorZPtr; + struct LDKLightningError *err; +} LDKCResult_RouteLightningErrorZPtr; /** - * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_RouteLightningErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_RouteParametersDecodeErrorZ { +typedef struct LDKCResult_RouteLightningErrorZ { /** - * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either + * The contents of this CResult_RouteLightningErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RouteParametersDecodeErrorZPtr contents; + union LDKCResult_RouteLightningErrorZPtr contents; /** - * Whether this CResult_RouteParametersDecodeErrorZ represents a success state. + * Whether this CResult_RouteLightningErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RouteParametersDecodeErrorZ; +} LDKCResult_RouteLightningErrorZ; + +/** + * 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; /** - * A list of hops along a payment path terminating with a channel to the recipient. + * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for + * in-use channel liquidity. */ -typedef struct MUST_USE_STRUCT LDKRouteHint { +typedef struct MUST_USE_STRUCT LDKInFlightHtlcs { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRouteHint *inner; + LDKnativeInFlightHtlcs *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKRouteHint; +} LDKInFlightHtlcs; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size. + * The contents of CResult_InFlightHtlcsDecodeErrorZ + */ +typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInFlightHtlcs *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_InFlightHtlcsDecodeErrorZPtr; + +/** + * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::InFlightHtlcs 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_InFlightHtlcsDecodeErrorZ { + /** + * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; + /** + * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InFlightHtlcsDecodeErrorZ; + +/** + * The contents of CResult_RouteHopDecodeErrorZ + */ +typedef union LDKCResult_RouteHopDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteHop *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_RouteHopDecodeErrorZPtr; + +/** + * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteHop 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_RouteHopDecodeErrorZ { + /** + * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteHopDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteHopDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_RouteHintZ { +typedef struct LDKCVec_CVec_RouteHopZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKRouteHint *data; + struct LDKCVec_RouteHopZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_RouteHintZ; +} LDKCVec_CVec_RouteHopZZ; /** - * An enum which can either contain a u64 or not + * The contents of CResult_RouteDecodeErrorZ */ -typedef enum LDKCOption_u64Z_Tag { +typedef union LDKCResult_RouteDecodeErrorZPtr { /** - * When we're in this state, this COption_u64Z contains a u64 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_u64Z_Some, + struct LDKRoute *result; /** - * When we're in this state, this COption_u64Z contains nothing + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_u64Z_None, + struct LDKDecodeError *err; +} LDKCResult_RouteDecodeErrorZPtr; + +/** + * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route 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_RouteDecodeErrorZ { /** - * Must be last for serialization purposes + * The contents of this CResult_RouteDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_u64Z_Sentinel, -} LDKCOption_u64Z_Tag; + union LDKCResult_RouteDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteDecodeErrorZ; -typedef struct LDKCOption_u64Z { - LDKCOption_u64Z_Tag tag; - union { - struct { - uint64_t some; - }; - }; -} LDKCOption_u64Z; + + +/** + * Parameters needed to find a [`Route`]. + * + * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in + * [`Event::PaymentPathFailed`]. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + */ +typedef struct MUST_USE_STRUCT LDKRouteParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteParameters *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRouteParameters; + +/** + * The contents of CResult_RouteParametersDecodeErrorZ + */ +typedef union LDKCResult_RouteParametersDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteParameters *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_RouteParametersDecodeErrorZPtr; + +/** + * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RouteParametersDecodeErrorZ { + /** + * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteParametersDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteParametersDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteParametersDecodeErrorZ; + + + +/** + * A list of hops along a payment path terminating with a channel to the recipient. + */ +typedef struct MUST_USE_STRUCT LDKRouteHint { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHint *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRouteHint; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHintZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKRouteHint *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_RouteHintZ; /** * A dynamically-allocated array of u64s of arbitrary size. @@ -2414,102 +2793,13 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintHopDecodeErrorZ; - - /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * Some information provided on receipt of payment depends on whether the payment received is a + * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. */ -typedef struct MUST_USE_STRUCT LDKChannelDetails { +typedef enum LDKPaymentPurpose_Tag { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelDetails *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKChannelDetails; - -/** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChannelDetailsZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKChannelDetails *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_ChannelDetailsZ; - - - -/** - * An Err type for failure to process messages. - */ -typedef struct MUST_USE_STRUCT LDKLightningError { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeLightningError *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; -} LDKLightningError; - -/** - * The contents of CResult_RouteLightningErrorZ - */ -typedef union LDKCResult_RouteLightningErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRoute *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKLightningError *err; -} LDKCResult_RouteLightningErrorZPtr; - -/** - * A CResult_RouteLightningErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_RouteLightningErrorZ { - /** - * The contents of this CResult_RouteLightningErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteLightningErrorZPtr contents; - /** - * Whether this CResult_RouteLightningErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteLightningErrorZ; - -/** - * Some information provided on receipt of payment depends on whether the payment received is a - * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. - */ -typedef enum LDKPaymentPurpose_Tag { - /** - * Information for receiving a payment that we generated an invoice for. + * Information for receiving a payment that we generated an invoice for. */ LDKPaymentPurpose_InvoicePayment, /** @@ -2593,157 +2883,383 @@ typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { bool result_ok; } LDKCResult_PaymentPurposeDecodeErrorZ; + + /** - * The reason the channel was closed. See individual variants more details. + * A [`channel_update`] message to be sent to or received from a peer. + * + * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ -typedef enum LDKClosureReason_Tag { +typedef struct MUST_USE_STRUCT LDKChannelUpdate { /** - * Closure generated from receiving a peer error message. - * - * Our counterparty may have broadcasted their latest commitment state, and we have - * as well. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKClosureReason_CounterpartyForceClosed, + LDKnativeChannelUpdate *inner; /** - * Closure generated from [`ChannelManager::force_close_channel`], called by the user. - * - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKClosureReason_HolderForceClosed, + bool is_owned; +} LDKChannelUpdate; + +/** + * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion + * return packet by a node along the route. See [BOLT #4] for details. + * + * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md + */ +typedef enum LDKNetworkUpdate_Tag { /** - * The channel was closed after negotiating a cooperative close and we've now broadcasted - * the cooperative close transaction. Note the shutdown may have been initiated by us. + * An error indicating a `channel_update` messages should be applied via + * [`NetworkGraph::update_channel`]. */ - LDKClosureReason_CooperativeClosure, + LDKNetworkUpdate_ChannelUpdateMessage, /** - * A commitment transaction was confirmed on chain, closing the channel. Most likely this - * commitment transaction came from our counterparty, but it may also have come from - * a copy of our own `ChannelMonitor`. + * An error indicating that a channel failed to route a payment, which should be applied via + * [`NetworkGraph::channel_failed`]. */ - LDKClosureReason_CommitmentTxConfirmed, + LDKNetworkUpdate_ChannelFailure, /** - * The funding transaction failed to confirm in a timely manner on an inbound channel. + * An error indicating that a node failed to route a payment, which should be applied via + * [`NetworkGraph::node_failed_permanent`] if permanent. */ - LDKClosureReason_FundingTimedOut, + LDKNetworkUpdate_NodeFailure, /** - * Closure generated from processing an event, likely a HTLC forward/relay/reception. + * Must be last for serialization purposes */ - LDKClosureReason_ProcessingError, + LDKNetworkUpdate_Sentinel, +} LDKNetworkUpdate_Tag; + +typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { /** - * The peer disconnected prior to funding completing. In this case the spec mandates that we - * forget the channel entirely - we can attempt again if the peer reconnects. - * - * This includes cases where we restarted prior to funding completion, including prior to the - * initial [`ChannelMonitor`] persistence completing. - * - * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the - * peer because of mutual incompatibility between us and our channel counterparty. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * The update to apply via [`NetworkGraph::update_channel`]. */ - LDKClosureReason_DisconnectedPeer, + struct LDKChannelUpdate msg; +} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + +typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { /** - * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than - * the [`ChannelManager`] deserialized. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * The short channel id of the closed channel. */ - LDKClosureReason_OutdatedChannelManager, + uint64_t short_channel_id; /** - * Must be last for serialization purposes + * Whether the channel should be permanently removed or temporarily disabled until a new + * `channel_update` message is received. */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; + bool is_permanent; +} LDKNetworkUpdate_LDKChannelFailure_Body; -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { +typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { /** - * The error which the peer sent us. - * - * The string should be sanitized before it is used (e.g emitted to logs - * or printed to stdout). Otherwise, a well crafted error message may exploit - * a security vulnerability in the terminal emulator or the logging subsystem. + * The node id of the failed node. */ - struct LDKStr peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { + struct LDKPublicKey node_id; /** - * A developer-readable error message which we generated. + * Whether the node should be permanently removed from consideration or can be restored + * when a new `channel_update` message is received. */ - struct LDKStr err; -} LDKClosureReason_LDKProcessingError_Body; + bool is_permanent; +} LDKNetworkUpdate_LDKNodeFailure_Body; -typedef struct MUST_USE_STRUCT LDKClosureReason { - LDKClosureReason_Tag tag; +typedef struct MUST_USE_STRUCT LDKNetworkUpdate { + LDKNetworkUpdate_Tag tag; union { - LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; - LDKClosureReason_LDKProcessingError_Body processing_error; + LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message; + LDKNetworkUpdate_LDKChannelFailure_Body channel_failure; + LDKNetworkUpdate_LDKNodeFailure_Body node_failure; }; -} LDKClosureReason; +} LDKNetworkUpdate; /** - * An enum which can either contain a crate::lightning::util::events::ClosureReason or not + * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not */ -typedef enum LDKCOption_ClosureReasonZ_Tag { +typedef enum LDKCOption_NetworkUpdateZ_Tag { /** - * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason + * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate */ - LDKCOption_ClosureReasonZ_Some, + LDKCOption_NetworkUpdateZ_Some, /** - * When we're in this state, this COption_ClosureReasonZ contains nothing + * When we're in this state, this COption_NetworkUpdateZ contains nothing */ - LDKCOption_ClosureReasonZ_None, + LDKCOption_NetworkUpdateZ_None, /** * Must be last for serialization purposes */ - LDKCOption_ClosureReasonZ_Sentinel, -} LDKCOption_ClosureReasonZ_Tag; + LDKCOption_NetworkUpdateZ_Sentinel, +} LDKCOption_NetworkUpdateZ_Tag; -typedef struct LDKCOption_ClosureReasonZ { - LDKCOption_ClosureReasonZ_Tag tag; +typedef struct LDKCOption_NetworkUpdateZ { + LDKCOption_NetworkUpdateZ_Tag tag; union { struct { - struct LDKClosureReason some; + struct LDKNetworkUpdate some; }; }; -} LDKCOption_ClosureReasonZ; +} LDKCOption_NetworkUpdateZ; /** - * The contents of CResult_COption_ClosureReasonZDecodeErrorZ + * 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`]. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ -typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr { +typedef enum LDKPathFailure_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * We failed to initially send the payment and no HTLC was committed to. Contains the relevant + * error. */ - struct LDKCOption_ClosureReasonZ *result; + LDKPathFailure_InitialSend, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * A hop on the path failed to forward our payment. */ - struct LDKDecodeError *err; -} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; - -/** - * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { + LDKPathFailure_OnPath, /** - * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Must be last for serialization purposes */ - union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; + LDKPathFailure_Sentinel, +} LDKPathFailure_Tag; + +typedef struct LDKPathFailure_LDKInitialSend_Body { /** - * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + * The error surfaced from initial send. */ - bool result_ok; -} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + struct LDKAPIError err; +} LDKPathFailure_LDKInitialSend_Body; -/** - * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. +typedef struct LDKPathFailure_LDKOnPath_Body { + /** + * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing + * decisions can take into account the update. + * + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + */ + struct LDKCOption_NetworkUpdateZ network_update; +} LDKPathFailure_LDKOnPath_Body; + +typedef struct MUST_USE_STRUCT LDKPathFailure { + LDKPathFailure_Tag tag; + union { + LDKPathFailure_LDKInitialSend_Body initial_send; + LDKPathFailure_LDKOnPath_Body on_path; + }; +} LDKPathFailure; + +/** + * An enum which can either contain a crate::lightning::util::events::PathFailure or not + */ +typedef enum LDKCOption_PathFailureZ_Tag { + /** + * When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure + */ + LDKCOption_PathFailureZ_Some, + /** + * When we're in this state, this COption_PathFailureZ contains nothing + */ + LDKCOption_PathFailureZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_PathFailureZ_Sentinel, +} LDKCOption_PathFailureZ_Tag; + +typedef struct LDKCOption_PathFailureZ { + LDKCOption_PathFailureZ_Tag tag; + union { + struct { + struct LDKPathFailure some; + }; + }; +} LDKCOption_PathFailureZ; + +/** + * The contents of CResult_COption_PathFailureZDecodeErrorZ + */ +typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_PathFailureZ *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_PathFailureZDecodeErrorZPtr; + +/** + * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_PathFailureZ 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_PathFailureZDecodeErrorZ { + /** + * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_PathFailureZDecodeErrorZ; + +/** + * The reason the channel was closed. See individual variants more details. + */ +typedef enum LDKClosureReason_Tag { + /** + * Closure generated from receiving a peer error message. + * + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. + */ + LDKClosureReason_CounterpartyForceClosed, + /** + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + */ + LDKClosureReason_HolderForceClosed, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. Note the shutdown may have been initiated by us. + */ + LDKClosureReason_CooperativeClosure, + /** + * A commitment transaction was confirmed on chain, closing the channel. Most likely this + * commitment transaction came from our counterparty, but it may also have come from + * a copy of our own `ChannelMonitor`. + */ + LDKClosureReason_CommitmentTxConfirmed, + /** + * The funding transaction failed to confirm in a timely manner on an inbound channel. + */ + LDKClosureReason_FundingTimedOut, + /** + * Closure generated from processing an event, likely a HTLC forward/relay/reception. + */ + LDKClosureReason_ProcessingError, + /** + * The peer disconnected prior to funding completing. In this case the spec mandates that we + * forget the channel entirely - we can attempt again if the peer reconnects. + * + * This includes cases where we restarted prior to funding completion, including prior to the + * initial [`ChannelMonitor`] persistence completing. + * + * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the + * peer because of mutual incompatibility between us and our channel counterparty. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + LDKClosureReason_DisconnectedPeer, + /** + * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than + * the [`ChannelManager`] deserialized. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + LDKClosureReason_OutdatedChannelManager, + /** + * Must be last for serialization purposes + */ + LDKClosureReason_Sentinel, +} LDKClosureReason_Tag; + +typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { + /** + * The error which the peer sent us. + * + * The string should be sanitized before it is used (e.g emitted to logs + * or printed to stdout). Otherwise, a well crafted error message may exploit + * a security vulnerability in the terminal emulator or the logging subsystem. + */ + struct LDKStr peer_msg; +} LDKClosureReason_LDKCounterpartyForceClosed_Body; + +typedef struct LDKClosureReason_LDKProcessingError_Body { + /** + * A developer-readable error message which we generated. + */ + struct LDKStr err; +} LDKClosureReason_LDKProcessingError_Body; + +typedef struct MUST_USE_STRUCT LDKClosureReason { + LDKClosureReason_Tag tag; + union { + LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; + LDKClosureReason_LDKProcessingError_Body processing_error; + }; +} LDKClosureReason; + +/** + * An enum which can either contain a crate::lightning::util::events::ClosureReason or not + */ +typedef enum LDKCOption_ClosureReasonZ_Tag { + /** + * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason + */ + LDKCOption_ClosureReasonZ_Some, + /** + * When we're in this state, this COption_ClosureReasonZ contains nothing + */ + LDKCOption_ClosureReasonZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_ClosureReasonZ_Sentinel, +} LDKCOption_ClosureReasonZ_Tag; + +typedef struct LDKCOption_ClosureReasonZ { + LDKCOption_ClosureReasonZ_Tag tag; + union { + struct { + struct LDKClosureReason some; + }; + }; +} LDKCOption_ClosureReasonZ; + +/** + * The contents of CResult_COption_ClosureReasonZDecodeErrorZ + */ +typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_ClosureReasonZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; + +/** + * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { + /** + * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + +/** + * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. */ typedef enum LDKHTLCDestination_Tag { /** @@ -2755,6 +3271,11 @@ typedef enum LDKHTLCDestination_Tag { * Scenario where we are unsure of the next node to forward the HTLC to. */ LDKHTLCDestination_UnknownNextHop, + /** + * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate + * intercept HTLC. + */ + LDKHTLCDestination_InvalidForward, /** * Failure scenario where an HTLC may have been forwarded to be intended for us, * but is invalid for some reason, so we reject it. @@ -2793,6 +3314,13 @@ typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { uint64_t requested_forward_scid; } LDKHTLCDestination_LDKUnknownNextHop_Body; +typedef struct LDKHTLCDestination_LDKInvalidForward_Body { + /** + * Short channel id we are requesting to forward an HTLC to. + */ + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKInvalidForward_Body; + typedef struct LDKHTLCDestination_LDKFailedPayment_Body { /** * The payment hash of the payment we attempted to process. @@ -2805,6 +3333,7 @@ typedef struct MUST_USE_STRUCT LDKHTLCDestination { union { LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; + LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; LDKHTLCDestination_LDKFailedPayment_Body failed_payment; }; } LDKHTLCDestination; @@ -2869,161 +3398,74 @@ typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { bool result_ok; } LDKCResult_COption_HTLCDestinationZDecodeErrorZ; +/** + * An enum which can either contain a crate::c_types::U128 or not + */ +typedef enum LDKCOption_u128Z_Tag { + /** + * When we're in this state, this COption_u128Z contains a crate::c_types::U128 + */ + LDKCOption_u128Z_Some, + /** + * When we're in this state, this COption_u128Z contains nothing + */ + LDKCOption_u128Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u128Z_Sentinel, +} LDKCOption_u128Z_Tag; + +typedef struct LDKCOption_u128Z { + LDKCOption_u128Z_Tag tag; + union { + struct { + struct LDKU128 some; + }; + }; +} LDKCOption_u128Z; + /** - * A channel_update message to be sent or received from a peer + * A reference to a transaction output. + * + * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 + * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef struct MUST_USE_STRUCT LDKOutPoint { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelUpdate *inner; + LDKnativeOutPoint *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelUpdate; +} LDKOutPoint; + + /** - * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion - * return packet by a node along the route. See [BOLT #4] for details. + * Information about a spendable output to a P2WSH script. * - * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md + * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this. */ -typedef enum LDKNetworkUpdate_Tag { - /** - * An error indicating a `channel_update` messages should be applied via - * [`NetworkGraph::update_channel`]. - */ - LDKNetworkUpdate_ChannelUpdateMessage, +typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { /** - * An error indicating that a channel failed to route a payment, which should be applied via - * [`NetworkGraph::channel_failed`]. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKNetworkUpdate_ChannelFailure, + LDKnativeDelayedPaymentOutputDescriptor *inner; /** - * An error indicating that a node failed to route a payment, which should be applied via - * [`NetworkGraph::node_failed_permanent`] if permanent. - */ - LDKNetworkUpdate_NodeFailure, - /** - * Must be last for serialization purposes - */ - LDKNetworkUpdate_Sentinel, -} LDKNetworkUpdate_Tag; - -typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { - /** - * The update to apply via [`NetworkGraph::update_channel`]. - */ - struct LDKChannelUpdate msg; -} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; - -typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { - /** - * The short channel id of the closed channel. - */ - uint64_t short_channel_id; - /** - * Whether the channel should be permanently removed or temporarily disabled until a new - * `channel_update` message is received. - */ - bool is_permanent; -} LDKNetworkUpdate_LDKChannelFailure_Body; - -typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { - /** - * The node id of the failed node. - */ - struct LDKPublicKey node_id; - /** - * Whether the node should be permanently removed from consideration or can be restored - * when a new `channel_update` message is received. - */ - bool is_permanent; -} LDKNetworkUpdate_LDKNodeFailure_Body; - -typedef struct MUST_USE_STRUCT LDKNetworkUpdate { - LDKNetworkUpdate_Tag tag; - union { - LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message; - LDKNetworkUpdate_LDKChannelFailure_Body channel_failure; - LDKNetworkUpdate_LDKNodeFailure_Body node_failure; - }; -} LDKNetworkUpdate; - -/** - * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not - */ -typedef enum LDKCOption_NetworkUpdateZ_Tag { - /** - * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate - */ - LDKCOption_NetworkUpdateZ_Some, - /** - * When we're in this state, this COption_NetworkUpdateZ contains nothing - */ - LDKCOption_NetworkUpdateZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_NetworkUpdateZ_Sentinel, -} LDKCOption_NetworkUpdateZ_Tag; - -typedef struct LDKCOption_NetworkUpdateZ { - LDKCOption_NetworkUpdateZ_Tag tag; - union { - struct { - struct LDKNetworkUpdate some; - }; - }; -} LDKCOption_NetworkUpdateZ; - - - -/** - * A reference to a transaction output. - * - * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 - * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way. - */ -typedef struct MUST_USE_STRUCT LDKOutPoint { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeOutPoint *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; -} LDKOutPoint; - - - -/** - * Information about a spendable output to a P2WSH script. See - * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. - */ -typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeDelayedPaymentOutputDescriptor *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. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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; } LDKDelayedPaymentOutputDescriptor; @@ -3031,8 +3473,9 @@ typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { /** - * Information about a spendable output to our \"payment key\". See - * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this. + * Information about a spendable output to our \"payment key\". + * + * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. */ typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { /** @@ -3050,57 +3493,76 @@ typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { } LDKStaticPaymentOutputDescriptor; /** - * When on-chain outputs are created by rust-lightning (which our counterparty is not able to - * claim at any point in the future) an event is generated which you must track and be able to - * spend on-chain. The information needed to do this is provided in this enum, including the - * outpoint describing which txid and output index is available, the full output which exists at - * that txid/index, and any keys or other information required to sign. + * Describes the necessary information to spend a spendable output. + * + * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any + * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able + * to spend on-chain. The information needed to do this is provided in this enum, including the + * outpoint describing which `txid` and output `index` is available, the full output which exists + * at that `txid`/`index`, and any keys or other information required to sign. + * + * [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs */ typedef enum LDKSpendableOutputDescriptor_Tag { /** - * An output to a script which was provided via KeysInterface directly, either from - * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know - * how to spend it. No secret keys are provided as rust-lightning was never given any key. + * An output to a script which was provided via [`SignerProvider`] directly, either from + * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already + * know how to spend it. No secret keys are provided as LDK was never given any key. * These may include outputs from a transaction punishing our counterparty or claiming an HTLC * on-chain using the payment preimage or after it has timed out. + * + * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey + * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey */ LDKSpendableOutputDescriptor_StaticOutput, /** - * An output to a P2WSH script which can be spent with a single signature after a CSV delay. + * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV` + * delay. * * The witness in the spending input should be: + * ```bitcoin * (MINIMALIF standard rule) + * ``` * - * Note that the nSequence field in the spending input must be set to to_self_delay - * (which means the transaction is not broadcastable until at least to_self_delay - * blocks after the outpoint confirms). + * Note that the `nSequence` field in the spending input must be set to + * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not + * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after + * the outpoint confirms, see [BIP + * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK + * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height + * is reached. * * These are generally the result of a \"revocable\" output to us, spendable only by us unless * it is an output from an old state which we broadcast (which should never happen). * - * To derive the delayed_payment key which is used to sign for this input, you must pass the - * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in - * Sign::pubkeys().delayed_payment_basepoint) and the provided 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 delayed_payment_basepoint which appears in - * Sign::pubkeys(). + * 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 + * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. * - * To derive the revocation_pubkey provided here (which is used in the witness - * script generation), you must pass the counterparty revocation_basepoint (which appears in the - * call to Sign::ready_channel) and the provided per_commitment point - * to chan_utils::derive_public_revocation_key. + * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is + * used in the witness script generation), you must pass the counterparty + * [`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`]. * - * The witness script which is hashed and included in the output script_pubkey may be - * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey - * (derived as above), and the to_self_delay contained here to - * chan_utils::get_revokeable_redeemscript. + * The witness script which is hashed and included in the output `script_pubkey` may be + * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived + * as explained above), our delayed payment pubkey (derived as explained above), and the + * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to + * [`chan_utils::get_revokeable_redeemscript`]. */ LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** - * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which - * corresponds to the public key in Sign::pubkeys().payment_point). - * The witness in the spending input, is, thus, simply: + * 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: + * ```bitcoin * + * ``` * * These are generally the result of our counterparty having broadcast the current state, * allowing us to claim the non-HTLC-encumbered outputs immediately. @@ -3114,7 +3576,7 @@ typedef enum LDKSpendableOutputDescriptor_Tag { typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint outpoint; /** @@ -3201,36 +3663,40 @@ typedef enum LDKEvent_Tag { */ LDKEvent_FundingGenerationReady, /** - * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and - * feed it to [`ChannelManager::claim_funds`] to get it.... + * Indicates that we've been offered a payment and it needs to be claimed via calling + * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. * * Note that if the preimage is not known, you should call - * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid - * network congestion. - * If you fail to call either [`ChannelManager::claim_funds`] or - * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be + * [`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. * * # Note * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `PaymentReceived` events may be generated for the same payment. + * `PaymentClaimable` events may be generated for the same payment. + * + * # Note + * 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::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 */ - LDKEvent_PaymentReceived, + LDKEvent_PaymentClaimable, /** * Indicates a payment has been claimed and we've received money! * * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response - * to an [`Event::PaymentReceived`]. However, if we previously crashed during a + * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a * [`ChannelManager::claim_funds`] call you may see this event without a corresponding - * [`Event::PaymentReceived`] event. + * [`Event::PaymentClaimable`] event. * * # Note * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `PaymentReceived` events may be generated for the same payment. If you then call - * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get + * `PaymentClaimable` events may be generated for the same payment. If you then call + * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get * multiple `PaymentClaimed` events. * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds @@ -3246,12 +3712,13 @@ typedef enum LDKEvent_Tag { LDKEvent_PaymentSent, /** * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events - * provide failure information for each MPP part in the payment. + * provide failure information for each path attempt in the payment, including retries. * * This event is provided once there are no further pending HTLCs for the payment and the - * payment is no longer retryable, either due to a several-block timeout or because - * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment. + * payment is no longer retryable, due either to the [`Retry`] provided or + * [`ChannelManager::abandon_payment`] having been called for the corresponding payment. * + * [`Retry`]: crate::ln::channelmanager::Retry * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ LDKEvent_PaymentFailed, @@ -3263,13 +3730,16 @@ typedef enum LDKEvent_Tag { */ LDKEvent_PaymentPathSuccessful, /** - * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. + * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to + * handle the HTLC. * * Note that this does *not* indicate that all paths for an MPP payment have failed, see - * [`Event::PaymentFailed`] and [`all_paths_failed`]. + * [`Event::PaymentFailed`]. * - * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed + * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have + * been exhausted. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ LDKEvent_PaymentPathFailed, /** @@ -3287,6 +3757,21 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ LDKEvent_PendingHTLCsForwardable, + /** + * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if + * you've encoded an intercept scid in the receiver's invoice route hints using + * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. + * + * [`ChannelManager::forward_intercepted_htlc`] or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See + * their docs for more information. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc + */ + LDKEvent_HTLCIntercepted, /** * Used to indicate that an output which you should know how to spend was confirmed on chain * and is now spendable. @@ -3300,6 +3785,13 @@ typedef enum LDKEvent_Tag { * forwarding fee earned. */ LDKEvent_PaymentForwarded, + /** + * Used to indicate that a channel with the given `channel_id` is ready to + * be used. This event is emitted either when the funding transaction has been confirmed + * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel + * establishment. + */ + LDKEvent_ChannelReady, /** * Used to indicate that a previously opened channel with the given `channel_id` is in the * process of closure. @@ -3369,15 +3861,27 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { */ struct LDKCVec_u8Z output_script; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - * an inbound channel. + * 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. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel */ - uint64_t user_channel_id; + struct LDKU128 user_channel_id; } LDKEvent_LDKFundingGenerationReady_Body; -typedef struct LDKEvent_LDKPaymentReceived_Body { +typedef struct LDKEvent_LDKPaymentClaimable_Body { + /** + * The node that will receive the payment after it has been claimed. + * This is useful to identify payments received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; /** * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will * not stop you from registering duplicate payment hashes for inbound payments. @@ -3392,9 +3896,30 @@ typedef struct LDKEvent_LDKPaymentReceived_Body { * payment is to pay an invoice or to send a spontaneous payment. */ struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentReceived_Body; + /** + * 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; + /** + * The `user_channel_id` indicating over which channel we received the payment. + */ + struct LDKCOption_u128Z via_user_channel_id; +} LDKEvent_LDKPaymentClaimable_Body; typedef struct LDKEvent_LDKPaymentClaimed_Body { + /** + * The node that received the payment. + * This is useful to identify payments which were received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; /** * The payment hash of the claimed payment. Note that LDK will not stop you from * registering duplicate payment hashes for inbound payments. @@ -3405,7 +3930,7 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { */ uint64_t amount_msat; /** - * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a + * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a * spontaneous payment. */ struct LDKPaymentPurpose purpose; @@ -3413,11 +3938,9 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { typedef struct LDKEvent_LDKPaymentSent_Body { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * The id returned by [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -3451,10 +3974,9 @@ typedef struct LDKEvent_LDKPaymentSent_Body { typedef struct LDKEvent_LDKPaymentFailed_Body { /** * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * [`ChannelManager::abandon_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ struct LDKThirtyTwoBytes payment_id; @@ -3468,11 +3990,9 @@ typedef struct LDKEvent_LDKPaymentFailed_Body { typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * The id returned by [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment */ struct LDKThirtyTwoBytes payment_id; /** @@ -3494,10 +4014,9 @@ typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { typedef struct LDKEvent_LDKPaymentPathFailed_Body { /** * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * [`ChannelManager::abandon_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -3511,40 +4030,17 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { struct LDKThirtyTwoBytes payment_hash; /** * Indicates the payment was rejected for some reason by the recipient. This implies that - * the payment has failed, not just the route in question. If this is not set, you may - * retry the payment via a different route. + * the payment has failed, not just the route in question. If this is not set, the payment may + * be retried via a different route. */ bool payment_failed_permanently; /** - * Any failure information conveyed via the Onion return packet by a node along the failed - * payment route. - * - * Should be applied to the [`NetworkGraph`] so that routing decisions can take into - * account the update. + * Extra error details based on the failure type. May contain an update that needs to be + * applied to the [`NetworkGraph`]. * * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ - struct LDKCOption_NetworkUpdateZ network_update; - /** - * For both single-path and multi-path payments, this is set if all paths of the payment have - * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the - * larger MPP payment were still in flight when this event was generated. - * - * Note that if you are retrying individual MPP parts, using this value to determine if a - * payment has fully failed is race-y. Because multiple failures can happen prior to events - * being processed, you may retry in response to a first failure, with a second failure - * (with `all_paths_failed` set) still pending. Then, when the second failure is processed - * you will see `all_paths_failed` set even though the retry of the first failure still - * has an associated in-flight HTLC. See (1) for an example of such a failure. - * - * If you wish to retry individual MPP parts and learn when a payment has failed, you must - * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event. - * - * (1) - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - */ - bool all_paths_failed; + struct LDKPathFailure failure; /** * The payment path that failed. */ @@ -3561,12 +4057,9 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { */ struct LDKCOption_u64Z short_channel_id; /** - * Parameters needed to compute a new [`Route`] when retrying the failed payment path. - * - * See [`find_route`] for details. + * Parameters used by LDK to compute a new [`Route`] when retrying the failed payment path. * * [`Route`]: crate::routing::router::Route - * [`find_route`]: crate::routing::router::find_route * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -3629,6 +4122,37 @@ typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { uint64_t time_forwardable; } LDKEvent_LDKPendingHTLCsForwardable_Body; +typedef struct LDKEvent_LDKHTLCIntercepted_Body { + /** + * An id to help LDK identify which HTLC is being forwarded or failed. + */ + struct LDKThirtyTwoBytes intercept_id; + /** + * The fake scid that was programmed as the next hop's scid, generated using + * [`ChannelManager::get_intercept_scid`]. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + */ + uint64_t requested_next_hop_scid; + /** + * The payment hash used for this HTLC. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * How many msats were received on the inbound edge of this HTLC. + */ + uint64_t inbound_amount_msat; + /** + * How many msats the payer intended to route to the next node. Depending on the reason you are + * intercepting this payment, you might take a fee by forwarding less than this amount. + * + * Note that LDK will NOT check that expected fees were factored into this value. You MUST + * check that whatever fee you want has been included here or subtract it as required. Further, + * LDK will not stop you from forwarding more than you received. + */ + uint64_t expected_outbound_amount_msat; +} LDKEvent_LDKHTLCIntercepted_Body; + typedef struct LDKEvent_LDKSpendableOutputs_Body { /** * The outputs which you should store as spendable by you. @@ -3674,6 +4198,32 @@ typedef struct LDKEvent_LDKPaymentForwarded_Body { bool claim_from_onchain_tx; } LDKEvent_LDKPaymentForwarded_Body; +typedef struct LDKEvent_LDKChannelReady_Body { + /** + * The channel_id of the channel that is ready. + */ + struct LDKThirtyTwoBytes channel_id; + /** + * 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. + * + * [`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; + /** + * The node_id of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The features that this channel will operate with. + */ + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKChannelReady_Body; + typedef struct LDKEvent_LDKChannelClosed_Body { /** * The channel_id of the channel which has been closed. Note that on-chain transactions @@ -3684,14 +4234,15 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * 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 0 for an inbound channel. - * This will always be zero for objects serialized with LDK versions prior to 0.0.102. + * `user_channel_id` will be randomized for inbound channels. + * This may be zero for inbound channels serialized prior to 0.0.113 and will always be + * zero for objects serialized with LDK versions prior to 0.0.102. * * [`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 */ - uint64_t user_channel_id; + struct LDKU128 user_channel_id; /** * The reason the channel was closed. */ @@ -3776,7 +4327,7 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentClaimable_Body payment_claimable; LDKEvent_LDKPaymentClaimed_Body payment_claimed; LDKEvent_LDKPaymentSent_Body payment_sent; LDKEvent_LDKPaymentFailed_Body payment_failed; @@ -3785,8 +4336,10 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_LDKProbeSuccessful_Body probe_successful; LDKEvent_LDKProbeFailed_Body probe_failed; LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; + LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted; LDKEvent_LDKSpendableOutputs_Body spendable_outputs; LDKEvent_LDKPaymentForwarded_Body payment_forwarded; + LDKEvent_LDKChannelReady_Body channel_ready; LDKEvent_LDKChannelClosed_Body channel_closed; LDKEvent_LDKDiscardFunding_Body discard_funding; LDKEvent_LDKOpenChannelRequest_Body open_channel_request; @@ -3857,7 +4410,9 @@ typedef struct LDKCResult_COption_EventZDecodeErrorZ { /** - * An accept_channel message to be sent or received from a peer + * An [`accept_channel`] message to be sent to or received from a peer. + * + * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message */ typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** @@ -3877,7 +4432,9 @@ typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** - * An open_channel message to be sent or received from a peer + * An [`open_channel`] message to be sent to or received from a peer. + * + * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message */ typedef struct MUST_USE_STRUCT LDKOpenChannel { /** @@ -3897,7 +4454,9 @@ typedef struct MUST_USE_STRUCT LDKOpenChannel { /** - * A funding_created message to be sent or received from a peer + * A [`funding_created`] message to be sent to or received from a peer. + * + * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message */ typedef struct MUST_USE_STRUCT LDKFundingCreated { /** @@ -3917,7 +4476,9 @@ typedef struct MUST_USE_STRUCT LDKFundingCreated { /** - * A funding_signed message to be sent or received from a peer + * A [`funding_signed`] message to be sent to or received from a peer. + * + * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message */ typedef struct MUST_USE_STRUCT LDKFundingSigned { /** @@ -3937,7 +4498,9 @@ typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * A channel_ready message to be sent or received from a peer + * A [`channel_ready`] message to be sent to or received from a peer. + * + * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message */ typedef struct MUST_USE_STRUCT LDKChannelReady { /** @@ -3957,7 +4520,9 @@ typedef struct MUST_USE_STRUCT LDKChannelReady { /** - * An announcement_signatures message to be sent or received from a peer + * An [`announcement_signatures`] message to be sent to or received from a peer. + * + * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message */ typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** @@ -3977,7 +4542,7 @@ typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment + * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment * transaction updates if they were pending. */ typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { @@ -3998,7 +4563,9 @@ typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { /** - * A revoke_and_ack message to be sent or received from a peer + * A [`revoke_and_ack`] message to be sent to or received from a peer. + * + * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack */ typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** @@ -4018,7 +4585,9 @@ typedef struct MUST_USE_STRUCT LDKRevokeAndACK { /** - * A closing_signed message to be sent or received from a peer + * A [`closing_signed`] message to be sent to or received from a peer. + * + * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed */ typedef struct MUST_USE_STRUCT LDKClosingSigned { /** @@ -4038,7 +4607,9 @@ typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * A shutdown message to be sent or received from a peer + * A [`shutdown`] message to be sent to or received from a peer. + * + * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown */ typedef struct MUST_USE_STRUCT LDKShutdown { /** @@ -4058,7 +4629,9 @@ typedef struct MUST_USE_STRUCT LDKShutdown { /** - * A channel_reestablish message to be sent or received from a peer + * A [`channel_reestablish`] message to be sent to or received from a peer. + * + * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission */ typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** @@ -4078,7 +4651,9 @@ typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * A channel_announcement message to be sent or received from a peer + * A [`channel_announcement`] message to be sent to or received from a peer. + * + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** @@ -4098,7 +4673,31 @@ typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** - * An error message to be sent or received from a peer + * A [`node_announcement`] message to be sent to or received from a peer. + * + * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeAnnouncement *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; +} LDKNodeAnnouncement; + + + +/** + * An [`error`] message to be sent to or received from a peer. + * + * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages */ typedef struct MUST_USE_STRUCT LDKErrorMessage { /** @@ -4118,7 +4717,9 @@ typedef struct MUST_USE_STRUCT LDKErrorMessage { /** - * A warning message to be sent or received from a peer + * A [`warning`] message to be sent to or received from a peer. + * + * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages */ typedef struct MUST_USE_STRUCT LDKWarningMessage { /** @@ -4136,7 +4737,7 @@ typedef struct MUST_USE_STRUCT LDKWarningMessage { } LDKWarningMessage; /** - * Used to put an error message in a LightningError + * Used to put an error message in a [`LightningError`]. */ typedef enum LDKErrorAction_Tag { /** @@ -4216,10 +4817,12 @@ typedef struct MUST_USE_STRUCT LDKErrorAction { /** - * A query_channel_range message is used to query a peer for channel + * A [`query_channel_range`] message is used to query a peer for channel * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range + * effort to reply to the query using one or more [`ReplyChannelRange`] * messages. + * + * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages */ typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** @@ -4239,14 +4842,17 @@ typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** - * A query_short_channel_ids message is used to query a peer for - * routing gossip messages related to one or more short_channel_ids. + * A [`query_short_channel_ids`] message is used to query a peer for + * routing gossip messages related to one or more `short_channel_id`s. + * * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages + * it maintains for the requested `short_channel_id`s followed by a + * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in + * this query are encoded. We only support `encoding_type=0` uncompressed + * serialization and do not support `encoding_type=1` zlib serialization. + * + * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages */ typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { /** @@ -4266,13 +4872,17 @@ typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { /** - * A reply_channel_range message is a reply to a query_channel_range - * message. Multiple reply_channel_range messages can be sent in reply - * to a single query_channel_range message. The query recipient makes a + * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`] + * message. + * + * Multiple `reply_channel_range` messages can be sent in reply + * to a single [`QueryChannelRange`] message. The query recipient makes a * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. + * not be a perfect view of the network. The `short_channel_id`s in the + * reply are encoded. We only support `encoding_type=0` uncompressed + * serialization and do not support `encoding_type=1` zlib serialization. + * + * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages */ typedef struct MUST_USE_STRUCT LDKReplyChannelRange { /** @@ -4292,9 +4902,11 @@ typedef struct MUST_USE_STRUCT LDKReplyChannelRange { /** - * A gossip_timestamp_filter message is used by a node to request + * A [`gossip_timestamp_filter`] message is used by a node to request * gossip relay for messages in the requested time range when the - * gossip_queries feature has been negotiated. + * `gossip_queries` feature has been negotiated. + * + * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message */ typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { /** @@ -4386,6 +4998,10 @@ typedef enum LDKMessageSendEvent_Tag { * Used to indicate that a channel_update should be broadcast to all peers. */ LDKMessageSendEvent_BroadcastChannelUpdate, + /** + * Used to indicate that a node_announcement should be broadcast to all peers. + */ + LDKMessageSendEvent_BroadcastNodeAnnouncement, /** * Used to indicate that a channel_update should be sent to a single peer. * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a @@ -4564,6 +5180,8 @@ typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { struct LDKChannelAnnouncement msg; /** * The followup channel_update which should be sent. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKChannelUpdate update_msg; } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; @@ -4575,6 +5193,13 @@ typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { struct LDKChannelUpdate msg; } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; +typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { + /** + * The node_announcement which should be sent. + */ + struct LDKNodeAnnouncement msg; +} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; + typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { /** * The node_id of the node which should receive this message @@ -4658,6 +5283,7 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement; LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement; LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; + LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement; LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update; LDKMessageSendEvent_LDKHandleError_Body handle_error; LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query; @@ -4683,39 +5309,6 @@ typedef struct LDKCVec_MessageSendEventZ { uintptr_t datalen; } LDKCVec_MessageSendEventZ; -/** - * The contents of CResult_TxOutAccessErrorZ - */ -typedef union LDKCResult_TxOutAccessErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxOut *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKAccessError *err; -} LDKCResult_TxOutAccessErrorZPtr; - -/** - * A CResult_TxOutAccessErrorZ represents the result of a fallible operation, - * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_TxOutAccessErrorZ { - /** - * The contents of this CResult_TxOutAccessErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TxOutAccessErrorZPtr contents; - /** - * Whether this CResult_TxOutAccessErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_TxOutAccessErrorZ; - /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -4747,20 +5340,34 @@ typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { } LDKCVec_C2Tuple_usizeTransactionZZ; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCVec_TxidZ { +typedef struct LDKC2Tuple_TxidBlockHashZ { + /** + * The element at position 0 + */ + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_TxidBlockHashZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ { /** * 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_TxidBlockHashZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_TxidZ; +} LDKCVec_C2Tuple_TxidBlockHashZZ; @@ -4991,6 +5598,71 @@ typedef struct LDKCOption_C2Tuple_u64u64ZZ { }; } LDKCOption_C2Tuple_u64u64ZZ; +/** + * 8 u16s + */ +typedef struct LDKEightU16s { + /** + * The eight 16-bit integers + */ + uint16_t data[8]; +} LDKEightU16s; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_Z { + /** + * The element at position 0 + */ + struct LDKEightU16s a; + /** + * The element at position 1 + */ + struct LDKEightU16s b; +} LDKC2Tuple_Z; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple__u168_u168Z { + /** + * The element at position 0 + */ + struct LDKEightU16s a; + /** + * The element at position 1 + */ + struct LDKEightU16s b; +} LDKC2Tuple__u168_u168Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not + */ +typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z + */ + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing + */ + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel, +} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag; + +typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ { + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag; + union { + struct { + struct LDKC2Tuple__u168_u168Z some; + }; + }; +} LDKCOption_C2Tuple_EightU16sEightU16sZZ; + /** * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. * This corresponds to std::vector in C++ @@ -5368,6 +6040,59 @@ typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_InvoiceFeaturesDecodeErrorZ; + + +/** + * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo + */ +typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedHopFeatures *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; +} LDKBlindedHopFeatures; + +/** + * The contents of CResult_BlindedHopFeaturesDecodeErrorZ + */ +typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedHopFeatures *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_BlindedHopFeaturesDecodeErrorZPtr; + +/** + * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::BlindedHopFeatures 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_BlindedHopFeaturesDecodeErrorZ { + /** + * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedHopFeaturesDecodeErrorZ; + /** * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ */ @@ -5468,10 +6193,103 @@ typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { } LDKCResult_COption_NetworkUpdateZDecodeErrorZ; /** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. + * The contents of CResult_TxOutUtxoLookupErrorZ + */ +typedef union LDKCResult_TxOutUtxoLookupErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTxOut *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKUtxoLookupError *err; +} LDKCResult_TxOutUtxoLookupErrorZPtr; + +/** + * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation, + * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_TxOutUtxoLookupErrorZ { + /** + * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TxOutUtxoLookupErrorZPtr contents; + /** + * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_TxOutUtxoLookupErrorZ; + + + +/** + * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async. + * + * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info. + */ +typedef struct MUST_USE_STRUCT LDKUtxoFuture { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUtxoFuture *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; +} LDKUtxoFuture; + +/** + * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously, + * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async` + * variant. + */ +typedef enum LDKUtxoResult_Tag { + /** + * A result which was resolved synchronously. It either includes a [`TxOut`] for the output + * requested or a [`UtxoLookupError`]. + */ + LDKUtxoResult_Sync, + /** + * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of + * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes. + * + * Note that in order to avoid runaway memory usage, the number of parallel checks is limited, + * but only fairly loosely. Because a pending checks block all message processing, leaving + * checks pending for an extended time may cause DoS of other functions. It is recommended you + * keep a tight timeout on lookups, on the order of a few seconds. + */ + LDKUtxoResult_Async, + /** + * Must be last for serialization purposes + */ + LDKUtxoResult_Sentinel, +} LDKUtxoResult_Tag; + +typedef struct MUST_USE_STRUCT LDKUtxoResult { + LDKUtxoResult_Tag tag; + union { + struct { + struct LDKCResult_TxOutUtxoLookupErrorZ sync; + }; + struct { + struct LDKUtxoFuture async; + }; + }; +} LDKUtxoResult; + +/** + * The `UtxoLookup` trait defines behavior for accessing on-chain UTXOs. */ -typedef struct LDKAccess { +typedef struct LDKUtxoLookup { /** * 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. @@ -5484,40 +6302,40 @@ typedef struct LDKAccess { * * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); + struct LDKUtxoResult (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKAccess; +} LDKUtxoLookup; /** - * An enum which can either contain a crate::lightning::chain::Access or not + * An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not */ -typedef enum LDKCOption_AccessZ_Tag { +typedef enum LDKCOption_UtxoLookupZ_Tag { /** - * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access + * When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup */ - LDKCOption_AccessZ_Some, + LDKCOption_UtxoLookupZ_Some, /** - * When we're in this state, this COption_AccessZ contains nothing + * When we're in this state, this COption_UtxoLookupZ contains nothing */ - LDKCOption_AccessZ_None, + LDKCOption_UtxoLookupZ_None, /** * Must be last for serialization purposes */ - LDKCOption_AccessZ_Sentinel, -} LDKCOption_AccessZ_Tag; + LDKCOption_UtxoLookupZ_Sentinel, +} LDKCOption_UtxoLookupZ_Tag; -typedef struct LDKCOption_AccessZ { - LDKCOption_AccessZ_Tag tag; +typedef struct LDKCOption_UtxoLookupZ { + LDKCOption_UtxoLookupZ_Tag tag; union { struct { - struct LDKAccess some; + struct LDKUtxoLookup some; }; }; -} LDKCOption_AccessZ; +} LDKCOption_UtxoLookupZ; /** * The contents of CResult_boolLightningErrorZ @@ -5799,16 +6617,6 @@ typedef struct LDKFourBytes { uint8_t data[4]; } LDKFourBytes; -/** - * A 16-byte byte array. - */ -typedef struct LDKSixteenBytes { - /** - * The sixteen bytes - */ - uint8_t data[16]; -} LDKSixteenBytes; - /** * A 12-byte byte array. */ @@ -5826,7 +6634,9 @@ typedef struct LDKTwelveBytes { * Only the character set and length will be validated. * The character set consists of ASCII alphanumeric characters, hyphens, and periods. * Its length is guaranteed to be representable by a single byte. - * This serialization is used by BOLT 7 hostnames. + * This serialization is used by [`BOLT 7`] hostnames. + * + * [`BOLT 7`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md */ typedef struct MUST_USE_STRUCT LDKHostname { /** @@ -5844,7 +6654,7 @@ typedef struct MUST_USE_STRUCT LDKHostname { } LDKHostname; /** - * An address which can be used to connect to a remote peer + * An address which can be used to connect to a remote peer. */ typedef enum LDKNetAddress_Tag { /** @@ -5864,7 +6674,8 @@ typedef enum LDKNetAddress_Tag { LDKNetAddress_OnionV2, /** * A new-style Tor onion address/port on which the peer is listening. - * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, + * + * To create the human-readable \"hostname\", concatenate the ED25519 pubkey, checksum, and version, * wrap as base32 and append \".onion\". */ LDKNetAddress_OnionV3, @@ -6374,84 +7185,6 @@ typedef struct LDKCResult_SignatureNoneZ { bool result_ok; } LDKCResult_SignatureNoneZ; -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_SignatureSignatureZ { - /** - * The element at position 0 - */ - struct LDKSignature a; - /** - * The element at position 1 - */ - struct LDKSignature b; -} LDKC2Tuple_SignatureSignatureZ; - -/** - * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ - */ -typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKC2Tuple_SignatureSignatureZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr; - -/** - * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ { - /** - * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents; - /** - * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_C2Tuple_SignatureSignatureZNoneZ; - -/** - * The contents of CResult_SecretKeyNoneZ - */ -typedef union LDKCResult_SecretKeyNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKSecretKey *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_SecretKeyNoneZPtr; - -/** - * A CResult_SecretKeyNoneZ represents the result of a fallible operation, - * containing a crate::c_types::SecretKey on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SecretKeyNoneZ { - /** - * The contents of this CResult_SecretKeyNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SecretKeyNoneZPtr contents; - /** - * Whether this CResult_SecretKeyNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_SecretKeyNoneZ; - /** * The contents of CResult_PublicKeyNoneZ */ @@ -6543,70 +7276,124 @@ typedef struct LDKCResult_SharedSecretNoneZ { bool result_ok; } LDKCResult_SharedSecretNoneZ; - +/** + * Integer in the range `0..32` + */ +typedef struct LDKU5 { + uint8_t _0; +} LDKU5; /** - * This class tracks the per-transaction information needed to build a closing transaction and will - * actually build it and sign. - * - * This class can be used inside a signer implementation to generate a signature given the relevant - * secret key. + * A dynamically-allocated array of crate::c_types::U5s of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKClosingTransaction { +typedef struct LDKCVec_U5Z { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativeClosingTransaction *inner; + struct LDKU5 *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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKClosingTransaction; - - + uintptr_t datalen; +} LDKCVec_U5Z; /** - * The unsigned part of a channel_announcement + * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which + * allows recovering the exact public key which created the signature given the message. */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedChannelAnnouncement *inner; +typedef struct LDKRecoverableSignature { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for + * recovery. */ - bool is_owned; -} LDKUnsignedChannelAnnouncement; + uint8_t serialized_form[68]; +} LDKRecoverableSignature; /** - * A trait to sign lightning channel transactions as described in BOLT 3. - * - * Signing services could be implemented on a hardware wallet. In this case, - * the current Sign would be a front-end on top of a communication - * channel connected to your secure device and lightning key material wouldn't - * reside on a hot server. Nevertheless, a this deployment would still need - * to trust the ChannelManager to avoid loss of funds as this latest component - * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. + * The contents of CResult_RecoverableSignatureNoneZ + */ +typedef union LDKCResult_RecoverableSignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRecoverableSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_RecoverableSignatureNoneZPtr; + +/** + * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::RecoverableSignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RecoverableSignatureNoneZ { + /** + * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RecoverableSignatureNoneZPtr contents; + /** + * Whether this CResult_RecoverableSignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_RecoverableSignatureNoneZ; + + + +/** + * This class tracks the per-transaction information needed to build a closing transaction and will + * actually build it and sign. * - * A more secure iteration would be to use hashlock (or payment points) to pair - * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager - * at the price of more state and computation on the hardware wallet side. In the future, - * we are looking forward to design such interface. + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. + */ +typedef struct MUST_USE_STRUCT LDKClosingTransaction { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeClosingTransaction *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKClosingTransaction; + + + +/** + * The unsigned part of a [`channel_announcement`] message. * - * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted - * to act, as liveness and breach reply correctness are always going to be hard requirements - * of LN security model, orthogonal of key management issues. + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message + */ +typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedChannelAnnouncement *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; +} LDKUnsignedChannelAnnouncement; + +/** + * A trait to handle Lightning channel key material without concretizing the channel type or + * the signature mechanism. */ -typedef struct LDKBaseSign { +typedef struct LDKChannelSigner { /** * 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. @@ -6615,7 +7402,7 @@ typedef struct LDKBaseSign { /** * Gets the per-commitment point for a specific commitment number * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** @@ -6626,7 +7413,7 @@ typedef struct LDKBaseSign { * * May be called more than once for the same index. * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** @@ -6641,12 +7428,12 @@ typedef struct LDKBaseSign { * 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: all the relevant preimages will be provided, but there may also be additional + * 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); /** - * Gets the holder's channel public keys and basepoints + * Returns the holder's channel public keys and basepoints. */ struct LDKChannelPublicKeys pubkeys; /** @@ -6654,13 +7441,47 @@ typedef struct LDKBaseSign { * Note that this takes a pointer to this object, not the this_ptr like other methods do * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. */ - void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR ); + void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR ); /** - * Gets an arbitrary identifier describing the set of keys which are provided back to you in - * some SpendableOutputDescriptor types. This should be sufficient to identify this - * Sign object uniquely and lookup or re-derive its keys. + * Returns an arbitrary identifier describing the set of keys which are provided back to you in + * some [`SpendableOutputDescriptor`] types. This should be sufficient to identify this + * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. */ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); + /** + * Set the counterparty static channel data, including basepoints, + * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. + * + * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] + * instance, LDK will call this method exactly once - either immediately after construction + * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding + * information has been generated. + * + * channel_parameters.is_populated() MUST be true. + */ + void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + /** + * 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); +} LDKChannelSigner; + +/** + * A trait to sign Lightning channel transactions as described in + * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). + * + * Signing services could be implemented on a hardware wallet and should implement signing + * policies in order to be secure. Please refer to the [VLS Policy + * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) + * for an example of such policies. + */ +typedef struct LDKEcdsaChannelSigner { + /** + * 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; /** * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * @@ -6673,7 +7494,7 @@ typedef struct LDKBaseSign { * 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: all the relevant preimages will be provided, but there may also be additional + * 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); @@ -6685,17 +7506,21 @@ typedef struct LDKBaseSign { */ struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** - * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. - * This will only ever be called with a non-revoked commitment_tx. This will be called with the - * latest commitment_tx when we initiate a force-close. - * This will be called with the previous latest, just to get claiming HTLC signatures, if we are - * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to - * the latest. + * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * + * 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. * - * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. + * [`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); /** @@ -6709,9 +7534,9 @@ typedef struct LDKBaseSign { * * Amount is value of the output spent by this input, committed to in the BIP 143 signature. * - * per_commitment_key is revocation secret which was provided by our counterparty when they + * `per_commitment_key` is revocation secret which was provided by our counterparty when they * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * 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]); @@ -6724,14 +7549,15 @@ typedef struct LDKBaseSign { * It may be called multiple times for same output(s) if a fee-bump is needed with regards * to an upcoming timelock expiration. * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * `amount` is the value of the output spent by this input, committed to in the BIP 143 + * signature. * - * per_commitment_key is revocation secret which was provided by our counterparty when they + * `per_commitment_key` is revocation secret which was provided by our counterparty when they * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does * not allow the spending of any funds by itself (you need our holder revocation_secret to do * so). * - * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script + * `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); @@ -6744,12 +7570,12 @@ typedef struct LDKBaseSign { * signed for here. It may be called multiple times for same output(s) if a fee-bump is * needed with regards to an upcoming timelock expiration. * - * Witness_script is either a offered or received script as defined in BOLT3 for HTLC + * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC * outputs. * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. * - * Per_commitment_point is the dynamic point corresponding to the channel state + * `per_commitment_point` is the dynamic point corresponding to the channel state * detected onchain. It has been generated by our counterparty and is used to derive * channel state keys, which are then included in the witness script and committed to in the * BIP 143 signature. @@ -6768,170 +7594,90 @@ typedef struct LDKBaseSign { */ struct LDKCResult_SignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); /** - * Signs a channel announcement message with our funding key and our node secret key (aka - * node_id or network_key), proving it comes from one of the channel participants. + * Signs a channel announcement message with our funding key proving it comes from one of the + * channel participants. * - * The first returned signature should be from our node secret key, the second from our - * funding key. + * Channel announcements also require a signature from each node's network key. Our node + * signature is computed through [`NodeSigner::sign_gossip_message`]. * * 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. */ - struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + struct LDKCResult_SignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** - * Set the counterparty static channel data, including basepoints, - * counterparty_selected/holder_selected_contest_delay and funding outpoint. - * This is done as soon as the funding outpoint is known. Since these are static channel data, - * they MUST NOT be allowed to change to different values once set. - * - * channel_parameters.is_populated() MUST be true. - * - * We bind holder_selected_contest_delay late here for API convenience. - * - * Will be called before any signatures are applied. + * Implementation of ChannelSigner for this object. */ - void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + struct LDKChannelSigner ChannelSigner; /** * 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); -} LDKBaseSign; +} LDKEcdsaChannelSigner; /** - * A cloneable signer. + * A writeable signer. + * + * There will always be two instances of a signer per channel, one occupied by the + * [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. * - * Although we require signers to be cloneable, it may be useful for developers to be able to use - * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait, - * which implies Sized, into this derived trait. + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ -typedef struct LDKSign { +typedef struct LDKWriteableEcdsaChannelSigner { /** * 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 BaseSign for this object. + * Implementation of EcdsaChannelSigner for this object. */ - struct LDKBaseSign BaseSign; + struct LDKEcdsaChannelSigner EcdsaChannelSigner; /** * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); - /** - * Called, if set, after this Sign has been cloned into a duplicate object. - * The new Sign is provided, and should be mutated as needed to perform a - * deep copy of the object pointed to by this_arg or avoid any double-freeing. - */ - void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKSign; +} LDKWriteableEcdsaChannelSigner; /** - * The contents of CResult_SignDecodeErrorZ + * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ */ -typedef union LDKCResult_SignDecodeErrorZPtr { +typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSign *result; + struct LDKWriteableEcdsaChannelSigner *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_SignDecodeErrorZPtr; - -/** - * A CResult_SignDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SignDecodeErrorZ { - /** - * The contents of this CResult_SignDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SignDecodeErrorZPtr contents; - /** - * Whether this CResult_SignDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_SignDecodeErrorZ; - -/** - * Integer in the range `0..32` - */ -typedef struct LDKu5 { - uint8_t _0; -} LDKu5; - -/** - * A dynamically-allocated array of crate::c_types::u5s of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_u5Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKu5 *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_u5Z; - -/** - * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which - * allows recovering the exact public key which created the signature given the message. - */ -typedef struct LDKRecoverableSignature { - /** - * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for - * recovery. - */ - uint8_t serialized_form[68]; -} LDKRecoverableSignature; - -/** - * The contents of CResult_RecoverableSignatureNoneZ - */ -typedef union LDKCResult_RecoverableSignatureNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRecoverableSignature *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_RecoverableSignatureNoneZPtr; +} LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr; /** - * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::RecoverableSignature on success and a () on failure. + * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::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_RecoverableSignatureNoneZ { +typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ { /** - * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either + * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RecoverableSignatureNoneZPtr contents; + union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents; /** - * Whether this CResult_RecoverableSignatureNoneZ represents a success state. + * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RecoverableSignatureNoneZ; +} LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ; /** * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. @@ -6984,7 +7730,7 @@ typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { /** - * A simple implementation of Sign that just keeps the private keys in memory. + * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory. * * This implementation performs no policy checks and is insufficient by itself as * a secure external signer. @@ -7211,248 +7957,189 @@ typedef struct LDKCOption_u16Z { } LDKCOption_u16Z; /** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) + * The contents of CResult__u832APIErrorZ */ -typedef enum LDKAPIError_Tag { +typedef union LDKCResult__u832APIErrorZPtr { /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKAPIError_APIMisuseError, + struct LDKThirtyTwoBytes *result; /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKAPIError_FeeRateTooHigh, + struct LDKAPIError *err; +} LDKCResult__u832APIErrorZPtr; + +/** + * A CResult__u832APIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult__u832APIErrorZ { /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). + * The contents of this CResult__u832APIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKAPIError_RouteError, + union LDKCResult__u832APIErrorZPtr contents; /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. + * Whether this CResult__u832APIErrorZ represents a success state. */ - LDKAPIError_ChannelUnavailable, + bool result_ok; +} LDKCResult__u832APIErrorZ; + +/** + * 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 { /** - * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] - * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a - * monitor update is awaiting async resolution. Once it resolves the attempted action should - * complete automatically. - * - * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel - * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel - * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress + * When a payment is still being sent and awaiting successful delivery. */ - LDKAPIError_MonitorUpdateInProgress, + LDKRecentPaymentDetails_Pending, /** - * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible - * with the channel counterparty as negotiated in [`InitFeatures`]. - * - * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open - * a channel or cooperatively close one with this peer (and will have to force-close instead). - * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey - * [`InitFeatures`]: crate::ln::features::InitFeatures + * When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have + * been resolved. Upon receiving [`Event::PaymentSent`], we delay for a few minutes before the + * payment is removed from tracking. */ - LDKAPIError_IncompatibleShutdownScript, + LDKRecentPaymentDetails_Fulfilled, /** - * Must be last for serialization purposes + * After a payment's retries are exhausted per the provided [`Retry`], or it is explicitly + * abandoned via [`ChannelManager::abandon_payment`], it is marked as abandoned until all + * pending HTLCs for this payment resolve and an [`Event::PaymentFailed`] is generated. */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { + LDKRecentPaymentDetails_Abandoned, /** - * A human-readable error message + * Must be last for serialization purposes */ - struct LDKStr err; -} LDKAPIError_LDKAPIMisuseError_Body; + LDKRecentPaymentDetails_Sentinel, +} LDKRecentPaymentDetails_Tag; -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { +typedef struct LDKRecentPaymentDetails_LDKPending_Body { /** - * A human-readable error message + * Hash of the payment that is currently being sent but has yet to be fulfilled or + * abandoned. */ - struct LDKStr err; + struct LDKThirtyTwoBytes payment_hash; /** - * The feerate which was too high. + * Total amount (in msat, excluding fees) across all paths for this payment, + * not just the amount currently inflight. */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; + uint64_t total_msat; +} LDKRecentPaymentDetails_LDKPending_Body; -typedef struct LDKAPIError_LDKRouteError_Body { +typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body { /** - * A human-readable error message + * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`] + * made before LDK version 0.0.104. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; + struct LDKThirtyTwoBytes payment_hash; +} LDKRecentPaymentDetails_LDKFulfilled_Body; -typedef struct LDKAPIError_LDKChannelUnavailable_Body { +typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { /** - * A human-readable error message + * Hash of the payment that we have given up trying to send. */ - struct LDKStr err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { - /** - * The incompatible shutdown script. - */ - struct LDKShutdownScript script; -} LDKAPIError_LDKIncompatibleShutdownScript_Body; + struct LDKThirtyTwoBytes payment_hash; +} LDKRecentPaymentDetails_LDKAbandoned_Body; -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; +typedef struct MUST_USE_STRUCT LDKRecentPaymentDetails { + LDKRecentPaymentDetails_Tag tag; union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + LDKRecentPaymentDetails_LDKPending_Body pending; + LDKRecentPaymentDetails_LDKFulfilled_Body fulfilled; + LDKRecentPaymentDetails_LDKAbandoned_Body abandoned; }; -} LDKAPIError; - -/** - * The contents of CResult_NoneAPIErrorZ - */ -typedef union LDKCResult_NoneAPIErrorZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult_NoneAPIErrorZPtr; - -/** - * A CResult_NoneAPIErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NoneAPIErrorZ { - /** - * The contents of this CResult_NoneAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NoneAPIErrorZPtr contents; - /** - * Whether this CResult_NoneAPIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_NoneAPIErrorZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_CResult_NoneAPIErrorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCResult_NoneAPIErrorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_CResult_NoneAPIErrorZZ; +} LDKRecentPaymentDetails; /** - * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_APIErrorZ { +typedef struct LDKCVec_RecentPaymentDetailsZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKAPIError *data; + struct LDKRecentPaymentDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_APIErrorZ; - -/** - * The contents of CResult__u832APIErrorZ - */ -typedef union LDKCResult__u832APIErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKThirtyTwoBytes *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; - -/** - * A CResult__u832APIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult__u832APIErrorZ { - /** - * The contents of this CResult__u832APIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult__u832APIErrorZPtr contents; - /** - * Whether this CResult__u832APIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult__u832APIErrorZ; +} LDKCVec_RecentPaymentDetailsZ; /** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * If a payment fails to send with [`ChannelManager::send_payment`], it can be in one of several + * states. This enum is returned as the Err() type describing which state the payment is in, see + * the description of individual enum states for more. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ typedef enum LDKPaymentSendFailure_Tag { /** * A parameter which was passed to send_payment was invalid, preventing us from attempting to - * send the payment at all. No channel state has been changed or messages sent to peers, and - * once you've changed the parameter at error, you can freely retry the payment in full. + * send the payment at all. + * + * You can freely resend the payment in full (with the parameter error fixed). + * + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ LDKPaymentSendFailure_ParameterError, /** * A parameter in a single path which was passed to send_payment was invalid, preventing us - * from attempting to send the payment at all. No channel state has been changed or messages - * sent to peers, and once you've changed the parameter at error, you can freely retry the - * payment in full. + * from attempting to send the payment at all. + * + * You can freely resend the payment in full (with the parameter error fixed). + * + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. * * The results here are ordered the same as the paths in the route object which was passed to * send_payment. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ LDKPaymentSendFailure_PathParameterError, /** * All paths which were attempted failed to send, with no channel state change taking place. - * You can freely retry the payment in full (though you probably want to do so over different + * You can freely resend the payment in full (though you probably want to do so over different * paths than the ones selected). + * + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed */ - LDKPaymentSendFailure_AllFailedRetrySafe, + LDKPaymentSendFailure_AllFailedResendSafe, /** - * Some paths which were attempted failed to send, though possibly not all. At least some - * paths have irrevocably committed to the HTLC and retrying the payment in full would result - * in over-/re-payment. + * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]). * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be - * safely retried via [`ChannelManager::retry_payment`]. + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed + */ + LDKPaymentSendFailure_DuplicatePayment, + /** + * Some paths that were attempted failed to send, though some paths may have succeeded. At least + * some paths have irrevocably committed to the HTLC. + * + * The results here are ordered the same as the paths in the route object that was passed to + * send_payment. + * + * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a + * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id. * - * Any entries which contain `Err(APIError::MonitorUpdateInprogress)` or `Ok(())` MUST NOT be - * retried as they will result in over-/re-payment. These HTLCs all either successfully sent - * (in the case of `Ok(())`) or will send once a [`MonitorEvent::Completed`] is provided for - * the next-hop channel with the latest update_id. + * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed */ LDKPaymentSendFailure_PartialFailure, /** @@ -7463,13 +8150,12 @@ typedef enum LDKPaymentSendFailure_Tag { typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { /** - * The errors themselves, in the same order as the route hops. + * The errors themselves, in the same order as the paths from the route. */ struct LDKCVec_CResult_NoneAPIErrorZZ results; /** * If some paths failed without irrevocably committing to the new HTLC(s), this will - * contain a [`RouteParameters`] object which can be used to calculate a new route that - * will pay all remaining unpaid balance. + * contain a [`RouteParameters`] object for the failing paths. * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -7490,76 +8176,141 @@ typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; }; struct { - struct LDKCVec_APIErrorZ all_failed_retry_safe; + struct LDKCVec_APIErrorZ all_failed_resend_safe; }; LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; }; } LDKPaymentSendFailure; /** - * The contents of CResult_PaymentIdPaymentSendFailureZ + * The contents of CResult_NonePaymentSendFailureZ */ -typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { +typedef union LDKCResult_NonePaymentSendFailureZPtr { /** - * 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 LDKThirtyTwoBytes *result; + void *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentIdPaymentSendFailureZPtr; +} LDKCResult_NonePaymentSendFailureZPtr; /** - * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, + * containing a () 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_PaymentIdPaymentSendFailureZ { +typedef struct LDKCResult_NonePaymentSendFailureZ { /** - * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * The contents of this CResult_NonePaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; + union LDKCResult_NonePaymentSendFailureZPtr contents; /** - * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. + * Whether this CResult_NonePaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentSendFailureZ; +} LDKCResult_NonePaymentSendFailureZ; /** - * The contents of CResult_NonePaymentSendFailureZ + * The contents of CResult_NoneRetryableSendFailureZ */ -typedef union LDKCResult_NonePaymentSendFailureZPtr { +typedef union LDKCResult_NoneRetryableSendFailureZPtr { /** * 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 LDKRetryableSendFailure *err; +} LDKCResult_NoneRetryableSendFailureZPtr; + +/** + * A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation, + * containing a () 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_NoneRetryableSendFailureZ { + /** + * The contents of this CResult_NoneRetryableSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneRetryableSendFailureZPtr contents; + /** + * Whether this CResult_NoneRetryableSendFailureZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneRetryableSendFailureZ; + +/** + * The contents of CResult_PaymentHashPaymentSendFailureZ + */ +typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_NonePaymentSendFailureZPtr; +} LDKCResult_PaymentHashPaymentSendFailureZPtr; /** - * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_PaymentHashPaymentSendFailureZ 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_NonePaymentSendFailureZ { +typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { /** - * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentSendFailureZPtr contents; + union LDKCResult_PaymentHashPaymentSendFailureZPtr contents; /** - * Whether this CResult_NonePaymentSendFailureZ represents a success state. + * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_PaymentHashPaymentSendFailureZ; + +/** + * The contents of CResult_PaymentHashRetryableSendFailureZ + */ +typedef union LDKCResult_PaymentHashRetryableSendFailureZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKRetryableSendFailure *err; +} LDKCResult_PaymentHashRetryableSendFailureZPtr; + +/** + * A CResult_PaymentHashRetryableSendFailureZ 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 { + /** + * The contents of this CResult_PaymentHashRetryableSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentHashRetryableSendFailureZPtr contents; + /** + * Whether this CResult_PaymentHashRetryableSendFailureZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentHashRetryableSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -7593,7 +8344,7 @@ typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { /** * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ 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 { @@ -8088,7 +8839,7 @@ typedef struct LDKWatch { * * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor */ - enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); + enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** * Returns any monitor events since the last call. Subsequent calls must only return new * events. @@ -8128,6 +8879,27 @@ typedef struct LDKBroadcasterInterface { void (*free)(void *this_arg); } LDKBroadcasterInterface; +/** + * A trait that describes a source of entropy. + */ +typedef struct LDKEntropySource { + /** + * 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 a unique, cryptographically-secure, random 32-byte value. This method must return a + * different value each time it is called. + */ + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(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); +} LDKEntropySource; + /** * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not * own the memory pointed to by data. @@ -8143,116 +8915,221 @@ typedef struct LDKu8slice { uintptr_t datalen; } LDKu8slice; + + /** - * A trait to describe an object which can get user secrets and key material. + * The unsigned part of a [`channel_update`] message. + * + * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ -typedef struct LDKKeysInterface { +typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 *this_arg; + LDKnativeUnsignedChannelUpdate *inner; /** - * Get node secret key based on the provided [`Recipient`]. - * - * The node_id/network_key is the public key that corresponds to this secret key. - * - * This method must return the same value each time it is called with a given `Recipient` - * parameter. - * - * Errors if the `Recipient` variant is not supported by the implementation. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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 LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient); + bool is_owned; +} LDKUnsignedChannelUpdate; + + + +/** + * The unsigned part of a [`node_announcement`] message. + * + * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message + */ +typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { /** - * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in - * [`get_node_secret`]. - * - * This method must return the same value each time it is called with a given `Recipient` - * parameter. - * - * Errors if the `Recipient` variant is not supported by the implementation. - * - * [`get_node_secret`]: KeysInterface::get_node_secret + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); + LDKnativeUnsignedNodeAnnouncement *inner; /** - * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if - * one is provided. Note that this tweak can be applied to `other_key` instead of our node - * secret, though this is less efficient. - * - * Errors if the `Recipient` variant is not supported by the implementation. - * - * [`node secret`]: Self::get_node_secret + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); + bool is_owned; +} LDKUnsignedNodeAnnouncement; + +/** + * Represents the set of gossip messages that require a signature from a node's identity key. + */ +typedef enum LDKUnsignedGossipMessage_Tag { /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * An unsigned channel announcement. */ - struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + LDKUnsignedGossipMessage_ChannelAnnouncement, /** - * Get a script pubkey which we will send funds to when closing a channel. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * An unsigned channel update. */ - struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); + LDKUnsignedGossipMessage_ChannelUpdate, + /** + * An unsigned node announcement. + */ + LDKUnsignedGossipMessage_NodeAnnouncement, + /** + * Must be last for serialization purposes + */ + LDKUnsignedGossipMessage_Sentinel, +} LDKUnsignedGossipMessage_Tag; + +typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage { + LDKUnsignedGossipMessage_Tag tag; + union { + struct { + struct LDKUnsignedChannelAnnouncement channel_announcement; + }; + struct { + struct LDKUnsignedChannelUpdate channel_update; + }; + struct { + struct LDKUnsignedNodeAnnouncement node_announcement; + }; + }; +} LDKUnsignedGossipMessage; + +/** + * A trait that can handle cryptographic operations at the scope level of a node. + */ +typedef struct LDKNodeSigner { + /** + * 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; /** - * Get a new set of Sign for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. * - * This method must return a different value each time it is called. + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. + * + * This method must return the same value each time it is called. + * + * [phantom node payments]: PhantomKeysManager */ - struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. + * Get node id based on the provided [`Recipient`]. * - * This method must return a different value each time it is called. + * This method must return the same value each time it is called with a given [`Recipient`] + * parameter. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); + struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); /** - * Reads a `Signer` for this `KeysInterface` from the given input stream. - * This is only called during deserialization of other objects which contain - * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. + * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if + * one is provided. Note that this tweak can be applied to `other_key` instead of our node + * secret, though this is less efficient. + * + * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error + * should be resolved to allow LDK to resume forwarding HTLCs. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); /** * Sign an invoice. + * * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of * this trait to parse the invoice and make sure they're signing what they expect, rather than * blindly signing the hash. - * The hrp is ascii bytes, while the invoice data is base32. + * + * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32. * * The secret key used to sign the invoice is dependent on the [`Recipient`]. * - * Errors if the `Recipient` variant is not supported by the implementation. + * 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 receipient); + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * Sign a gossip message. * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. + * Note that if this fails, LDK may panic and the message will not be broadcast to the network + * or a possible channel counterparty. If LDK panics, the error should be resolved to allow the + * 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); + /** + * 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); +} LDKNodeSigner; + +/** + * A trait that can return signer instances for individual channels. + */ +typedef struct LDKSignerProvider { + /** + * 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; + /** + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] 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`. * - * This method must return the same value each time it is called. + * This method must return a different value each time it is called. + */ + struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id); + /** + * Derives the private key material backing a `Signer`. * - * [phantom node payments]: PhantomKeysManager + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`ChannelSigner::channel_keys_id`]. */ - struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); + struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + /** + * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. + * This is only called during deserialization of other objects which contain + * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. + * + * 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 + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + /** + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + /** + * Get a script pubkey which we will send funds to when closing a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. + */ + struct LDKShutdownScript (*get_shutdown_scriptpubkey)(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); -} LDKKeysInterface; +} LDKSignerProvider; /** * A trait which should be implemented to provide feerate information on a number of time @@ -8285,6 +9162,35 @@ typedef struct LDKFeeEstimator { void (*free)(void *this_arg); } LDKFeeEstimator; +/** + * A trait defining behavior for routing a payment. + */ +typedef struct LDKRouter { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes + * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment. + * + * 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, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKRouter; + /** @@ -8319,6 +9225,15 @@ typedef struct LDKFeeEstimator { * offline for a full minute. In order to track this, you must call * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. * + * To avoid trivial DoS issues, ChannelManager limits the number of inbound connections and + * inbound channels without confirmed funding transactions. This may result in nodes which we do + * not have a channel with being unable to connect to us or open new channels with us if we have + * many peers with unfunded channels. + * + * Because it is an indication of trust, inbound channels which we've accepted as 0conf are + * exempted from the count of unfunded channels. Similarly, outbound channels and connections are + * never limited. Please ensure you limit the count of such channels yourself. + * * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but * essentially you should default to using a SimpleRefChannelManager, and use a @@ -8441,6 +9356,66 @@ typedef struct LDKCResult_ChannelConfigDecodeErrorZ { bool result_ok; } LDKCResult_ChannelConfigDecodeErrorZ; +/** + * An enum which can either contain a crate::lightning::util::errors::APIError or not + */ +typedef enum LDKCOption_APIErrorZ_Tag { + /** + * When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError + */ + LDKCOption_APIErrorZ_Some, + /** + * When we're in this state, this COption_APIErrorZ contains nothing + */ + LDKCOption_APIErrorZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_APIErrorZ_Sentinel, +} LDKCOption_APIErrorZ_Tag; + +typedef struct LDKCOption_APIErrorZ { + LDKCOption_APIErrorZ_Tag tag; + union { + struct { + struct LDKAPIError some; + }; + }; +} LDKCOption_APIErrorZ; + +/** + * The contents of CResult_COption_APIErrorZDecodeErrorZ + */ +typedef union LDKCResult_COption_APIErrorZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_APIErrorZ *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_APIErrorZDecodeErrorZPtr; + +/** + * A CResult_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_APIErrorZ 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_APIErrorZDecodeErrorZ { + /** + * The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_APIErrorZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_APIErrorZDecodeErrorZ; + /** * The contents of CResult_OutPointDecodeErrorZ */ @@ -8572,10 +9547,6 @@ typedef enum LDKPaymentError_Tag { * An error resulting from the provided [`Invoice`] or payment hash. */ LDKPaymentError_Invoice, - /** - * An error occurring when finding a route. - */ - LDKPaymentError_Routing, /** * An error occurring when sending a payment. */ @@ -8593,10 +9564,7 @@ typedef struct MUST_USE_STRUCT LDKPaymentError { struct LDKStr invoice; }; struct { - struct LDKLightningError routing; - }; - struct { - struct LDKPaymentSendFailure sending; + enum LDKRetryableSendFailure sending; }; }; } LDKPaymentError; @@ -8634,1383 +9602,1425 @@ typedef struct LDKCResult_PaymentIdPaymentErrorZ { bool result_ok; } LDKCResult_PaymentIdPaymentErrorZ; - +/** + * The contents of CResult_NonePaymentErrorZ + */ +typedef union LDKCResult_NonePaymentErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKPaymentError *err; +} LDKCResult_NonePaymentErrorZPtr; /** - * A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC - * is traveling in. The direction boolean is determined by checking if the HTLC source's public - * key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more - * details. + * A CResult_NonePaymentErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKInFlightHtlcs { +typedef struct LDKCResult_NonePaymentErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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_NonePaymentErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeInFlightHtlcs *inner; + union LDKCResult_NonePaymentErrorZPtr 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_NonePaymentErrorZ represents a success state. */ - bool is_owned; -} LDKInFlightHtlcs; + bool result_ok; +} LDKCResult_NonePaymentErrorZ; /** - * The contents of CResult_InFlightHtlcsDecodeErrorZ + * The contents of CResult_StringErrorZ */ -typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { +typedef union LDKCResult_StringErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInFlightHtlcs *result; + struct LDKStr *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_InFlightHtlcsDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_StringErrorZPtr; /** - * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_StringErrorZ represents the result of a fallible operation, + * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ { +typedef struct LDKCResult_StringErrorZ { /** - * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + * The contents of this CResult_StringErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; + union LDKCResult_StringErrorZPtr contents; /** - * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + * Whether this CResult_StringErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InFlightHtlcsDecodeErrorZ; +} LDKCResult_StringErrorZ; /** - * Sub-errors which don't have specific information in them use this type. + * The contents of CResult_PublicKeyErrorZ */ -typedef struct LDKError { +typedef union LDKCResult_PublicKeyErrorZPtr { /** - * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint8_t _dummy; -} LDKError; + struct LDKPublicKey *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeyErrorZPtr; /** - * Errors that indicate what is wrong with the invoice. They have some granularity for debug - * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. + * A CResult_PublicKeyErrorZ 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 enum LDKParseError_Tag { - LDKParseError_Bech32Error, - LDKParseError_ParseAmountError, - LDKParseError_MalformedSignature, - LDKParseError_BadPrefix, - LDKParseError_UnknownCurrency, - LDKParseError_UnknownSiPrefix, - LDKParseError_MalformedHRP, - LDKParseError_TooShortDataPart, - LDKParseError_UnexpectedEndOfTaggedFields, - LDKParseError_DescriptionDecodeError, - LDKParseError_PaddingError, - LDKParseError_IntegerOverflowError, - LDKParseError_InvalidSegWitProgramLength, - LDKParseError_InvalidPubKeyHashLength, - LDKParseError_InvalidScriptHashLength, - LDKParseError_InvalidRecoveryId, - LDKParseError_InvalidSliceLength, +typedef struct LDKCResult_PublicKeyErrorZ { /** - * Not an error, but used internally to signal that a part of the invoice should be ignored - * according to BOLT11 + * The contents of this CResult_PublicKeyErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKParseError_Skip, + union LDKCResult_PublicKeyErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_PublicKeyErrorZ represents a success state. */ - LDKParseError_Sentinel, -} LDKParseError_Tag; - -typedef struct MUST_USE_STRUCT LDKParseError { - LDKParseError_Tag tag; - union { - struct { - struct LDKBech32Error bech32_error; - }; - struct { - struct LDKError parse_amount_error; - }; - struct { - enum LDKSecp256k1Error malformed_signature; - }; - struct { - struct LDKError description_decode_error; - }; - struct { - struct LDKStr invalid_slice_length; - }; - }; -} LDKParseError; + bool result_ok; +} LDKCResult_PublicKeyErrorZ; /** - * The contents of CResult_SiPrefixParseErrorZ + * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ */ -typedef union LDKCResult_SiPrefixParseErrorZPtr { +typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKSiPrefix *result; + struct LDKChannelMonitorUpdate *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKParseError *err; -} LDKCResult_SiPrefixParseErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; /** - * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure. + * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SiPrefixParseErrorZ { +typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { /** - * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SiPrefixParseErrorZPtr contents; + union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_SiPrefixParseErrorZ represents a success state. + * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SiPrefixParseErrorZ; - - - -/** - * Represents a syntactically and semantically correct lightning BOLT11 invoice. - * - * There are three ways to construct an `Invoice`: - * 1. using `InvoiceBuilder` - * 2. using `Invoice::from_signed(SignedRawInvoice)` - * 3. using `str::parse::(&str)` - */ -typedef struct MUST_USE_STRUCT LDKInvoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoice *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInvoice; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; /** - * Indicates that something went wrong while parsing or validating the invoice. Parsing errors - * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors - * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice. + * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not */ -typedef enum LDKParseOrSemanticError_Tag { +typedef enum LDKCOption_MonitorEventZ_Tag { /** - * The invoice couldn't be decoded + * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent */ - LDKParseOrSemanticError_ParseError, + LDKCOption_MonitorEventZ_Some, /** - * The invoice could be decoded but violates the BOLT11 standard + * When we're in this state, this COption_MonitorEventZ contains nothing */ - LDKParseOrSemanticError_SemanticError, + LDKCOption_MonitorEventZ_None, /** * Must be last for serialization purposes */ - LDKParseOrSemanticError_Sentinel, -} LDKParseOrSemanticError_Tag; + LDKCOption_MonitorEventZ_Sentinel, +} LDKCOption_MonitorEventZ_Tag; -typedef struct MUST_USE_STRUCT LDKParseOrSemanticError { - LDKParseOrSemanticError_Tag tag; +typedef struct LDKCOption_MonitorEventZ { + LDKCOption_MonitorEventZ_Tag tag; union { struct { - struct LDKParseError parse_error; - }; - struct { - enum LDKSemanticError semantic_error; + struct LDKMonitorEvent some; }; }; -} LDKParseOrSemanticError; +} LDKCOption_MonitorEventZ; /** - * The contents of CResult_InvoiceParseOrSemanticErrorZ + * The contents of CResult_COption_MonitorEventZDecodeErrorZ */ -typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { +typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoice *result; + struct LDKCOption_MonitorEventZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKParseOrSemanticError *err; -} LDKCResult_InvoiceParseOrSemanticErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; /** - * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. + * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { +typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { /** - * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents; + union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceParseOrSemanticErrorZ; - - - -/** - * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be - * invalid. - * - * # Invariants - * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. - */ -typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSignedRawInvoice *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSignedRawInvoice; +} LDKCResult_COption_MonitorEventZDecodeErrorZ; /** - * The contents of CResult_SignedRawInvoiceParseErrorZ + * The contents of CResult_HTLCUpdateDecodeErrorZ */ -typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSignedRawInvoice *result; + struct LDKHTLCUpdate *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKParseError *err; -} LDKCResult_SignedRawInvoiceParseErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; /** - * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure. + * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** - * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either + * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. + * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SignedRawInvoiceParseErrorZ; - - +} LDKCResult_HTLCUpdateDecodeErrorZ; /** - * Represents an syntactically correct Invoice for a payment on the lightning network, - * but without the signature information. - * De- and encoding should not lead to information loss but may lead to different hashes. - * - * For methods without docs see the corresponding methods in `Invoice`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKRawInvoice { +typedef struct LDKC2Tuple_OutPointScriptZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativeRawInvoice *inner; + struct LDKOutPoint a; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The element at position 1 */ - bool is_owned; -} LDKRawInvoice; - - + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointScriptZ; /** - * Recoverable signature + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKInvoiceSignature { +typedef struct LDKC2Tuple_u32ScriptZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativeInvoiceSignature *inner; + uint32_t a; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The element at position 1 */ - bool is_owned; -} LDKInvoiceSignature; + struct LDKCVec_u8Z b; +} LDKC2Tuple_u32ScriptZ; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { - /** - * The element at position 0 - */ - struct LDKRawInvoice a; +typedef struct LDKCVec_C2Tuple_u32ScriptZZ { /** - * The element at position 1 + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes b; + struct LDKC2Tuple_u32ScriptZ *data; /** - * The element at position 2 + * The number of elements pointed to by `data`. */ - struct LDKInvoiceSignature c; -} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; - - + uintptr_t datalen; +} LDKCVec_C2Tuple_u32ScriptZZ; /** - * Payee public key + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKPayeePubKey { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativePayeePubKey *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; -} LDKPayeePubKey; - -/** - * The contents of CResult_PayeePubKeyErrorZ - */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPayeePubKey *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_PayeePubKeyErrorZPtr; + struct LDKCVec_C2Tuple_u32ScriptZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; /** - * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_PayeePubKeyErrorZ { +typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { /** - * The contents of this CResult_PayeePubKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - union LDKCResult_PayeePubKeyErrorZPtr contents; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; - - + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** - * Private routing information - * - * # Invariants - * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) - * + * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKPrivateRoute { +typedef struct LDKCVec_EventZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativePrivateRoute *inner; + struct LDKEvent *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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKPrivateRoute; + uintptr_t datalen; +} LDKCVec_EventZ; /** - * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. + * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_PrivateRouteZ { +typedef struct LDKCVec_TransactionZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKPrivateRoute *data; + struct LDKTransaction *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_PrivateRouteZ; - - +} LDKCVec_TransactionZ; /** - * A timestamp that refers to a date after 1 January 1970. - * - * # Invariants - * - * The Unix timestamp representing the stored time has to be positive and no greater than - * [`MAX_TIMESTAMP`]. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { +typedef struct LDKC2Tuple_u32TxOutZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativePositiveTimestamp *inner; + uint32_t a; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The element at position 1 */ - bool is_owned; -} LDKPositiveTimestamp; + struct LDKTxOut b; +} LDKC2Tuple_u32TxOutZ; /** - * The contents of CResult_PositiveTimestampCreationErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { +typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** - * 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 LDKPositiveTimestamp *result; + struct LDKC2Tuple_u32TxOutZ *data; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The number of elements pointed to by `data`. */ - enum LDKCreationError *err; -} LDKCResult_PositiveTimestampCreationErrorZPtr; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32TxOutZZ; /** - * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCResult_PositiveTimestampCreationErrorZ { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { /** - * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The element at position 0 */ - union LDKCResult_PositiveTimestampCreationErrorZPtr contents; + struct LDKThirtyTwoBytes a; /** - * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. + * The element at position 1 */ - bool result_ok; -} LDKCResult_PositiveTimestampCreationErrorZ; + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; /** - * The contents of CResult_NoneSemanticErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_NoneSemanticErrorZPtr { +typedef struct LDKCVec_TransactionOutputsZ { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void *result; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The number of elements pointed to by `data`. */ - enum LDKSemanticError *err; -} LDKCResult_NoneSemanticErrorZPtr; + uintptr_t datalen; +} LDKCVec_TransactionOutputsZ; /** - * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Details about the balance(s) available for spending once the channel appears on chain. + * + * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not + * be provided. */ -typedef struct LDKCResult_NoneSemanticErrorZ { +typedef enum LDKBalance_Tag { /** - * The contents of this CResult_NoneSemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The channel is not yet closed (or the commitment or closing transaction has not yet + * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is + * force-closed now. */ - union LDKCResult_NoneSemanticErrorZPtr contents; + LDKBalance_ClaimableOnChannelClose, /** - * Whether this CResult_NoneSemanticErrorZ represents a success state. + * The channel has been closed, and the given balance is ours but awaiting confirmations until + * we consider it spendable. */ - bool result_ok; -} LDKCResult_NoneSemanticErrorZ; - -/** - * The contents of CResult_InvoiceSemanticErrorZ - */ -typedef union LDKCResult_InvoiceSemanticErrorZPtr { + LDKBalance_ClaimableAwaitingConfirmations, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The channel has been closed, and the given balance should be ours but awaiting spending + * transaction confirmation. If the spending transaction does not confirm in time, it is + * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. + * + * Once the spending transaction confirms, before it has reached enough confirmations to be + * considered safe from chain reorganizations, the balance will instead be provided via + * [`Balance::ClaimableAwaitingConfirmations`]. */ - struct LDKInvoice *result; + LDKBalance_ContentiousClaimable, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain + * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat + * likely to be claimed by our counterparty before we do. */ - enum LDKSemanticError *err; -} LDKCResult_InvoiceSemanticErrorZPtr; - -/** - * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceSemanticErrorZ { + LDKBalance_MaybeTimeoutClaimableHTLC, /** - * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * HTLCs which we received from our counterparty which are claimable with a preimage which we + * do not currently have. This will only be claimable if we receive the preimage from the node + * to which we forwarded this HTLC before the timeout. */ - union LDKCResult_InvoiceSemanticErrorZPtr contents; + LDKBalance_MaybePreimageClaimableHTLC, /** - * Whether this CResult_InvoiceSemanticErrorZ represents a success state. + * The channel has been closed, and our counterparty broadcasted a revoked commitment + * transaction. + * + * Thus, we're able to claim all outputs in the commitment transaction, one of which has the + * following amount. */ - bool result_ok; -} LDKCResult_InvoiceSemanticErrorZ; - - - -/** - * Description string - * - * # Invariants - * The description can be at most 639 __bytes__ long - */ -typedef struct MUST_USE_STRUCT LDKDescription { + LDKBalance_CounterpartyRevokedOutputClaimable, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Must be last for serialization purposes */ - LDKnativeDescription *inner; + LDKBalance_Sentinel, +} LDKBalance_Tag; + +typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - bool is_owned; -} LDKDescription; + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKClaimableOnChannelClose_Body; -/** - * The contents of CResult_DescriptionCreationErrorZ - */ -typedef union LDKCResult_DescriptionCreationErrorZPtr { +typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The amount available to claim, in satoshis, possibly excluding the on-chain fees which + * were spent in broadcasting the transaction. */ - struct LDKDescription *result; + uint64_t claimable_amount_satoshis; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The height at which an [`Event::SpendableOutputs`] event will be generated for this + * amount. */ - enum LDKCreationError *err; -} LDKCResult_DescriptionCreationErrorZPtr; + uint32_t confirmation_height; +} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + +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; + /** + * The height at which the counterparty may be able to claim the balance if we have not + * done so. + */ + uint32_t timeout_height; +} LDKBalance_LDKContentiousClaimable_Body; + +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; + /** + * The height at which we will be able to claim the balance if our counterparty has not + * done so. + */ + uint32_t claimable_height; +} LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body; + +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; + /** + * 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. + */ + uint32_t expiry_height; +} LDKBalance_LDKMaybePreimageClaimableHTLC_Body; + +typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body { + /** + * The amount, in satoshis, of the output which we can claim. + * + * Note that for outputs from HTLC balances this may be excluding some on-chain fees that + * were already spent. + */ + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body; + +typedef struct MUST_USE_STRUCT LDKBalance { + LDKBalance_Tag tag; + union { + LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; + LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; + LDKBalance_LDKContentiousClaimable_Body contentious_claimable; + LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc; + LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc; + LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable; + }; +} LDKBalance; /** - * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_DescriptionCreationErrorZ { +typedef struct LDKCVec_BalanceZ { /** - * The contents of this CResult_DescriptionCreationErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - union LDKCResult_DescriptionCreationErrorZPtr contents; + struct LDKBalance *data; /** - * Whether this CResult_DescriptionCreationErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_DescriptionCreationErrorZ; + uintptr_t datalen; +} LDKCVec_BalanceZ; /** - * The contents of CResult_PrivateRouteCreationErrorZ + * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ */ -typedef union LDKCResult_PrivateRouteCreationErrorZPtr { +typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPrivateRoute *result; + struct LDKC2Tuple_BlockHashChannelMonitorZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKCreationError *err; -} LDKCResult_PrivateRouteCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; /** - * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PrivateRouteCreationErrorZ { +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { /** - * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either + * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PrivateRouteCreationErrorZPtr contents; + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; /** - * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. + * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PrivateRouteCreationErrorZ; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; /** - * The contents of CResult_StringErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_StringErrorZPtr { +typedef struct LDKC2Tuple_PublicKeyTypeZ { /** - * 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 LDKPublicKey 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 LDKType b; +} LDKC2Tuple_PublicKeyTypeZ; /** - * 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`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_StringErrorZ { +typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { /** - * The contents of this CResult_StringErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - union LDKCResult_StringErrorZPtr contents; + struct LDKC2Tuple_PublicKeyTypeZ *data; /** - * Whether this CResult_StringErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_StringErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_PublicKeyTypeZZ; /** - * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ + * The contents of a custom onion message. */ -typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { +typedef struct LDKCustomOnionMessageContents { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - struct LDKChannelMonitorUpdate *result; + void *this_arg; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Returns the TLV type identifying the message contents. MUST be >= 64. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; - -/** - * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { + uint64_t (*tlv_type)(const void *this_arg); /** - * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Serialize the object into a byte array */ - union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; + struct LDKCVec_u8Z (*write)(const void *this_arg); /** - * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ - bool result_ok; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; + void (*free)(void *this_arg); +} LDKCustomOnionMessageContents; /** - * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not + * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not */ -typedef enum LDKCOption_MonitorEventZ_Tag { +typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag { /** - * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents */ - LDKCOption_MonitorEventZ_Some, + LDKCOption_CustomOnionMessageContentsZ_Some, /** - * When we're in this state, this COption_MonitorEventZ contains nothing + * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing */ - LDKCOption_MonitorEventZ_None, + LDKCOption_CustomOnionMessageContentsZ_None, /** * Must be last for serialization purposes */ - LDKCOption_MonitorEventZ_Sentinel, -} LDKCOption_MonitorEventZ_Tag; + LDKCOption_CustomOnionMessageContentsZ_Sentinel, +} LDKCOption_CustomOnionMessageContentsZ_Tag; -typedef struct LDKCOption_MonitorEventZ { - LDKCOption_MonitorEventZ_Tag tag; +typedef struct LDKCOption_CustomOnionMessageContentsZ { + LDKCOption_CustomOnionMessageContentsZ_Tag tag; union { struct { - struct LDKMonitorEvent some; + struct LDKCustomOnionMessageContents some; }; }; -} LDKCOption_MonitorEventZ; +} LDKCOption_CustomOnionMessageContentsZ; /** - * The contents of CResult_COption_MonitorEventZDecodeErrorZ + * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ */ -typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { +typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_MonitorEventZ *result; + struct LDKCOption_CustomOnionMessageContentsZ *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_MonitorEventZDecodeErrorZPtr; +} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr; /** - * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * 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. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { +typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ { /** - * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either + * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; + union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents; /** - * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_MonitorEventZDecodeErrorZ; +} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ; /** - * The contents of CResult_HTLCUpdateDecodeErrorZ + * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not */ -typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { +typedef enum LDKCOption_NetAddressZ_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress */ - struct LDKHTLCUpdate *result; + LDKCOption_NetAddressZ_Some, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * When we're in this state, this COption_NetAddressZ contains nothing */ - struct LDKDecodeError *err; -} LDKCResult_HTLCUpdateDecodeErrorZPtr; + LDKCOption_NetAddressZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NetAddressZ_Sentinel, +} LDKCOption_NetAddressZ_Tag; -/** - * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { - /** - * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; - /** - * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_HTLCUpdateDecodeErrorZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_OutPointScriptZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; - /** - * The element at position 1 - */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointScriptZ; +typedef struct LDKCOption_NetAddressZ { + LDKCOption_NetAddressZ_Tag tag; + union { + struct { + struct LDKNetAddress some; + }; + }; +} LDKCOption_NetAddressZ; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_u32ScriptZ { +typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { /** * The element at position 0 */ - uint32_t a; + struct LDKPublicKey a; /** * The element at position 1 */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; + struct LDKCOption_NetAddressZ b; +} LDKC2Tuple_PublicKeyCOption_NetAddressZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_NetAddressZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ { /** * 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_PublicKeyCOption_NetAddressZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_u32ScriptZZ; +} LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Error for PeerManager errors. If you get one of these, you must disconnect the socket and + * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the + * descriptor. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { /** - * The element at position 0 + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes a; + LDKnativePeerHandleError *inner; /** - * The element at position 1 + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; + bool is_owned; +} LDKPeerHandleError; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_CVec_u8ZPeerHandleErrorZ */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; + struct LDKCVec_u8Z *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; + struct LDKPeerHandleError *err; +} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; /** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_EventZ { +typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { /** - * 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_CVec_u8ZPeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKEvent *data; + union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_EventZ; + bool result_ok; +} LDKCResult_CVec_u8ZPeerHandleErrorZ; /** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_NonePeerHandleErrorZ */ -typedef struct LDKCVec_TransactionZ { +typedef union LDKCResult_NonePeerHandleErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKTransaction *data; + void *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_TransactionZ; + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_u32TxOutZ { +typedef struct LDKCResult_NonePeerHandleErrorZ { /** - * The element at position 0 + * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint32_t a; + union LDKCResult_NonePeerHandleErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_NonePeerHandleErrorZ represents a success state. */ - struct LDKTxOut b; -} LDKC2Tuple_u32TxOutZ; + bool result_ok; +} LDKCResult_NonePeerHandleErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_boolPeerHandleErrorZ */ -typedef struct LDKCVec_C2Tuple_u32TxOutZZ { +typedef union LDKCResult_boolPeerHandleErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_u32TxOutZ *data; + bool *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_u32TxOutZZ; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, + * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef struct LDKCResult_boolPeerHandleErrorZ { /** - * The element at position 0 + * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes a; + union LDKCResult_boolPeerHandleErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_boolPeerHandleErrorZ represents a success state. */ - struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + bool result_ok; +} LDKCResult_boolPeerHandleErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * Errors that may occur when [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message */ -typedef struct LDKCVec_TransactionOutputsZ { +typedef enum LDKSendError_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Errored computing onion message packet keys. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; + LDKSendError_Secp256k1, /** - * The number of elements pointed to by `data`. + * Because implementations such as Eclair will drop onion messages where the message packet + * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size. */ - uintptr_t datalen; -} LDKCVec_TransactionOutputsZ; - -/** - * Details about the balance(s) available for spending once the channel appears on chain. - * - * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not - * be provided. - */ -typedef enum LDKBalance_Tag { + LDKSendError_TooBigPacket, /** - * The channel is not yet closed (or the commitment or closing transaction has not yet - * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - * force-closed now. + * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two + * blinded hops. */ - LDKBalance_ClaimableOnChannelClose, + LDKSendError_TooFewBlindedHops, /** - * The channel has been closed, and the given balance is ours but awaiting confirmations until - * we consider it spendable. + * Our next-hop peer was offline or does not support onion message forwarding. */ - LDKBalance_ClaimableAwaitingConfirmations, + LDKSendError_InvalidFirstHop, /** - * The channel has been closed, and the given balance should be ours but awaiting spending - * transaction confirmation. If the spending transaction does not confirm in time, it is - * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. - * - * Once the spending transaction confirms, before it has reached enough confirmations to be - * considered safe from chain reorganizations, the balance will instead be provided via - * [`Balance::ClaimableAwaitingConfirmations`]. + * Onion message contents must have a TLV type >= 64. */ - LDKBalance_ContentiousClaimable, + LDKSendError_InvalidMessage, /** - * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain - * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat - * likely to be claimed by our counterparty before we do. + * Our next-hop peer's buffer was full or our total outbound buffer was full. */ - LDKBalance_MaybeTimeoutClaimableHTLC, + LDKSendError_BufferFull, /** - * HTLCs which we received from our counterparty which are claimable with a preimage which we - * do not currently have. This will only be claimable if we receive the preimage from the node - * to which we forwarded this HTLC before the timeout. + * Failed to retrieve our node id from the provided [`NodeSigner`]. + * + * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner */ - LDKBalance_MaybePreimageClaimableHTLC, + LDKSendError_GetNodeIdFailed, /** - * The channel has been closed, and our counterparty broadcasted a revoked commitment - * transaction. - * - * Thus, we're able to claim all outputs in the commitment transaction, one of which has the - * following amount. + * We attempted to send to a blinded path where we are the introduction node, and failed to + * advance the blinded path to make the second hop the new introduction node. Either + * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the + * new blinding point, or we were attempting to send to ourselves. */ - LDKBalance_CounterpartyRevokedOutputClaimable, + LDKSendError_BlindedPathAdvanceFailed, /** * Must be last for serialization purposes */ - LDKBalance_Sentinel, -} LDKBalance_Tag; + LDKSendError_Sentinel, +} LDKSendError_Tag; -typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { +typedef struct MUST_USE_STRUCT LDKSendError { + LDKSendError_Tag tag; + union { + struct { + enum LDKSecp256k1Error secp256k1; + }; + }; +} LDKSendError; + +/** + * The contents of CResult_NoneSendErrorZ + */ +typedef union LDKCResult_NoneSendErrorZPtr { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * Note that this value is always NULL, as there are no contents in the OK variant */ - uint64_t claimable_amount_satoshis; -} LDKBalance_LDKClaimableOnChannelClose_Body; + void *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; -typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { +/** + * A CResult_NoneSendErrorZ represents the result of a fallible operation, + * containing a () 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 { /** - * The amount available to claim, in satoshis, possibly excluding the on-chain fees which - * were spent in broadcasting the transaction. + * The contents of this CResult_NoneSendErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t claimable_amount_satoshis; + union LDKCResult_NoneSendErrorZPtr contents; /** - * The height at which an [`Event::SpendableOutputs`] event will be generated for this - * amount. + * Whether this CResult_NoneSendErrorZ represents a success state. */ - uint32_t confirmation_height; -} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + bool result_ok; +} LDKCResult_NoneSendErrorZ; -typedef struct LDKBalance_LDKContentiousClaimable_Body { +/** + * Sub-errors which don't have specific information in them use this type. + */ +typedef struct LDKError { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here */ - uint64_t claimable_amount_satoshis; + uint8_t _dummy; +} LDKError; + +/** + * Errors that indicate what is wrong with the invoice. They have some granularity for debug + * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. + */ +typedef enum LDKParseError_Tag { + LDKParseError_Bech32Error, + LDKParseError_ParseAmountError, + LDKParseError_MalformedSignature, + LDKParseError_BadPrefix, + LDKParseError_UnknownCurrency, + LDKParseError_UnknownSiPrefix, + LDKParseError_MalformedHRP, + LDKParseError_TooShortDataPart, + LDKParseError_UnexpectedEndOfTaggedFields, + LDKParseError_DescriptionDecodeError, + LDKParseError_PaddingError, + LDKParseError_IntegerOverflowError, + LDKParseError_InvalidSegWitProgramLength, + LDKParseError_InvalidPubKeyHashLength, + LDKParseError_InvalidScriptHashLength, + LDKParseError_InvalidRecoveryId, + LDKParseError_InvalidSliceLength, /** - * The height at which the counterparty may be able to claim the balance if we have not - * done so. + * Not an error, but used internally to signal that a part of the invoice should be ignored + * according to BOLT11 */ - uint32_t timeout_height; -} LDKBalance_LDKContentiousClaimable_Body; + LDKParseError_Skip, + /** + * Must be last for serialization purposes + */ + LDKParseError_Sentinel, +} LDKParseError_Tag; -typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { +typedef struct MUST_USE_STRUCT LDKParseError { + LDKParseError_Tag tag; + union { + struct { + struct LDKBech32Error bech32_error; + }; + struct { + struct LDKError parse_amount_error; + }; + struct { + enum LDKSecp256k1Error malformed_signature; + }; + struct { + struct LDKError description_decode_error; + }; + struct { + struct LDKStr invalid_slice_length; + }; + }; +} LDKParseError; + +/** + * The contents of CResult_SiPrefixParseErrorZ + */ +typedef union LDKCResult_SiPrefixParseErrorZPtr { /** - * The amount potentially available to claim, in satoshis, excluding the on-chain fees - * which will be required to do so. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint64_t claimable_amount_satoshis; + enum LDKSiPrefix *result; /** - * The height at which we will be able to claim the balance if our counterparty has not - * done so. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uint32_t claimable_height; -} LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body; + struct LDKParseError *err; +} LDKCResult_SiPrefixParseErrorZPtr; -typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { +/** + * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SiPrefixParseErrorZ { /** - * The amount potentially available to claim, in satoshis, excluding the on-chain fees - * which will be required to do so. + * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t claimable_amount_satoshis; + union LDKCResult_SiPrefixParseErrorZPtr contents; /** - * 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. + * Whether this CResult_SiPrefixParseErrorZ represents a success state. */ - uint32_t expiry_height; -} LDKBalance_LDKMaybePreimageClaimableHTLC_Body; + bool result_ok; +} LDKCResult_SiPrefixParseErrorZ; -typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body { + + +/** + * Represents a syntactically and semantically correct lightning BOLT11 invoice. + * + * There are three ways to construct an `Invoice`: + * 1. using `InvoiceBuilder` + * 2. using `Invoice::from_signed(SignedRawInvoice)` + * 3. using `str::parse::(&str)` + */ +typedef struct MUST_USE_STRUCT LDKInvoice { /** - * The amount, in satoshis, of the output which we can claim. - * - * Note that for outputs from HTLC balances this may be excluding some on-chain fees that - * were already spent. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - uint64_t claimable_amount_satoshis; -} LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body; + LDKnativeInvoice *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInvoice; -typedef struct MUST_USE_STRUCT LDKBalance { - LDKBalance_Tag tag; +/** + * Indicates that something went wrong while parsing or validating the invoice. Parsing errors + * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors + * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice. + */ +typedef enum LDKParseOrSemanticError_Tag { + /** + * The invoice couldn't be decoded + */ + LDKParseOrSemanticError_ParseError, + /** + * The invoice could be decoded but violates the BOLT11 standard + */ + LDKParseOrSemanticError_SemanticError, + /** + * Must be last for serialization purposes + */ + LDKParseOrSemanticError_Sentinel, +} LDKParseOrSemanticError_Tag; + +typedef struct MUST_USE_STRUCT LDKParseOrSemanticError { + LDKParseOrSemanticError_Tag tag; union { - LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; - LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; - LDKBalance_LDKContentiousClaimable_Body contentious_claimable; - LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc; - LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc; - LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable; + struct { + struct LDKParseError parse_error; + }; + struct { + enum LDKSemanticError semantic_error; + }; }; -} LDKBalance; +} LDKParseOrSemanticError; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_InvoiceParseOrSemanticErrorZ */ -typedef struct LDKCVec_BalanceZ { +typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBalance *data; + struct LDKInvoice *result; /** - * The number of elements pointed to by `data`. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uintptr_t datalen; -} LDKCVec_BalanceZ; + struct LDKParseOrSemanticError *err; +} LDKCResult_InvoiceParseOrSemanticErrorZPtr; /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { + /** + * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceParseOrSemanticErrorZ; + + + +/** + * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be + * invalid. + * + * # Invariants + * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. + */ +typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSignedRawInvoice *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSignedRawInvoice; + +/** + * The contents of CResult_SignedRawInvoiceParseErrorZ + */ +typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { /** * 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 LDKSignedRawInvoice *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; + struct LDKParseError *err; +} LDKCResult_SignedRawInvoiceParseErrorZPtr; /** - * 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_SignedRawInvoiceParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_SignedRawInvoiceParseErrorZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Represents an syntactically correct Invoice for a payment on the lightning network, + * but without the signature information. + * De- and encoding should not lead to information loss but may lead to different hashes. + * + * For methods without docs see the corresponding methods in `Invoice`. */ -typedef struct LDKC2Tuple_PublicKeyTypeZ { +typedef struct MUST_USE_STRUCT LDKRawInvoice { /** - * 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 LDKPublicKey a; + LDKnativeRawInvoice *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 LDKType b; -} LDKC2Tuple_PublicKeyTypeZ; + bool is_owned; +} LDKRawInvoice; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. - * This corresponds to std::vector in C++ + * Recoverable signature */ -typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { +typedef struct MUST_USE_STRUCT LDKInvoiceSignature { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKC2Tuple_PublicKeyTypeZ *data; + LDKnativeInvoiceSignature *inner; /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyTypeZZ; + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInvoiceSignature; /** - * The contents of a custom onion message. + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef struct LDKCustomOnionMessageContents { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { /** - * Returns the TLV type identifying the message contents. MUST be >= 64. + * The element at position 0 */ - uint64_t (*tlv_type)(const void *this_arg); + struct LDKRawInvoice a; /** - * Serialize the object into a byte array + * The element at position 1 */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + struct LDKThirtyTwoBytes b; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * The element at position 2 */ - void (*free)(void *this_arg); -} LDKCustomOnionMessageContents; + struct LDKInvoiceSignature c; +} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; + + /** - * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not + * Payee public key */ -typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag { - /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents - */ - LDKCOption_CustomOnionMessageContentsZ_Some, +typedef struct MUST_USE_STRUCT LDKPayeePubKey { /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing + * A pointer to the opaque Rust object. + * Nearly everywhere, 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_CustomOnionMessageContentsZ_None, + LDKnativePayeePubKey *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. */ - LDKCOption_CustomOnionMessageContentsZ_Sentinel, -} LDKCOption_CustomOnionMessageContentsZ_Tag; - -typedef struct LDKCOption_CustomOnionMessageContentsZ { - LDKCOption_CustomOnionMessageContentsZ_Tag tag; - union { - struct { - struct LDKCustomOnionMessageContents some; - }; - }; -} LDKCOption_CustomOnionMessageContentsZ; + bool is_owned; +} LDKPayeePubKey; /** - * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ + * The contents of CResult_PayeePubKeyErrorZ */ -typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +typedef union LDKCResult_PayeePubKeyErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_CustomOnionMessageContentsZ *result; + struct LDKPayeePubKey *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_PayeePubKeyErrorZPtr; /** - * 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_PayeePubKeyErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ { +typedef struct LDKCResult_PayeePubKeyErrorZ { /** - * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either + * The contents of this CResult_PayeePubKeyErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents; + union LDKCResult_PayeePubKeyErrorZPtr contents; /** - * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. + * Whether this CResult_PayeePubKeyErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ; +} LDKCResult_PayeePubKeyErrorZ; + + /** - * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + * Private routing information + * + * # Invariants + * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * */ -typedef enum LDKCOption_NetAddressZ_Tag { +typedef struct MUST_USE_STRUCT LDKPrivateRoute { /** - * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + * A pointer to the opaque Rust object. + * Nearly everywhere, 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_NetAddressZ_Some, + LDKnativePrivateRoute *inner; /** - * When we're in this state, this COption_NetAddressZ 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_NetAddressZ_None, + bool is_owned; +} LDKPrivateRoute; + +/** + * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PrivateRouteZ { /** - * Must be last for serialization purposes + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_NetAddressZ_Sentinel, -} LDKCOption_NetAddressZ_Tag; - -typedef struct LDKCOption_NetAddressZ { - LDKCOption_NetAddressZ_Tag tag; - union { - struct { - struct LDKNetAddress some; - }; - }; -} LDKCOption_NetAddressZ; + struct LDKPrivateRoute *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PrivateRouteZ; /** - * Error for PeerManager errors. If you get one of these, you must disconnect the socket and - * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the - * descriptor. + * A timestamp that refers to a date after 1 January 1970. + * + * # Invariants + * + * The Unix timestamp representing the stored time has to be positive and no greater than + * [`MAX_TIMESTAMP`]. */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePeerHandleError *inner; + LDKnativePositiveTimestamp *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKPeerHandleError; +} LDKPositiveTimestamp; /** - * The contents of CResult_CVec_u8ZPeerHandleErrorZ + * The contents of CResult_PositiveTimestampCreationErrorZ */ -typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { +typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { /** * 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 LDKPositiveTimestamp *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_PositiveTimestampCreationErrorZPtr; /** - * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { +typedef struct LDKCResult_PositiveTimestampCreationErrorZ { /** - * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either + * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; + union LDKCResult_PositiveTimestampCreationErrorZPtr contents; /** - * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_u8ZPeerHandleErrorZ; +} LDKCResult_PositiveTimestampCreationErrorZ; /** - * The contents of CResult_NonePeerHandleErrorZ + * The contents of CResult_NoneSemanticErrorZ */ -typedef union LDKCResult_NonePeerHandleErrorZPtr { +typedef union LDKCResult_NoneSemanticErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -10019,137 +11029,147 @@ typedef union LDKCResult_NonePeerHandleErrorZPtr { * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_NonePeerHandleErrorZPtr; + enum LDKSemanticError *err; +} LDKCResult_NoneSemanticErrorZPtr; /** - * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning_invoice::SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NonePeerHandleErrorZ { +typedef struct LDKCResult_NoneSemanticErrorZ { /** - * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * The contents of this CResult_NoneSemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePeerHandleErrorZPtr contents; + union LDKCResult_NoneSemanticErrorZPtr contents; /** - * Whether this CResult_NonePeerHandleErrorZ represents a success state. + * Whether this CResult_NoneSemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePeerHandleErrorZ; +} LDKCResult_NoneSemanticErrorZ; /** - * The contents of CResult_boolPeerHandleErrorZ + * The contents of CResult_InvoiceSemanticErrorZ */ -typedef union LDKCResult_boolPeerHandleErrorZPtr { +typedef union LDKCResult_InvoiceSemanticErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - bool *result; + struct LDKInvoice *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_boolPeerHandleErrorZPtr; + enum LDKSemanticError *err; +} LDKCResult_InvoiceSemanticErrorZPtr; /** - * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, - * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_boolPeerHandleErrorZ { +typedef struct LDKCResult_InvoiceSemanticErrorZ { /** - * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_boolPeerHandleErrorZPtr contents; + union LDKCResult_InvoiceSemanticErrorZPtr contents; /** - * Whether this CResult_boolPeerHandleErrorZ represents a success state. + * Whether this CResult_InvoiceSemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_boolPeerHandleErrorZ; +} LDKCResult_InvoiceSemanticErrorZ; + + /** - * Errors that may occur when [sending an onion message]. + * Description string * - * [sending an onion message]: OnionMessenger::send_custom_onion_message + * # Invariants + * The description can be at most 639 __bytes__ long */ -typedef enum LDKSendError_Tag { - /** - * Errored computing onion message packet keys. - */ - LDKSendError_Secp256k1, +typedef struct MUST_USE_STRUCT LDKDescription { /** - * Because implementations such as Eclair will drop onion messages where the message packet - * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKSendError_TooBigPacket, + LDKnativeDescription *inner; /** - * The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two - * blinded hops. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKSendError_TooFewBlindedHops, + bool is_owned; +} LDKDescription; + +/** + * The contents of CResult_DescriptionCreationErrorZ + */ +typedef union LDKCResult_DescriptionCreationErrorZPtr { /** - * Our next-hop peer was offline or does not support onion message forwarding. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKSendError_InvalidFirstHop, + struct LDKDescription *result; /** - * Onion message contents must have a TLV type >= 64. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKSendError_InvalidMessage, + enum LDKCreationError *err; +} LDKCResult_DescriptionCreationErrorZPtr; + +/** + * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_DescriptionCreationErrorZ { /** - * Our next-hop peer's buffer was full or our total outbound buffer was full. + * The contents of this CResult_DescriptionCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKSendError_BufferFull, + union LDKCResult_DescriptionCreationErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_DescriptionCreationErrorZ represents a success state. */ - LDKSendError_Sentinel, -} LDKSendError_Tag; - -typedef struct MUST_USE_STRUCT LDKSendError { - LDKSendError_Tag tag; - union { - struct { - enum LDKSecp256k1Error secp256k1; - }; - }; -} LDKSendError; + bool result_ok; +} LDKCResult_DescriptionCreationErrorZ; /** - * The contents of CResult_NoneSendErrorZ + * The contents of CResult_PrivateRouteCreationErrorZ */ -typedef union LDKCResult_NoneSendErrorZPtr { +typedef union LDKCResult_PrivateRouteCreationErrorZPtr { /** - * 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 LDKPrivateRoute *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; + enum LDKCreationError *err; +} LDKCResult_PrivateRouteCreationErrorZPtr; /** - * 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_PrivateRouteCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneSendErrorZ { +typedef struct LDKCResult_PrivateRouteCreationErrorZ { /** - * The contents of this CResult_NoneSendErrorZ, accessible via either + * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneSendErrorZPtr contents; + union LDKCResult_PrivateRouteCreationErrorZPtr contents; /** - * Whether this CResult_NoneSendErrorZ represents a success state. + * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneSendErrorZ; +} LDKCResult_PrivateRouteCreationErrorZ; /** * All-encompassing standard error type that processing can return @@ -10252,7 +11272,9 @@ typedef struct LDKCResult_NetAddressDecodeErrorZ { /** - * An update_add_htlc message to be sent or received from a peer + * An [`update_add_htlc`] message to be sent to or received from a peer. + * + * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc */ typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { /** @@ -10288,7 +11310,9 @@ typedef struct LDKCVec_UpdateAddHTLCZ { /** - * An update_fulfill_htlc message to be sent or received from a peer + * An [`update_fulfill_htlc`] message to be sent to or received from a peer. + * + * [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC { /** @@ -10324,7 +11348,9 @@ typedef struct LDKCVec_UpdateFulfillHTLCZ { /** - * An update_fail_htlc message to be sent or received from a peer + * An [`update_fail_htlc`] message to be sent to or received from a peer. + * + * [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC { /** @@ -10360,7 +11386,9 @@ typedef struct LDKCVec_UpdateFailHTLCZ { /** - * An update_fail_malformed_htlc message to be sent or received from a peer + * An [`update_fail_malformed_htlc`] message to be sent to or received from a peer. + * + * [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc */ typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC { /** @@ -10529,6 +11557,7 @@ typedef struct LDKCResult_ClosingSignedDecodeErrorZ { /** * The minimum and maximum fees which the sender is willing to place on the closing transaction. + * * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing * to use. */ @@ -10583,7 +11612,9 @@ typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ { /** - * A commitment_signed message to be sent or received from a peer + * A [`commitment_signed`] message to be sent to or received from a peer. + * + * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed */ typedef struct MUST_USE_STRUCT LDKCommitmentSigned { /** @@ -10735,7 +11766,9 @@ typedef struct LDKCResult_ChannelReadyDecodeErrorZ { /** - * An init message to be sent or received from a peer + * An [`init`] message to be sent to or received from a peer. + * + * [`init`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-init-message */ typedef struct MUST_USE_STRUCT LDKInit { /** @@ -10953,7 +11986,9 @@ typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ { /** - * An update_fee message to be sent or received from a peer + * An [`update_fee`] message to be sent to or received from a peer + * + * [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee */ typedef struct MUST_USE_STRUCT LDKUpdateFee { /** @@ -11072,7 +12107,8 @@ typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ { /** - * An onion message to be sent or received from a peer + * An onion message to be sent to or received from a peer. + * */ typedef struct MUST_USE_STRUCT LDKOnionMessage { /** @@ -11125,7 +12161,9 @@ typedef struct LDKCResult_OnionMessageDecodeErrorZ { /** - * A ping message to be sent or received from a peer + * A [`ping`] message to be sent to or received from a peer. + * + * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages */ typedef struct MUST_USE_STRUCT LDKPing { /** @@ -11178,7 +12216,9 @@ typedef struct LDKCResult_PingDecodeErrorZ { /** - * A pong message to be sent or received from a peer + * A [`pong`] message to be sent to or received from a peer. + * + * [`pong`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages */ typedef struct MUST_USE_STRUCT LDKPong { /** @@ -11294,26 +12334,6 @@ typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ { bool result_ok; } LDKCResult_ChannelAnnouncementDecodeErrorZ; - - -/** - * The unsigned part of a channel_update - */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedChannelUpdate *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; -} LDKUnsignedChannelUpdate; - /** * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ */ @@ -11446,26 +12466,6 @@ typedef struct LDKCResult_WarningMessageDecodeErrorZ { bool result_ok; } LDKCResult_WarningMessageDecodeErrorZ; - - -/** - * The unsigned part of a node_announcement - */ -typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnsignedNodeAnnouncement *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; -} LDKUnsignedNodeAnnouncement; - /** * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ */ @@ -11499,26 +12499,6 @@ typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ { bool result_ok; } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; - - -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNodeAnnouncement *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; -} LDKNodeAnnouncement; - /** * The contents of CResult_NodeAnnouncementDecodeErrorZ */ @@ -11588,10 +12568,12 @@ typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ { /** - * A reply_short_channel_ids_end message is sent as a reply to a - * query_short_channel_ids message. The query recipient makes a best + * A [`reply_short_channel_ids_end`] message is sent as a reply to a + * message. The query recipient makes a best * effort to respond based on their local network view which may not be * a perfect view of the network. + * + * [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages */ typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd { /** @@ -11994,6 +12976,72 @@ typedef struct LDKCVec_OutPointZ { uintptr_t datalen; } LDKCVec_OutPointZ; + + +/** + * An opaque identifier describing a specific [`Persist`] method call. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdateId *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMonitorUpdateId; + +/** + * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_MonitorUpdateIdZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKMonitorUpdateId *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_MonitorUpdateIdZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ { + /** + * The element at position 0 + */ + struct LDKOutPoint a; + /** + * The element at position 1 + */ + struct LDKCVec_MonitorUpdateIdZ b; +} LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; + /** * A trait indicating an object may generate message send events */ @@ -12039,6 +13087,10 @@ typedef struct LDKOnionMessageProvider { /** * 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 { /** @@ -12051,7 +13103,7 @@ typedef struct LDKEventHandler { * * See [`EventsProvider`] for details that must be considered when implementing this method. */ - void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event); + 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. @@ -12064,6 +13116,10 @@ typedef struct LDKEventHandler { * * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. * + * Implementations of this trait may also feature an async version of event handling, as shown with + * [`ChannelManager::process_pending_events_async`] and + * [`ChainMonitor::process_pending_events_async`]. + * * # Requirements * * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending @@ -12090,6 +13146,8 @@ typedef struct LDKEventHandler { * [`handle_event`]: EventHandler::handle_event * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async + * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async */ typedef struct LDKEventsProvider { /** @@ -12113,7 +13171,7 @@ typedef struct LDKEventsProvider { /** - * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's + * Lightning TLV uses a custom variable-length integer called `BigSize`. It is similar to Bitcoin's * variable-length integers except that it is serialized in big-endian instead of little-endian. * * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be @@ -12164,6 +13222,27 @@ typedef struct LDKPersister { void (*free)(void *this_arg); } LDKPersister; + + +/** + * A string that displays only printable characters, replacing control characters with + * [`core::char::REPLACEMENT_CHARACTER`]. + */ +typedef struct MUST_USE_STRUCT LDKPrintableString { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePrintableString *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; +} LDKPrintableString; + /** * A callback which is called when a [`Future`] completes. * @@ -12240,7 +13319,7 @@ typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { * * These limits are only applied to our counterparty's limits, not our own. * - * Use 0/::max_value() as appropriate to skip checking. + * Use 0/`::max_value()` as appropriate to skip checking. * * Provides sane defaults for most configurations. * @@ -12346,31 +13425,35 @@ typedef struct LDKListen { } LDKListen; /** - * The `Confirm` trait is used to notify when transactions have been confirmed on chain or - * unconfirmed during a chain reorganization. + * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on + * chain or unconfirmed during a chain reorganization. * * Clients sourcing chain data using a transaction-oriented API should prefer this interface over - * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity - * related to registered transactions and outputs. Upon notification, it would pass along the - * matching transactions using this interface. + * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement + * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for + * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes + * with reference to the confirmation status of the monitored objects. * * # Use - * * The intended use is as follows: - * - Call [`transactions_confirmed`] to process any on-chain activity of interest. - * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`] - * that has been reorganized out of the chain. - * - Call [`best_block_updated`] whenever a new chain tip becomes available. + * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or + * outputs are, respectively, confirmed or spent on chain. + * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by + * [`get_relevant_txids`] is no longer confirmed in the block with the given block hash. + * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available. * * # Order * * Clients must call these methods in chain order. Specifically: - * - Transactions confirmed in a block must be given before transactions confirmed in a later - * block. + * - Transactions which are confirmed in a particular block must be given before transactions + * confirmed in a later block. * - Dependent transactions within the same block must be given in topological order, possibly in * separate calls. - * - Unconfirmed transactions must be given after the original confirmations and before any - * reconfirmation. + * - All unconfirmed transactions must be given after the original confirmations and before *any* + * reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should + * never be interleaved, but always conduced *en bloc*. + * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed + * in regard to the new block. * * See individual method documentation for further details. * @@ -12386,9 +13469,9 @@ typedef struct LDKConfirm { */ void *this_arg; /** - * Processes transactions confirmed in a block with a given header and height. + * Notifies LDK of transactions confirmed in a block with a given header and height. * - * Should be called for any transactions registered by [`Filter::register_tx`] or any + * Must be called for any transactions registered by [`Filter::register_tx`] or any * transactions spending an output registered by [`Filter::register_output`]. Such transactions * appearing in the same block do not need to be included in the same call; instead, multiple * calls with additional transactions may be made so long as they are made in [chain order]. @@ -12402,10 +13485,11 @@ typedef struct LDKConfirm { */ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** - * Processes a transaction that is no longer confirmed as result of a chain reorganization. + * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. * - * Should be called for any transaction returned by [`get_relevant_txids`] if it has been - * reorganized out of the best chain. Once called, the given transaction will not be returned + * Must be called for any transaction returned by [`get_relevant_txids`] if it has been + * reorganized out of the best chain or if it is no longer confirmed in the block with the + * given block hash. Once called, the given transaction will not be returned * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`]. * * [`get_relevant_txids`]: Self::get_relevant_txids @@ -12413,28 +13497,36 @@ typedef struct LDKConfirm { */ void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]); /** - * Processes an update to the best header connected at the given height. + * Notifies LDK of an update to the best header connected at the given height. * - * Should be called when a new header is available but may be skipped for intermediary blocks - * if they become available at the same time. + * Must be called whenever a new chain tip becomes available. May be skipped for intermediary + * blocks. */ void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); /** - * Returns transactions that should be monitored for reorganization out of the chain. + * 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. + * + * 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. * * Will include any transactions passed to [`transactions_confirmed`] that have insufficient * confirmations to be safe from a chain reorganization. Will not include any transactions * passed to [`transaction_unconfirmed`], unless later reconfirmed. * - * May be called to determine the subset of transactions that must still be monitored for + * Must be called to determine the subset of transactions that must be monitored for * reorganization. Will be idempotent between calls but may change as a result of calls to the - * other interface methods. Thus, this is useful to determine which transactions may need to be + * other interface methods. Thus, this is useful to determine which transactions must be * 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. + * * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg); + struct LDKCVec_C2Tuple_TxidBlockHashZZ (*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. @@ -12442,26 +13534,6 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; - - -/** - * An opaque identifier describing a specific [`Persist`] method call. - */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMonitorUpdateId *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKMonitorUpdateId; - /** * `Persist` defines behavior for persisting channel monitors: this could mean * writing once to disk, and/or uploading to one or more backup services. @@ -12545,7 +13617,7 @@ typedef struct LDKPersist { * * 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, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); + 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. @@ -12581,15 +13653,25 @@ typedef struct MUST_USE_STRUCT LDKChainMonitor { bool is_owned; } LDKChainMonitor; +/** + * Represents a valid secp256k1 secret key serialized as a 32 byte array. + */ +typedef struct LDKSecretKey { + /** + * The bytes of the secret key + */ + uint8_t bytes[32]; +} LDKSecretKey; + /** - * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key - * and derives keys from that. + * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a + * 32-byte seed for use as a BIP 32 extended key and derives keys from that. * - * Your node_id is seed/0' - * ChannelMonitor closes may use seed/1' - * Cooperative closes may use seed/2' + * Your `node_id` is seed/0'. + * Unilateral closes may use seed/1'. + * Cooperative closes may use seed/2'. * The two close keys may be needed to claim on-chain funds! * * This struct cannot be used for nodes that wish to support receiving phantom payments; @@ -12671,11 +13753,48 @@ 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`]. + */ + 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 to describe an object which can receive channel messages. * - * Messages MAY be called in parallel when they originate from different their_node_ids, however - * they MUST NOT be called in parallel when the two calls have the same their_node_id. + * Messages MAY be called in parallel when they originate from different `their_node_ids`, however + * they MUST NOT be called in parallel when the two calls have the same `their_node_id`. */ typedef struct LDKChannelMessageHandler { /** @@ -12684,93 +13803,87 @@ typedef struct LDKChannelMessageHandler { */ void *this_arg; /** - * Handle an incoming open_channel message from the given peer. + * Handle an incoming `open_channel` message from the given peer. */ - void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg); + void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); /** - * Handle an incoming accept_channel message from the given peer. + * Handle an incoming `accept_channel` message from the given peer. */ - void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg); + void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); /** - * Handle an incoming funding_created message from the given peer. + * Handle an incoming `funding_created` message from the given peer. */ void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); /** - * Handle an incoming funding_signed message from the given peer. + * Handle an incoming `funding_signed` message from the given peer. */ void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); /** - * Handle an incoming channel_ready message from the given peer. + * Handle an incoming `channel_ready` message from the given peer. */ void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); /** - * Handle an incoming shutdown message from the given peer. + * Handle an incoming `shutdown` message from the given peer. */ - void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg); + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); /** - * Handle an incoming closing_signed message from the given peer. + * 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 update_add_htlc message from the given peer. + * Handle an incoming `update_add_htlc` message from the given peer. */ void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); /** - * Handle an incoming update_fulfill_htlc message from the given peer. + * Handle an incoming `update_fulfill_htlc` message from the given peer. */ void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); /** - * Handle an incoming update_fail_htlc message from the given peer. + * Handle an incoming `update_fail_htlc` message from the given peer. */ void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); /** - * Handle an incoming update_fail_malformed_htlc message from the given peer. + * Handle an incoming `update_fail_malformed_htlc` message from the given peer. */ void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); /** - * Handle an incoming commitment_signed message from the given peer. + * Handle an incoming `commitment_signed` message from the given peer. */ void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); /** - * Handle an incoming revoke_and_ack message from the given peer. + * Handle an incoming `revoke_and_ack` message from the given peer. */ void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); /** - * Handle an incoming update_fee message from the given peer. + * Handle an incoming `update_fee` message from the given peer. */ void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); /** - * Handle an incoming announcement_signatures message from the given peer. + * Handle an incoming `announcement_signatures` message from the given peer. */ void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); /** - * Indicates a connection to the peer failed/an existing connection was lost. If no connection - * is believed to be possible in the future (eg they're sending us messages we don't - * understand or indicate they require unknown feature bits), no_connection_possible is set - * and any outstanding channels should be failed. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. + * Indicates a connection to the peer failed/an existing connection was lost. */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible); + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); /** - * Handle a peer reconnecting, possibly generating channel_reestablish message(s). + * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). * * May return an `Err(())` if the features the peer supports are not sufficient to communicate * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg); + struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); /** - * Handle an incoming channel_reestablish message from the given peer. + * Handle an incoming `channel_reestablish` message from the given peer. */ void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg); /** - * Handle an incoming channel update from the given peer. + * Handle an incoming `channel_update` message from the given peer. */ void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Handle an incoming error message from the given peer. + * Handle an incoming `error` message from the given peer. */ void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); /** @@ -12853,9 +13966,9 @@ typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** * A set of keys that were HKDF-expanded from an initial call to - * [`KeysInterface::get_inbound_payment_key_material`]. + * [`NodeSigner::get_inbound_payment_key_material`]. * - * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material + * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material */ typedef struct MUST_USE_STRUCT LDKExpandedKey { /** @@ -12876,8 +13989,9 @@ typedef struct MUST_USE_STRUCT LDKExpandedKey { /** * Proof that the sender knows the per-commitment secret of the previous commitment transaction. + * * This is used to convince the recipient that the channel is at a certain commitment - * number even if they lost that data due to a local failure. Of course, the peer may lie + * number even if they lost that data due to a local failure. Of course, the peer may lie * and even later commitments may have been revoked. */ typedef struct MUST_USE_STRUCT LDKDataLossProtect { @@ -12910,8 +14024,8 @@ typedef struct LDKThreeBytes { * * # Implementor DoS Warnings * - * For `gossip_queries` messages there are potential DoS vectors when handling - * inbound queries. Implementors using an on-disk network graph should be aware of + * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when + * handling inbound queries. Implementors using an on-disk network graph should be aware of * repeated disk I/O for queries accessing different parts of the network graph. */ typedef struct LDKRoutingMessageHandler { @@ -12921,36 +14035,36 @@ typedef struct LDKRoutingMessageHandler { */ void *this_arg; /** - * Handle an incoming node_announcement message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Handle a channel_announcement message, returning true if it should be forwarded on, false - * or returning an Err otherwise. + * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` + * or returning an `Err` otherwise. */ struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** - * Handle an incoming channel_update message, returning true if it should be forwarded on, - * false or returning an Err otherwise. + * Handle an incoming `channel_update` message, returning true if it should be forwarded on, + * `false` or returning an `Err` otherwise. */ struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * Gets channel announcements and updates required to dump our routing table to a remote node, - * starting at the short_channel_id indicated by starting_point and including announcements + * starting at the `short_channel_id` indicated by `starting_point` and including announcements * for a single channel. */ struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point); /** * Gets a node announcement required to dump our routing table to a remote node, starting at * the node *after* the provided pubkey and including up to one announcement immediately - * higher (as defined by ::cmp) than starting_point. - * If None is provided for starting_point, we start at the first node. + * higher (as defined by `::cmp`) than `starting_point`. + * If `None` is provided for `starting_point`, we start at the first node. * * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKPublicKey starting_point); + struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point); /** * Called when a connection is established with a peer. This can be used to * perform routing table synchronization using a strategy defined by the @@ -12960,7 +14074,7 @@ typedef struct LDKRoutingMessageHandler { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); + struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); /** * Handles the reply of a query we initiated to learn about channels * for a given range of blocks. We can expect to receive one or more @@ -12975,15 +14089,22 @@ typedef struct LDKRoutingMessageHandler { */ struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg); /** - * Handles when a peer asks us to send a list of short_channel_ids + * Handles when a peer asks us to send a list of `short_channel_id`s * for the requested range of blocks. */ struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg); /** * Handles when a peer asks us to send routing gossip messages for a - * list of short_channel_ids. + * list of `short_channel_id`s. */ struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); + /** + * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages + * pending some async action. While there is no guarantee of the rate of future messages, the + * caller should seek to reduce the rate of new gossip messages handled, especially + * [`ChannelAnnouncement`]s. + */ + bool (*processing_queue_high)(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`] @@ -13019,7 +14140,7 @@ typedef struct LDKOnionMessageHandler { */ void *this_arg; /** - * Handle an incoming onion_message message from the given peer. + * 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); /** @@ -13030,15 +14151,12 @@ typedef struct LDKOnionMessageHandler { * with us. Implementors should be somewhat conservative about doing so, however, as other * message handlers may still wish to communicate with this peer. */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); + struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); /** * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to * drop and refuse to forward onion messages to this peer. - * - * Note that in some rare cases this may be called without a corresponding - * [`Self::peer_connected`]. */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible); + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); /** * 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`] @@ -13089,7 +14207,14 @@ typedef struct LDKCustomMessageReader { } LDKCustomMessageReader; /** - * Handler for BOLT1-compliant messages. + * A handler provided to [`PeerManager`] for reading and handling custom messages. + * + * [BOLT 1] specifies a custom message type range for use with experimental or application-specific + * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the + * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler. + * + * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md + * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message */ typedef struct LDKCustomMessageHandler { /** @@ -13098,15 +14223,15 @@ typedef struct LDKCustomMessageHandler { */ void *this_arg; /** - * Called with the message type that was received and the buffer to be read. - * Can return a `MessageHandlingError` if the message could not be handled. + * Handles the given message sent from `sender_node_id`, possibly producing messages for + * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`] + * to send. */ struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id); /** - * Gets the list of pending messages which were generated by the custom message - * handler, clearing the list in the process. The first tuple element must - * correspond to the intended recipients node ids. If no connection to one of the - * specified node does not exist, the message is simply not sent to it. + * Returns the list of pending messages that were generated by the handler, clearing the list + * in the process. Each message is paired with the node id of the intended recipient. If no + * connection to the node exists, then the message is simply not sent. */ struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg); /** @@ -13347,32 +14472,72 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { bool is_owned; } LDKDirectedChannelTransactionParameters; + + /** - * Integer in the range `0..=16` + * Features used within an `offer`. */ -typedef struct LDKWitnessVersion { - uint8_t _0; -} LDKWitnessVersion; +typedef struct MUST_USE_STRUCT LDKOfferFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOfferFeatures *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; +} LDKOfferFeatures; /** - * A read-only view of [`NetworkGraph`]. + * Features used within an `invoice_request`. */ -typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeReadOnlyNetworkGraph *inner; + LDKnativeInvoiceRequestFeatures *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; -} LDKReadOnlyNetworkGraph; +} LDKInvoiceRequestFeatures; + + + +/** + * Features used within an `invoice`. + */ +typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12InvoiceFeatures *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; +} LDKBolt12InvoiceFeatures; + +/** + * Integer in the range `0..=16` + */ +typedef struct LDKWitnessVersion { + uint8_t _0; +} LDKWitnessVersion; @@ -13382,9 +14547,6 @@ typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { * This network graph is then used for routing payments. * Provides interface to help with initial routing sync by * serving historical announcements. - * - * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the - * [`NetworkGraph`]. */ typedef struct MUST_USE_STRUCT LDKP2PGossipSync { /** @@ -13403,6 +14565,26 @@ typedef struct MUST_USE_STRUCT LDKP2PGossipSync { +/** + * A read-only view of [`NetworkGraph`]. + */ +typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeReadOnlyNetworkGraph *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKReadOnlyNetworkGraph; + + + /** * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a * source node to a target node. @@ -13481,7 +14663,7 @@ typedef struct LDKEffectiveCapacity_LDKTotal_Body { /** * The maximum HTLC amount denominated in millisatoshi. */ - struct LDKCOption_u64Z htlc_maximum_msat; + uint64_t htlc_maximum_msat; } LDKEffectiveCapacity_LDKTotal_Body; typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { @@ -13495,6 +14677,51 @@ typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { +/** + * A [`Router`] implemented using [`find_route`]. + */ +typedef struct MUST_USE_STRUCT LDKDefaultRouter { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDefaultRouter *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDefaultRouter; + + + +/** + * [`Score`] implementation that factors in in-flight HTLC liquidity. + * + * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling + * [`find_route`]. + * + * [`Score`]: crate::routing::scoring::Score + */ +typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeScorerAccountingForInFlightHtlcs *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; +} LDKScorerAccountingForInFlightHtlcs; + + + /** * A concrete implementation of [`LockableScore`] which supports multi-threading. */ @@ -13572,17 +14799,16 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * # extern crate bitcoin; * # use bitcoin::hashes::_export::_core::time::Duration; * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; - * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface}; - * # use lightning::ln::msgs::DecodeError; + * # use lightning::chain::keysinterface::KeysManager; * # use lightning::ln::peer_handler::IgnoringMessageHandler; + * # use lightning::onion_message::blinded_path::BlindedPath; * # use lightning::onion_message::messenger::{Destination, OnionMessenger}; - * # use lightning::onion_message::packet::CustomOnionMessageContents; - * # use lightning::onion_message::blinded_route::BlindedRoute; + * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents}; * # use lightning::util::logger::{Logger, Record}; * # use lightning::util::ser::{Writeable, Writer}; * # use lightning::io; * # use std::sync::Arc; - * # struct FakeLogger {}; + * # struct FakeLogger; * # impl Logger for FakeLogger { * # fn log(&self, record: &Record) { unimplemented!() } * # } @@ -13598,7 +14824,7 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * # let your_custom_message_handler = IgnoringMessageHandler {}; * // Create the onion messenger. This must use the same `keys_manager` as is passed to your * // ChannelManager. - * let onion_messenger = OnionMessenger::new(&keys_manager, logger, your_custom_message_handler); + * let onion_messenger = OnionMessenger::new(&keys_manager, &keys_manager, logger, &your_custom_message_handler); * * # struct YourCustomMessage {} * impl Writeable for YourCustomMessage { @@ -13617,18 +14843,20 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * let intermediate_hops = [hop_node_id1, hop_node_id2]; * let reply_path = None; * # let your_custom_message = YourCustomMessage {}; - * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::Node(destination_node_id), your_custom_message, reply_path); + * let message = OnionMessageContents::Custom(your_custom_message); + * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), message, reply_path); * - * // Create a blinded route to yourself, for someone to send an onion message to. + * // Create a blinded path to yourself, for someone to send an onion message to. * # let your_node_id = hop_node_id1; * let hops = [hop_node_id3, hop_node_id4, your_node_id]; - * let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap(); + * let blinded_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap(); * - * // Send a custom onion message to a blinded route. + * // Send a custom onion message to a blinded path. * # let intermediate_hops = [hop_node_id1, hop_node_id2]; * let reply_path = None; * # let your_custom_message = YourCustomMessage {}; - * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), your_custom_message, reply_path); + * let message = OnionMessageContents::Custom(your_custom_message); + * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath(blinded_path), message, reply_path); * ``` * * [offers]: @@ -13658,9 +14886,9 @@ typedef enum LDKDestination_Tag { */ LDKDestination_Node, /** - * We're sending this onion message to a blinded route. + * We're sending this onion message to a blinded path. */ - LDKDestination_BlindedRoute, + LDKDestination_BlindedPath, /** * Must be last for serialization purposes */ @@ -13674,11 +14902,35 @@ typedef struct MUST_USE_STRUCT LDKDestination { struct LDKPublicKey node; }; struct { - struct LDKBlindedRoute blinded_route; + struct LDKBlindedPath blinded_path; }; }; } LDKDestination; +/** + * 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 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 LDKCustomOnionMessageContents custom; + }; + }; +} LDKOnionMessageContents; + /** @@ -13882,22 +15134,22 @@ typedef struct MUST_USE_STRUCT LDKExpiryTime { /** - * `min_final_cltv_expiry` to use for the last HTLC in the route + * `min_final_cltv_expiry_delta` to use for the last HTLC in the route */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { +typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMinFinalCltvExpiry *inner; + LDKnativeMinFinalCltvExpiryDelta *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMinFinalCltvExpiry; +} LDKMinFinalCltvExpiryDelta; /** * A 20-byte byte array. @@ -13923,7 +15175,7 @@ typedef enum LDKFallback_Tag { } LDKFallback_Tag; typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKu5 version; + struct LDKU5 version; struct LDKCVec_u8Z program; } LDKFallback_LDKSegWitProgram_Body; @@ -13935,169 +15187,10 @@ typedef struct MUST_USE_STRUCT LDKFallback { struct LDKTwentyBytes pub_key_hash; }; struct { - struct LDKTwentyBytes script_hash; - }; - }; -} LDKFallback; - -/** - * A trait defining behavior of an [`Invoice`] payer. - */ -typedef struct LDKPayer { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Returns the payer's node id. - */ - struct LDKPublicKey (*node_id)(const void *this_arg); - /** - * Returns the payer's channels. - */ - struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg); - /** - * Sends a payment over the Lightning Network using the given [`Route`]. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); - /** - * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. - */ - struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); - /** - * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. - */ - struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); - /** - * Signals that no further retries for the given payment will occur. - */ - void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKPayer; - -/** - * A trait defining behavior for routing an [`Invoice`] payment. - */ -typedef struct LDKRouter { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); - /** - * Lets the router know that payment through a specific path has failed. - */ - void (*notify_payment_path_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); - /** - * Lets the router know that payment through a specific path was successful. - */ - void (*notify_payment_path_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path); - /** - * Lets the router know that a payment probe was successful. - */ - void (*notify_payment_probe_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path); - /** - * Lets the router know that a payment probe failed. - */ - void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKRouter; - - - -/** - * A utility for paying [`Invoice`]s and sending spontaneous payments. - * - * See [module-level documentation] for details. - * - * [module-level documentation]: crate::payment - */ -typedef struct MUST_USE_STRUCT LDKInvoicePayer { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoicePayer *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInvoicePayer; - -/** - * Strategies available to retry payment path failures for an [`Invoice`]. - * - */ -typedef enum LDKRetry_Tag { - /** - * Max number of attempts to retry payment. - * - * Note that this is the number of *path* failures, not full payment retries. For multi-path - * payments, if this is less than the total number of paths, we will never even retry all of the - * payment's paths. - */ - LDKRetry_Attempts, - /** - * Time elapsed before abandoning retries for a payment. - */ - 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 [`Router`] implemented using [`find_route`]. - */ -typedef struct MUST_USE_STRUCT LDKDefaultRouter { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeDefaultRouter *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKDefaultRouter; + struct LDKTwentyBytes script_hash; + }; + }; +} LDKFallback; extern const uintptr_t MAX_BUF_SIZE; @@ -14113,7 +15206,15 @@ extern const uint16_t BREAKDOWN_TIMEOUT; extern const uint16_t MIN_CLTV_EXPIRY_DELTA; -extern const uint32_t MIN_FINAL_CLTV_EXPIRY; +extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uint16_t MAX_HTLCS; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; + +extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; @@ -14127,7 +15228,7 @@ extern const uint64_t MAX_TIMESTAMP; extern const uint64_t DEFAULT_EXPIRY_TIME; -extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; +extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA; extern const uint8_t TAG_PAYMENT_HASH; @@ -14139,7 +15240,7 @@ extern const uint8_t TAG_DESCRIPTION_HASH; extern const uint8_t TAG_EXPIRY_TIME; -extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; +extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA; extern const uint8_t TAG_FALLBACK; @@ -14153,6 +15254,16 @@ struct LDKStr _ldk_get_compiled_version(void); struct LDKStr _ldk_c_bindings_get_compiled_version(void); +/** + * Gets the 128-bit integer, as 16 little-endian bytes + */ +struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); + +/** + * Constructs a new U128 from 16 little-endian bytes + */ +struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); + /** * Convenience function for constructing a new BigEndianScalar */ @@ -14173,6 +15284,11 @@ void Bech32Error_free(struct LDKBech32Error o); */ void Transaction_free(struct LDKTransaction _res); +/** + * Frees the data pointed to by data + */ +void Witness_free(struct LDKWitness _res); + /** * Convenience function for constructing a new TxOut */ @@ -14202,69 +15318,55 @@ const void *__unmangle_inner_ptr(const void *ptr); #endif /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); - -/** - * Creates a new CResult_BlindedRouteNoneZ in the success state. + * Creates a new CResult_NoneAPIErrorZ in the success state. */ -struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_ok(struct LDKBlindedRoute o); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); /** - * Creates a new CResult_BlindedRouteNoneZ in the error state. + * Creates a new CResult_NoneAPIErrorZ in the error state. */ -struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_err(void); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedRouteNoneZ_is_ok(const struct LDKCResult_BlindedRouteNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_BlindedRouteNoneZ. - */ -void CResult_BlindedRouteNoneZ_free(struct LDKCResult_BlindedRouteNoneZ _res); - -/** - * Creates a new CResult_BlindedRouteDecodeErrorZ in the success state. - */ -struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_ok(struct LDKBlindedRoute o); +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_BlindedRouteDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NoneAPIErrorZ. */ -struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_BlindedRouteDecodeErrorZ_is_ok(const struct LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_BlindedRouteDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_BlindedRouteDecodeErrorZ_free(struct LDKCResult_BlindedRouteDecodeErrorZ _res); +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCClaimZ containing nothing */ -bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); /** - * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state */ -void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); +void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); /** * Creates a new CResult_NoneNoneZ in the success state. @@ -14318,58 +15420,6 @@ void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_Co */ struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_SecretKeyErrorZ in the success state. - */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); - -/** - * Creates a new CResult_SecretKeyErrorZ in the error state. - */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SecretKeyErrorZ. - */ -void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); - -/** - * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PublicKeyErrorZ in the success state. - */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); - -/** - * Creates a new CResult_PublicKeyErrorZ in the error state. - */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PublicKeyErrorZ. - */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); - -/** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. */ @@ -14422,32 +15472,6 @@ void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicK */ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_TxCreationKeysErrorZ in the success state. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); - -/** - * Creates a new CResult_TxCreationKeysErrorZ in the error state. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_TxCreationKeysErrorZ. - */ -void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); - -/** - * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); - /** * Constructs a new COption_u32Z containing a u32 */ @@ -14709,100 +15733,266 @@ void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _r * Creates a new CResult_CVec_SignatureZNoneZ 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_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + */ +void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + */ +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +/** + * Creates a new CResult_BlindedPathNoneZ in the success state. + */ +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o); + +/** + * Creates a new CResult_BlindedPathNoneZ in the error state. + */ +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedPathNoneZ. + */ +void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); + +/** + * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o); + +/** + * Creates a new CResult_BlindedPathDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedPathDecodeErrorZ. + */ +void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); + +/** + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + */ +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + */ +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); + +/** + * Constructs a new COption_WriteableScoreZ containing nothing + */ +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + */ +void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); + +/** + * Creates a new CResult_NoneErrorZ in the success state. + */ +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); + +/** + * Creates a new CResult_NoneErrorZ in the error state. + */ +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Frees any resources used by the CResult_NoneErrorZ. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Creates a new CResult_RouteLightningErrorZ in the success state. */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RouteLightningErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Frees any resources used by the CResult_RouteLightningErrorZ. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_u64Z containing a u64 */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); /** - * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + * Constructs a new COption_u64Z containing nothing */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +struct LDKCOption_u64Z COption_u64Z_none(void); /** - * Constructs a new COption_WriteableScoreZ containing nothing + * Frees any resources associated with the u64, if we are in the Some state */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); +void COption_u64Z_free(struct LDKCOption_u64Z _res); /** - * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + * Creates a new COption_u64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError 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_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * Creates a new CResult_InFlightHtlcsDecodeErrorZ 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_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_RouteHopDecodeErrorZ in the success state. @@ -14830,11 +16020,6 @@ void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _r */ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -14897,27 +16082,6 @@ struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeError */ void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); -/** - * Constructs a new COption_u64Z containing a u64 - */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); - -/** - * Constructs a new COption_u64Z containing nothing - */ -struct LDKCOption_u64Z COption_u64Z_none(void); - -/** - * Frees any resources associated with the u64, if we are in the Some state - */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); - -/** - * Creates a new COption_u64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -15007,61 +16171,98 @@ 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. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. */ -bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); +void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + */ +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); + +/** + * Constructs a new COption_NetworkUpdateZ containing nothing + */ +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + */ +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); + +/** + * Creates a new COption_NetworkUpdateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. + * Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); +struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. + * Constructs a new COption_PathFailureZ containing nothing */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::events::PathFailure, if we are in the Some state + */ +void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); + +/** + * Creates a new COption_PathFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); + +/** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. + * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. */ -void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); +void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); /** * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason @@ -15158,25 +16359,25 @@ void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + * Constructs a new COption_u128Z containing a crate::c_types::U128 */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Constructs a new COption_u128Z containing nothing */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +struct LDKCOption_u128Z COption_u128Z_none(void); /** - * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + * Frees any resources associated with the crate::c_types::U128, if we are in the Some state */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +void COption_u128Z_free(struct LDKCOption_u128Z _res); /** - * Creates a new COption_NetworkUpdateZ 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_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); +struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -15236,56 +16437,46 @@ struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Creates a new CResult_TxOutAccessErrorZ in the success state. - */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); - -/** - * Creates a new CResult_TxOutAccessErrorZ 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_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_usizeTransactionZ from the contained elements. */ -bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); /** - * Frees any resources used by the CResult_TxOutAccessErrorZ. + * Frees any resources used by the C2Tuple_usizeTransactionZ. */ -void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); /** - * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_usizeTransactionZ from the contained elements. - */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_usizeTransactionZ. + * Creates a new C2Tuple_TxidBlockHashZ from the contained elements. */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the C2Tuple_TxidBlockHashZ. */ -void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); +void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -15376,6 +16567,59 @@ 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); + +/** + * Frees any resources used by the C2Tuple_Z. + */ +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. + */ +struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_clone(const struct LDKC2Tuple__u168_u168Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple__u168_u168Z from the contained elements. + */ +struct LDKC2Tuple__u168_u168Z C2Tuple__u168_u168Z_new(struct LDKEightU16s a, struct LDKEightU16s b); + +/** + * Frees any resources used by the C2Tuple__u168_u168Z. + */ +void C2Tuple__u168_u168Z_free(struct LDKC2Tuple__u168_u168Z _res); + +/** + * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing a crate::c_types::derived::C2Tuple__u168_u168Z + */ +struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_some(struct LDKC2Tuple__u168_u168Z o); + +/** + * Constructs a new COption_C2Tuple_EightU16sEightU16sZZ containing nothing + */ +struct LDKCOption_C2Tuple_EightU16sEightU16sZZ COption_C2Tuple_EightU16sEightU16sZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple__u168_u168Z, if we are in the Some state + */ +void COption_C2Tuple_EightU16sEightU16sZZ_free(struct LDKCOption_C2Tuple_EightU16sEightU16sZZ _res); + +/** + * Creates a new COption_C2Tuple_EightU16sEightU16sZZ 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); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -15471,39 +16715,65 @@ bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeatures /** * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); + +/** + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + */ +void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. */ -void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); +void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. @@ -15584,19 +16854,19 @@ void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_N struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access + * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup */ -struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); /** - * Constructs a new COption_AccessZ containing nothing + * Constructs a new COption_UtxoLookupZ containing nothing */ -struct LDKCOption_AccessZ COption_AccessZ_none(void); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); /** - * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state + * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state */ -void COption_AccessZ_free(struct LDKCOption_AccessZ _res); +void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); /** * Creates a new CResult_boolLightningErrorZ in the success state. @@ -16040,74 +17310,6 @@ void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); */ struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *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_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_SignatureSignatureZ from the contained elements. - */ -struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b); - -/** - * Frees any resources used by the C2Tuple_SignatureSignatureZ. - */ -void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res); - -/** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state. - */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o); - -/** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state. - */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ. - */ -void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res); - -/** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_SecretKeyNoneZ in the success state. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o); - -/** - * Creates a new CResult_SecretKeyNoneZ in the error state. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SecretKeyNoneZ. - */ -void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res); - -/** - * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig); - /** * Creates a new CResult_PublicKeyNoneZ in the success state. */ @@ -16176,61 +17378,55 @@ void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); +void CVec_U5Z_free(struct LDKCVec_U5Z _res); /** - * Creates a new CResult_SignDecodeErrorZ in the error state. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** - * Frees any resources used by the CResult_SignDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_u5Z_free(struct LDKCVec_u5Z _res); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. - */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -16382,118 +17578,139 @@ void COption_u16Z_free(struct LDKCOption_u16Z _res); struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult__u832APIErrorZ in the success state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Creates a new CResult__u832APIErrorZ in the error state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); +bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Frees any resources used by the CResult__u832APIErrorZ. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); /** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * Creates a new CResult__u832APIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); +void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NonePaymentSendFailureZ in the success state. */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); /** - * Creates a new CResult__u832APIErrorZ in the success state. + * Creates a new CResult_NonePaymentSendFailureZ in the error state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Creates a new CResult__u832APIErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NonePaymentSendFailureZ. + */ +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); + +/** + * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NoneRetryableSendFailureZ in the success state. + */ +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); + +/** + * Creates a new CResult_NoneRetryableSendFailureZ in the error state. + */ +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure 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_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult__u832APIErrorZ. + * Frees any resources used by the CResult_NoneRetryableSendFailureZ. */ -void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); +void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); /** - * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * Creates a new CResult_NoneRetryableSendFailureZ 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_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. + * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. */ -void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); +void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); +bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ. */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_PaymentHashRetryableSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` @@ -16853,6 +18070,53 @@ void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecod */ struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); + +/** + * Constructs a new COption_APIErrorZ containing nothing + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state + */ +void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); + +/** + * Creates a new COption_APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. + */ +void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ @@ -16864,785 +18128,864 @@ struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LD struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Checks if the given object is currently in the success state + * Checks if the given object is currently in the success state + */ +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OutPointDecodeErrorZ. + */ +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); + +/** + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + */ +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); + +/** + * Constructs a new COption_TypeZ containing nothing + */ +struct LDKCOption_TypeZ COption_TypeZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + */ +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); + +/** + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); + +/** + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + */ +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); + +/** + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + */ +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + */ +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + */ +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); + +/** + * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NonePaymentErrorZ in the success state. */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Creates a new CResult_NonePaymentErrorZ in the error state. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); +bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + * Frees any resources used by the CResult_NonePaymentErrorZ. */ -struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); +void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); /** - * Constructs a new COption_TypeZ containing nothing + * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TypeZ COption_TypeZ_none(void); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + * Creates a new CResult_StringErrorZ in the success state. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Creates a new CResult_StringErrorZ in the error state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_StringErrorZ. */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Creates a new CResult_StringErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + * Creates a new CResult_PublicKeyErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Creates a new CResult_PublicKeyErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error 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_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_PublicKeyErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * Creates a new CResult_PublicKeyErrorZ 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_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. */ -void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ in the success state. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixParseErrorZ in the error state. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_MonitorEventZ containing nothing */ -bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Frees any resources used by the CResult_SiPrefixParseErrorZ. + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * Creates a new COption_MonitorEventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. */ -void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` + * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); /** - * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. + * Creates a new C2Tuple_OutPointScriptZ from the contained elements. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. + * Frees any resources used by the C2Tuple_OutPointScriptZ. */ -void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); +void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ 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_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new C2Tuple_u32ScriptZ from the contained elements. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_u32ScriptZ. */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +void CVec_EventZ_free(struct LDKCVec_EventZ _res); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` + * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneSemanticErrorZ in the success state. + * Creates a new C2Tuple_u32TxOutZ from the contained elements. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); /** - * Creates a new CResult_NoneSemanticErrorZ in the error state. + * Frees any resources used by the C2Tuple_u32TxOutZ. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); /** - * Frees any resources used by the CResult_NoneSemanticErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the success state. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Frees any resources used by the CResult_InvoiceSemanticErrorZ. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. */ -void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); /** - * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Constructs a new COption_CustomOnionMessageContentsZ containing nothing */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + */ +void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. */ -bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_StringErrorZ in the success state. + * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); /** - * Creates a new CResult_StringErrorZ in the error state. + * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_NetAddressZ containing nothing */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); /** - * Frees any resources used by the CResult_StringErrorZ. + * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); /** - * Creates a new CResult_StringErrorZ which has the same data as `orig` + * Creates a new COption_NetAddressZ 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 LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ 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_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ. */ -bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); /** - * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Constructs a new COption_MonitorEventZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ -void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); /** - * Creates a new COption_MonitorEventZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + * Creates a new CResult_NonePeerHandleErrorZ in the success state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + * Creates a new CResult_NonePeerHandleErrorZ in the error state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + * Frees any resources used by the CResult_NonePeerHandleErrorZ. */ -void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Creates a new CResult_boolPeerHandleErrorZ in the success state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Creates a new CResult_boolPeerHandleErrorZ in the error state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + * Frees any resources used by the CResult_boolPeerHandleErrorZ. */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); /** - * Frees any resources used by the C2Tuple_OutPointScriptZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); +bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Creates a new CResult_NoneSendErrorZ in the success state. */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NoneSendErrorZ in the error state. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Frees any resources used by the CResult_NoneSendErrorZ. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Creates a new CResult_SiPrefixParseErrorZ in the success state. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SiPrefixParseErrorZ in the error state. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_EventZ_free(struct LDKCVec_EventZ _res); +bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_SiPrefixParseErrorZ. */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. - */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); - -/** - * Frees any resources used by the C2Tuple_u32TxOutZ. - */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. */ -void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PublicKeyTypeZ 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_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. */ -void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. */ -void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents + * Creates a new CResult_PayeePubKeyErrorZ in the success state. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing nothing + * Creates a new CResult_PayeePubKeyErrorZ in the error state. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. + * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); +void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. + * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); /** - * Constructs a new COption_NetAddressZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new CResult_PositiveTimestampCreationErrorZ 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 LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Creates a new CResult_NoneSemanticErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Creates a new CResult_NoneSemanticErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Frees any resources used by the CResult_NoneSemanticErrorZ. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a new CResult_InvoiceSemanticErrorZ in the success state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Creates a new CResult_InvoiceSemanticErrorZ in the error state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); +bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError 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_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); + +/** + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_u32GraphSyncErrorZ in the success state. @@ -18665,6 +20008,32 @@ void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonit */ void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. + */ +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b); + +/** + * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. + */ +void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res); + /** * Frees any resources used by the PaymentPurpose */ @@ -18685,6 +20054,12 @@ struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes */ struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +/** + * Checks if two PaymentPurposes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); + /** * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read */ @@ -18695,6 +20070,42 @@ struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_ */ struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +/** + * Frees any resources used by the PathFailure + */ +void PathFailure_free(struct LDKPathFailure this_ptr); + +/** + * Creates a copy of the PathFailure + */ +struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new InitialSend-variant PathFailure + */ +struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); + +/** + * Utility method to constructs a new OnPath-variant PathFailure + */ +struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); + +/** + * Checks if two PathFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); + +/** + * Serialize the PathFailure object into a byte array which can be read by PathFailure_read + */ +struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); + +/** + * Read a PathFailure from a byte array, created by PathFailure_write + */ +struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); + /** * Frees any resources used by the ClosureReason */ @@ -18781,6 +20192,11 @@ struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey n */ struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); +/** + * Utility method to constructs a new InvalidForward-variant HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); + /** * Utility method to constructs a new FailedPayment-variant HTLCDestination */ @@ -18815,17 +20231,17 @@ struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** * Utility method to constructs a new FundingGenerationReady-variant Event */ -struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id); +struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id); /** - * Utility method to constructs a new PaymentReceived-variant Event + * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id); /** * Utility method to constructs a new PaymentClaimed-variant Event */ -struct LDKEvent Event_payment_claimed(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); /** * Utility method to constructs a new PaymentSent-variant Event @@ -18845,7 +20261,7 @@ struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_i /** * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); +struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); /** * Utility method to constructs a new ProbeSuccessful-variant Event @@ -18862,6 +20278,11 @@ struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct L */ struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +/** + * Utility method to constructs a new HTLCIntercepted-variant Event + */ +struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat); + /** * Utility method to constructs a new SpendableOutputs-variant Event */ @@ -18872,10 +20293,15 @@ struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptor */ 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); +/** + * Utility method to constructs a new ChannelReady-variant Event + */ +struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); + /** * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason); +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); /** * Utility method to constructs a new DiscardFunding-variant Event @@ -18892,6 +20318,12 @@ struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_ch */ struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); +/** + * Checks if two Events contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); + /** * Serialize the Event object into a byte array which can be read by Event_read */ @@ -18982,6 +20414,11 @@ struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struc */ struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); +/** + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + */ +struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); + /** * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent */ @@ -19053,9 +20490,9 @@ struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); /** - * Utility method to constructs a new RouteError-variant APIError + * Utility method to constructs a new InvalidRoute-variant APIError */ -struct LDKAPIError APIError_route_error(struct LDKStr err); +struct LDKAPIError APIError_invalid_route(struct LDKStr err); /** * Utility method to constructs a new ChannelUnavailable-variant APIError @@ -19078,6 +20515,16 @@ struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScrip */ bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); +/** + * Serialize the APIError object into a byte array which can be read by APIError_read + */ +struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); + +/** + * Read a APIError from a byte array, created by APIError_write + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); + /** * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. */ @@ -19135,13 +20582,27 @@ bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); /** * Construct the invoice's HRP and signatureless data into a preimage to be hashed. */ -struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature); +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 Persister_free(struct LDKPersister this_ptr); +/** + * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. + */ +void PrintableString_free(struct LDKPrintableString this_obj); + +struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr); + +void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * Constructs a new PrintableString given each field + */ +MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); + /** * Calls the free function if one is set */ @@ -19512,11 +20973,11 @@ void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConf * any attacker who is able to take control of a channel can just as easily send the funds via * lightning payments, so we never require that our counterparties support this option. * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. * * Default value: true. * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); @@ -19529,11 +20990,11 @@ bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKC * any attacker who is able to take control of a channel can just as easily send the funds via * lightning payments, so we never require that our counterparties support this option. * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. * * Default value: true. * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); @@ -20188,10 +21649,38 @@ bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig */ void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +/** + * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to true may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: false. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + */ +bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to true may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: false. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + */ +void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + /** * Constructs a new UserConfig given each field */ -MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); +MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg); /** * Creates a copy of the UserConfig @@ -20224,7 +21713,7 @@ bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBest * Constructs a `BestBlock` that represents the genesis block at height 0 of the given * network. */ -MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network); +MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network); /** * Returns a `BestBlock` as identified by the given block hash and height. @@ -20241,26 +21730,6 @@ MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestB */ MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); -/** - * Creates a copy of the AccessError - */ -enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new UnknownChain-variant AccessError - */ -enum LDKAccessError AccessError_unknown_chain(void); - -/** - * Utility method to constructs a new UnknownTx-variant AccessError - */ -enum LDKAccessError AccessError_unknown_tx(void); - -/** - * Calls the free function if one is set - */ -void Access_free(struct LDKAccess this_ptr); - /** * Calls the free function if one is set */ @@ -20393,6 +21862,11 @@ enum LDKConfirmationTarget ConfirmationTarget_normal(void); */ enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); +/** + * Checks if two ConfirmationTargets contain equal inner contents. + */ +uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); + /** * Checks if two ConfirmationTargets contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -20482,6 +21956,11 @@ MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monito */ MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +/** + * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + */ +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); + /** * Indicates the persistence of a [`ChannelMonitor`] has completed after * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation. @@ -20748,9 +22227,11 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m * Gets the list of pending events which were generated by previous actions, clearing the list * in the process. * - * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to - * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do - * no internal locking in ChannelMonitors. + * This is called by the [`EventsProvider::process_pending_events`] implementation for + * [`ChainMonitor`]. + * + * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); @@ -20839,7 +22320,7 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_update /** * Returns the set of txids that should be monitored for re-organization out of the chain. */ -MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ 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 @@ -20869,7 +22350,7 @@ MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const /** * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_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. @@ -20939,46 +22420,46 @@ struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Per commitment point to derive delayed_payment_key by key holder + * Per commitment point to derive the delayed payment key by key holder. */ struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Per commitment point to derive delayed_payment_key by key holder + * Per commitment point to derive the delayed payment key by key holder. */ void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in * the witness_script. */ uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in * the witness_script. */ void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); /** - * The output which is referenced by the given outpoint + * The output which is referenced by the given outpoint. * * Returns a copy of the field. */ struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The output which is referenced by the given outpoint + * The output which is referenced by the given outpoint. */ void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); @@ -20995,16 +22476,14 @@ struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const s void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21051,38 +22530,36 @@ struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutpu void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The output which is referenced by the given outpoint + * The output which is referenced by the given outpoint. * * Returns a copy of the field. */ struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The output which is referenced by the given outpoint + * The output which is referenced by the given outpoint. */ void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21167,17 +22644,17 @@ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescripto /** * Calls the free function if one is set */ -void BaseSign_free(struct LDKBaseSign this_ptr); +void ChannelSigner_free(struct LDKChannelSigner this_ptr); /** - * Creates a copy of a Sign + * Calls the free function if one is set */ -struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); +void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); /** * Calls the free function if one is set */ -void Sign_free(struct LDKSign this_ptr); +void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); /** * Creates a copy of the Recipient @@ -21197,7 +22674,17 @@ enum LDKRecipient Recipient_phantom_node(void); /** * Calls the free function if one is set */ -void KeysInterface_free(struct LDKKeysInterface this_ptr); +void EntropySource_free(struct LDKEntropySource this_ptr); + +/** + * Calls the free function if one is set + */ +void NodeSigner_free(struct LDKNodeSigner this_ptr); + +/** + * Calls the free function if one is set + */ +void SignerProvider_free(struct LDKSignerProvider this_ptr); /** * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. @@ -21205,62 +22692,64 @@ void KeysInterface_free(struct LDKKeysInterface this_ptr); void InMemorySigner_free(struct LDKInMemorySigner this_obj); /** - * Private key of anchor tx + * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the + * holder's anchor output in a commitment transaction, if one is present. */ const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Private key of anchor tx + * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the + * holder's anchor output in a commitment transaction, if one is present. */ void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key for blinded revocation pubkey + * Holder secret key for blinded revocation pubkey. */ const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key for blinded revocation pubkey + * Holder secret key for blinded revocation pubkey. */ void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key used in HTLC tx + * Holder secret key used in an HTLC transaction. */ const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key used in HTLC tx + * Holder secret key used in an HTLC transaction. */ void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder htlc secret key used in commitment tx htlc outputs + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder htlc secret key used in commitment tx htlc outputs + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Commitment seed + * Commitment seed. */ const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Commitment seed + * Commitment seed. */ void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21270,90 +22759,107 @@ void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR th struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Create a new InMemorySigner + * Creates a new [`InMemorySigner`]. */ -MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey node_secret, struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); +MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** - * Counterparty pubkeys. - * Will panic if ready_channel wasn't called. + * Returns the counterparty's pubkeys. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The contest_delay value specified by our counterparty and applied on holder-broadcastable - * transactions, ie the amount of time that we have to wait to recover our funds if we + * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable + * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. - * Will panic if ready_channel wasn't called. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The contest_delay value specified by us and applied on transactions broadcastable - * by our counterparty, ie the amount of time that they have to wait to recover their funds + * 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 ready_channel wasn't called. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Whether the holder is the initiator - * Will panic if ready_channel wasn't called. + * Returns whether the holder is the initiator. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint - * Will panic if ready_channel wasn't called. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or + * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if ready_channel wasn't called. + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Whether anchors should be used. - * Will panic if ready_channel wasn't called. + * Returns whether anchors should be used. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Sign the single input of spend_tx at index `input_idx` which spends the output - * described by descriptor, returning the witness stack for the input. + * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described + * by `descriptor`, returning the witness stack for the input. + * + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], + * or if an output descriptor `script_pubkey` does not match the one we can spend. * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, - * or if an output descriptor script_pubkey does not match the one we can spend. + * [`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); /** - * Sign the single input of spend_tx at index `input_idx` which spends the output - * described by descriptor, returning the witness stack for the input. + * Sign the single input of `spend_tx` at index `input_idx` which spends the output + * described by `descriptor`, returning the witness stack for the input. * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, does not have a - * sequence set to `descriptor.to_self_delay`, or if an output descriptor - * script_pubkey does not match the one we can spend. + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], does not have a + * sequence set to [`descriptor.to_self_delay`], or if an output descriptor + * `script_pubkey` does not match the one we can spend. + * + * [`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); /** - * Constructs a new BaseSign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is + * Constructs a new ChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is + */ +struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + +/** + * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is */ -struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Constructs a new Sign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is + * Constructs a new WriteableEcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned WriteableEcdsaChannelSigner must be freed before this_arg is */ -struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read @@ -21363,7 +22869,7 @@ struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_ /** * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ -struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); /** * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. @@ -21371,39 +22877,38 @@ struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8sli void KeysManager_free(struct LDKKeysManager this_obj); /** - * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your - * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). - * starting_time isn't strictly required to actually be a time, but it must absolutely, + * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g., + * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). + * `starting_time` isn't strictly required to actually be a time, but it must absolutely, * without a doubt, be unique to this instance. ie if you start multiple times with the same - * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to - * simply use the current time (with very high precision). + * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this + * is to simply use the current time (with very high precision). * - * The seed MUST be backed up safely prior to use so that the keys can be re-created, however, - * obviously, starting_time should be unique every time you reload the library - it is only + * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however, + * obviously, `starting_time` should be unique every time you reload the library - it is only * used to generate new ephemeral key data (which will be stored by the individual channel if * necessary). * * Note that the seed is required to recover certain on-chain funds independent of - * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any - * channel, and some on-chain during-closing funds. + * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required + * for any channel, and some on-chain during-closing funds. * - * Note that until the 0.1 release there is no guarantee of backward compatibility between - * versions. Once the library is more fully supported, the docs will be updated to include a - * detailed description of the guarantee. + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * Derive an old Sign containing per-channel secrets based on a key derivation parameters. - * - * Key derivation parameters are accessible through a per-channel secrets - * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of - * onchain output detection for which a corresponding delayed_payment_key must be derived. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + */ +MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); + +/** + * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); /** - * Creates a Transaction which spends the given descriptors to the given outputs, plus an + * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an * output to the given change destination (if sufficient change value remains). The * transaction will have a feerate, at least, of the given value. * @@ -21413,16 +22918,28 @@ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const stru * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. * - * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used - * this KeysManager or one of the `InMemorySigner` created by this KeysManager. + * 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); /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + */ +struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); + +/** + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + */ +struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); + +/** + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is */ -struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); +struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); /** * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. @@ -21430,14 +22947,27 @@ struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); /** - * Constructs a new KeysInterface which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + */ +struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + +/** + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + */ +struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + +/** + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is */ -struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed` - * that is shared across all nodes that intend to participate in [phantom node payments] together. + * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` + * that is shared across all nodes that intend to participate in [phantom node payments] + * together. * * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and * `starting_time_nanos`. @@ -21459,6 +22989,37 @@ MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendab */ MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +/** + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + */ +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + +/** + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. + */ +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); + +/** + * Creates a copy of the FailureCode + */ +enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig); + +/** + * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode + */ +enum LDKFailureCode FailureCode_temporary_node_failure(void); + +/** + * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode + */ +enum 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); + /** * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ @@ -21849,14 +23410,18 @@ 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 0 if the channel was inbound. + * 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. */ -uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. + * 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. */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); /** * Our total balance. This is the amount we would get if we close the channel. @@ -21984,11 +23549,25 @@ struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LD * * This value will be `None` for outbound channels until the counterparty accepts the channel. * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + */ +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); + +/** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + */ +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** * The number of blocks (after our commitment transaction confirms) that we will need to wait @@ -22113,7 +23692,7 @@ void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelDetails given each field */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct 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, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_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); +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, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_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, 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); /** * Creates a copy of the ChannelDetails @@ -22141,34 +23720,29 @@ MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(cons MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Frees any resources used by the PaymentSendFailure - */ -void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); - -/** - * Creates a copy of the PaymentSendFailure + * Frees any resources used by the RecentPaymentDetails */ -struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); +void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); /** - * Utility method to constructs a new ParameterError-variant PaymentSendFailure + * Creates a copy of the RecentPaymentDetails */ -struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); +struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); /** - * Utility method to constructs a new PathParameterError-variant PaymentSendFailure + * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** - * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_hash); /** - * Utility method to constructs a new PartialFailure-variant PaymentSendFailure + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash); /** * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. @@ -22229,7 +23803,7 @@ struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRoute * disconnected using its `block_connected` and `block_disconnected` methods, starting * from after `params.latest_hash`. */ -MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); +MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params); /** * Gets the current configuration applied to all new channels. @@ -22241,10 +23815,9 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * * `user_channel_id` will be provided back as in * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events - * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0 - * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here. - * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise - * ignored. + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a + * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it + * is simply copied to events and otherwise ignored. * * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. @@ -22266,7 +23839,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, uint64_t user_channel_id, struct LDKUserConfig override_config); +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); /** * Gets the list of open channels, in random order. See ChannelDetail field documentation for @@ -22275,17 +23848,27 @@ MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(cons MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`] - * to ensure non-announced channels are used. + * Gets the list of usable channels, in random order. Useful as an argument to + * [`Router::find_route`] to ensure non-announced channels are used. * * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria * are. - * - * [`find_route`]: crate::routing::router::find_route */ MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +/** + * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a + * successful path, or have unresolved HTLCs. + * + * This can be useful for payments that may have been prepared, but ultimately not sent, as a + * result of a crash. If such a payment exists, is not listed here, and an + * [`Event::PaymentSent`] has not been received, you may consider resending the payment. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + */ +MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); + /** * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs * will be accepted on the given channel, and after additional timeout/the closing of all @@ -22363,24 +23946,39 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru /** * Sends a payment along a given route. * - * Value parameters are provided via the last hop in route, see documentation for RouteHop + * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] * fields for more info. * - * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative - * payment), we don't do anything to stop you! We always try to ensure that if the provided - * next hop knows the preimage to payment_hash they can claim an additional amount as - * specified in the last hop in the route! Thus, you should probably do your own - * payment_preimage tracking (which you should already be doing as they represent \"proof of - * payment\") and prevent double-sends yourself. + * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via + * [`PeerManager::process_events`]). + * + * # Avoiding Duplicate Payments + * + * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this + * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment + * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an + * [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a + * second payment with the same [`PaymentId`]. + * + * Thus, in order to ensure duplicate payments are not sent, you should implement your own + * tracking of payments, including state to indicate once a payment has completed. Because you + * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should + * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the + * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. * - * May generate SendHTLCs message(s) event on success, which should be relayed. + * Additionally, in the scenario where we begin the process of sending a payment, but crash + * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're + * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See + * [`ChannelManager::list_recent_payments`] for more information. + * + * # Possible Error States on [`PaymentSendFailure`] * * Each path may have a different return value, and PaymentSendValue may return a Vec with * each entry matching the corresponding-index entry in the route paths, see - * PaymentSendFailure for more info. + * [`PaymentSendFailure`] for more info. * * In general, a path may raise: - * * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee, + * * [`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 @@ -22392,46 +23990,50 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * irrevocably committed to on our end. In such a case, do NOT retry the payment with a * different route unless you intend to pay twice! * - * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate - * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For - * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route - * must not contain multiple paths as multi-path payments require a recipient-provided - * payment_secret. - * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature - * bit set (either as required or as available). If multiple paths are present in the Route, - * we assume the invoice had the basic_mpp feature set. + * # A caution on `payment_secret` + * + * `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one, + * the [`Route`] must not contain multiple paths as multi-path payments require a + * recipient-provided `payment_secret`. + * + * If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret + * feature bit set (either as required or as available). If multiple paths are present in the + * [`Route`], we assume the invoice had the basic_mpp feature set. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress * * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); /** - * Retries a payment along the given [`Route`]. + * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on + * `route_params` and retry failed payment paths based on `retry_strategy`. * - * Errors returned are a superset of those returned from [`send_payment`], so see - * [`send_payment`] documentation for more details on errors. This method will also error if the - * retry amount puts the payment more than 10% over the payment's total amount, if the payment - * for the given `payment_id` cannot be found (likely due to timeout or success), or if - * further retries have been disabled with [`abandon_payment`]. - * - * [`send_payment`]: [`ChannelManager::send_payment`] - * [`abandon_payment`]: [`ChannelManager::abandon_payment`] + * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Signals that no further retries for the given payment will occur. + * Signals that no further retries 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. * - * After this method returns, any future calls to [`retry_payment`] for the given `payment_id` - * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated, - * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining - * pending HTLCs for this payment. + * 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. * * Note that calling this method does *not* prevent a payment from succeeding. You must still * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * - * [`retry_payment`]: Self::retry_payment + * If an [`Event::PaymentFailed`] event is generated and we restart without this + * [`ChannelManager`] having been persisted, another [`Event::PaymentFailed`] may be generated. + * * [`Event::PaymentFailed`]: events::Event::PaymentFailed * [`Event::PaymentSent`]: events::Event::PaymentSent */ @@ -22444,7 +24046,8 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * would be able to guess -- otherwise, an intermediate node may claim the payment and it will * never reach the recipient. * - * See [`send_payment`] documentation for more details on the return value of this function. + * See [`send_payment`] documentation for more details on the return value of this function + * and idempotency guarantees provided by the [`PaymentId`] key. * * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See * [`send_payment`] for more information about the risks of duplicate preimage usage. @@ -22455,7 +24058,20 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); +MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); + +/** + * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route + * based on `route_params` and retry failed payment paths based on `retry_strategy`. + * + * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous + * payments. + * + * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend + * + * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, 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 @@ -22524,6 +24140,41 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_ */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); +/** + * Attempts to forward an intercepted HTLC over the provided channel id and with the provided + * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. + * + * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time + * channel to a receiving node if the node lacks sufficient inbound liquidity. + * + * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use + * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the + * receiver's invoice route hints. These route hints will signal to LDK to generate an + * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. + * + * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop + * you from forwarding more than you received. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); + +/** + * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to + * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); + /** * Processes HTLCs which are pending waiting on random forward delay. * @@ -22542,6 +24193,7 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * the channel. * * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs * with the current `ChannelConfig`. + * * Removing peers which have disconnected but and no longer have any channels. * * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate * estimate fetches. @@ -22550,12 +24202,12 @@ void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_ /** * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect - * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources + * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources * along the path (including in our own channel on which we received it). * * Note that in some cases around unclean shutdown, it is possible the payment may have * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a - * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment + * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment * may have already been failed automatically by LDK if it was nearing its expiration time. * * While LDK will never claim a payment automatically on your behalf (i.e. without you calling @@ -22566,7 +24218,15 @@ void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_ void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any + * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the + * reason for the failure. + * + * 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); + +/** + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any * [`MessageSendEvent`]s needed to claim the payment. * * Note that calling this method does *not* guarantee that the payment has been claimed. You @@ -22574,16 +24234,15 @@ void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_ * provided to your [`EventHandler`] when [`process_pending_events`] is next called. * * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or - * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived` + * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` * 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. * - * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived + * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable * [`Event::PaymentClaimed`]: crate::util::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 - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); @@ -22610,7 +24269,7 @@ MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDK * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); /** * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating @@ -22632,7 +24291,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -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, uint64_t user_channel_id); +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); /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing @@ -22641,8 +24300,9 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * This differs from [`create_inbound_payment_for_hash`] only in that it generates the * [`PaymentHash`] and [`PaymentPreimage`] for you. * - * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which - * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be + * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which + * will have the [`PaymentClaimable::purpose`] be [`PaymentPurpose::InvoicePayment`] with + * its [`PaymentPurpose::InvoicePayment::payment_preimage`] field filled in. That should then be * passed directly to [`claim_funds`]. * * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. @@ -22657,12 +24317,17 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * * Errors if `min_value_msat` is greater than total bitcoin supply. * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [`claim_funds`]: Self::claim_funds - * [`PaymentReceived`]: events::Event::PaymentReceived - * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage + * [`PaymentClaimable`]: events::Event::PaymentClaimable + * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose + * [`PaymentPurpose::InvoicePayment`]: events::PaymentPurpose::InvoicePayment + * [`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); +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); /** * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share @@ -22681,7 +24346,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is * stored external to LDK. * - * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a + * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a * payment secret fetched via this method or [`create_inbound_payment`], and which is at least * the `min_value_msat` provided here, if one is provided. * @@ -22691,7 +24356,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * * `min_value_msat` should be set if the invoice being generated contains a value. Any payment * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the + * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the * sender \"proof-of-payment\" unless they have paid the required amount. * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for @@ -22702,12 +24367,12 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * * Note that we use block header time to time-out pending inbound payments (with some margin * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry. + * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. * If you need exact expiry semantics, you should enforce them upon receipt of - * [`PaymentReceived`]. + * [`PaymentClaimable`]. * - * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` - * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. + * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` + * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. * * Note that a malicious eavesdropper can intuit whether an inbound payment was created by * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. @@ -22719,10 +24384,13 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * * Errors if `min_value_msat` is greater than total bitcoin supply. * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentReceived`]: events::Event::PaymentReceived + * [`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); +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); /** * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share @@ -22760,6 +24428,22 @@ MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelMan */ MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +/** + * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are + * used when constructing the route hints for HTLCs intended to be intercepted. See + * [`ChannelManager::forward_intercepted_htlc`]. + * + * Note that this method is not guaranteed to return unique values, you may need to call it a few + * times to get a unique scid. + */ +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Gets inflight HTLC information by processing pending outbound payments that are in + * our channels. May be used during pathfinding to account for in-use channel liquidity. + */ +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *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 @@ -22787,17 +24471,24 @@ struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONN /** * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool * indicating whether persistence is necessary. Only one listener on - * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken - * up. + * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by + * [`get_persistable_update_future`] is guaranteed to be woken up. * * Note that this method is not available with the `no-std` feature. + * + * [`await_persistable_update`]: Self::await_persistable_update + * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout + * [`get_persistable_update_future`]: Self::get_persistable_update_future */ MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); /** * Blocks until ChannelManager needs to be persisted. Only one listener on - * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken - * up. + * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by + * [`get_persistable_update_future`] is guaranteed to be woken up. + * + * [`await_persistable_update`]: Self::await_persistable_update + * [`get_persistable_update_future`]: Self::get_persistable_update_future */ void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -22815,28 +24506,40 @@ 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); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by * [`ChannelManager`]. */ -struct LDKNodeFeatures provided_node_features(void); +MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_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 [`ChannelTypeFeatures`] flags which 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 * [`ChannelManager`]. */ -struct LDKChannelFeatures provided_channel_features(void); +MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + */ +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 * [`ChannelManager`]. */ -struct LDKInitFeatures provided_init_features(void); +struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR _config); /** * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read @@ -22888,19 +24591,39 @@ struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_ */ void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +/** + * A cryptographically secure source of entropy. + */ +const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + +/** + * A cryptographically secure source of entropy. + */ +void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); + +/** + * A signer that is able to perform node-scoped cryptographic operations. + */ +const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + +/** + * A signer that is able to perform node-scoped cryptographic operations. + */ +void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); + /** * The keys provider which will give us relevant keys. Some keys will be loaded during * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ -const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** * The keys provider which will give us relevant keys. Some keys will be loaded during * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel * signing data. */ -void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); +void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); /** * The fee_estimator for use in the ChannelManager in the future. @@ -22948,6 +24671,22 @@ const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster( */ void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +/** + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. + */ +const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + +/** + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. + */ +void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); + /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. @@ -22977,7 +24716,7 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs * HashMap for you. This is primarily useful for C bindings where it is not practical to * populate a HashMap directly from C. */ -MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); +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 @@ -23001,15 +24740,19 @@ MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material) * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without * a `ChannelManager`. * - * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then + * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not * regenerate it for each new inbound payment. * * `current_time` is a Unix timestamp representing the current time. * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::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 LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time); +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); /** * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], @@ -23018,9 +24761,12 @@ struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDK * * See [`create`] for information on the `keys` and `current_time` parameters. * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * * [phantom node payments]: crate::chain::keysinterface::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 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); /** * Frees any resources used by the DecodeError @@ -23079,28 +24825,32 @@ bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDK void Init_free(struct LDKInit this_obj); /** - * The relevant features which the sender supports + * The relevant features which the sender supports. */ struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); /** - * The relevant features which the sender supports + * The relevant features which the sender supports. */ void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * The receipient's network address. This adds the option to report a remote IP address - * back to a connecting peer using the init message. A node can decide to use that information - * to discover a potential update to its public IPv4 address (NAT) and use - * that for a node_announcement update message containing the new address. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * 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); /** - * The receipient's network address. This adds the option to report a remote IP address - * back to a connecting peer using the init message. A node can decide to use that information - * to discover a potential update to its public IPv4 address (NAT) and use - * that for a node_announcement update message containing the new address. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * 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); @@ -23144,16 +24894,18 @@ void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, s /** * A possibly human-readable error description. - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. */ struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** * A possibly human-readable error description. - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. */ void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); @@ -23196,6 +24948,7 @@ void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_pt /** * A possibly human-readable warning description. + * * The string should be sanitized before it is used (e.g. emitted to logs or printed to * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. @@ -23204,6 +24957,7 @@ struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PT /** * A possibly human-readable warning description. + * * The string should be sanitized before it is used (e.g. emitted to logs or printed to * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in * the terminal emulator or the logging subsystem. @@ -23233,23 +24987,25 @@ bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const stru void Ping_free(struct LDKPing this_obj); /** - * The desired response length + * The desired response length. */ uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * The desired response length + * The desired response length. */ void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); @@ -23278,12 +25034,14 @@ void Pong_free(struct LDKPong this_obj); /** * The pong packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** * The pong packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); @@ -23391,22 +25149,26 @@ uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_ void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); @@ -23481,28 +25243,30 @@ struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKO void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Channel flags + * The channel flags to be used */ uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Channel flags + * The channel flags to be used */ void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent + * + * If this is `None`, we derive the channel type from the intersection of our + * feature bits with our counterparty's feature bits from the [`Init`] message. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent + * + * If this is `None`, we derive the channel type from the intersection of our + * feature bits with our counterparty's feature bits from the [`Init`] message. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ @@ -23666,10 +25430,10 @@ struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LD void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent. * + * If this is `None`, we derive the channel type from the intersection of + * our feature bits with our counterparty's feature bits from the [`Init`] message. * This is required to match the equivalent field in [`OpenChannel::channel_type`]. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -23677,10 +25441,10 @@ void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNU struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The channel type that this channel will represent. * + * If this is `None`, we derive the channel type from the intersection of + * our feature bits with our counterparty's feature bits from the [`Init`] message. * This is required to match the equivalent field in [`OpenChannel::channel_type`]. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -23829,14 +25593,18 @@ struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKC void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * If set, provides a short_channel_id alias for this channel. The sender will accept payments - * to be forwarded over this SCID and forward them to this messages' recipient. + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * If set, provides a short_channel_id alias for this channel. The sender will accept payments - * to be forwarded over this SCID and forward them to this messages' recipient. + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); @@ -23874,13 +25642,15 @@ void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LD /** * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); @@ -24597,6 +26367,36 @@ struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj) */ struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); +/** + * Frees any resources used by the UnsignedGossipMessage + */ +void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); + +/** + * Creates a copy of the UnsignedGossipMessage + */ +struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); + +/** + * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage + */ +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); + +/** + * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage + */ +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); + +/** + * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage + */ +struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); + +/** + * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read + */ +struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); + /** * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. */ @@ -24623,16 +26423,16 @@ uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnno void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back * to this node). */ -struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back * to this node). */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** * An RGB color for UI purposes @@ -24645,14 +26445,16 @@ const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnn void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -24758,44 +26560,44 @@ uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsign void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** - * One of the two node_ids which are endpoints of this channel + * One of the two `node_id`s which are endpoints of this channel */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * One of the two node_ids which are endpoints of this channel + * One of the two `node_id`s which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * The other of the two node_ids which are endpoints of this channel + * The other of the two `node_id`s which are endpoints of this channel */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The other of the two node_ids which are endpoints of this channel + * The other of the two `node_id`s which are endpoints of this channel */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** * The funding key for the first node */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the first node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** * The funding key for the second node */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** * The funding key for the second node */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** * Creates a copy of the UnsignedChannelAnnouncement @@ -24929,10 +26731,10 @@ void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PT /** * The number of blocks such that if: * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before * forwarding. Note that the HTLC sender is the one who originally sets this value when * constructing the route. */ @@ -24941,10 +26743,10 @@ uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedCha /** * The number of blocks such that if: * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before * forwarding. Note that the HTLC sender is the one who originally sets this value when * constructing the route. */ @@ -24961,12 +26763,16 @@ uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedCha void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); @@ -24992,8 +26798,9 @@ void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedCha /** * 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 + * 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. */ @@ -25001,8 +26808,9 @@ struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsigne /** * 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 + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. */ void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); @@ -25163,14 +26971,14 @@ bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONN void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** - * The short_channel_ids in the channel range + * The `short_channel_id`s in the channel range * * Returns a copy of the field. */ struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The short_channel_ids in the channel range + * The `short_channel_id`s in the channel range */ void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); @@ -25252,13 +27060,13 @@ void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *N /** * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * information for the `chain_hash` */ bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * information for the `chain_hash` */ void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); @@ -25412,66 +27220,66 @@ struct LDKLightningError LightningError_clone(const struct LDKLightningError *NO void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); /** - * update_add_htlc messages which should be sent + * `update_add_htlc` messages which should be sent */ struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * update_add_htlc messages which should be sent + * `update_add_htlc` messages which should be sent */ void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** - * update_fulfill_htlc messages which should be sent + * `update_fulfill_htlc` messages which should be sent */ struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * update_fulfill_htlc messages which should be sent + * `update_fulfill_htlc` messages which should be sent */ void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** - * update_fail_htlc messages which should be sent + * `update_fail_htlc` messages which should be sent */ struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * update_fail_htlc messages which should be sent + * `update_fail_htlc` messages which should be sent */ void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** - * update_fail_malformed_htlc messages which should be sent + * `update_fail_malformed_htlc` messages which should be sent */ struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * update_fail_malformed_htlc messages which should be sent + * `update_fail_malformed_htlc` messages which should be sent */ void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** - * An update_fee message which should be sent + * An `update_fee` message which should be sent * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * An update_fee message which should be sent + * An `update_fee` message which should be sent * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** - * Finally, the commitment_signed message which should be sent + * A `commitment_signed` message which should be sent */ struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Finally, the commitment_signed message which should be sent + * A `commitment_signed` message which should be sent */ void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); @@ -25818,7 +27626,9 @@ struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChann struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); /** - *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t + * Calculates the overflow safe ending block height for the query. + * + * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. */ MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); @@ -26000,32 +27810,10 @@ void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); */ void PeerHandleError_free(struct LDKPeerHandleError this_obj); -/** - * Used to indicate that we probably can't make any future connections to this peer (e.g. - * because we required features that our peer was missing, or vice versa). - * - * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close - * any channels with this peer or check for new versions of LDK. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ -bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); - -/** - * Used to indicate that we probably can't make any future connections to this peer (e.g. - * because we required features that our peer was missing, or vice versa). - * - * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close - * any channels with this peer or check for new versions of LDK. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ -void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); - /** * Constructs a new PeerHandleError given each field */ -MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); /** * Creates a copy of the PeerHandleError @@ -26047,19 +27835,24 @@ void PeerManager_free(struct LDKPeerManager this_obj); * timestamp, however if it is not available a persistent counter that increases once per * minute should suffice. */ -MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler); +MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler, struct LDKNodeSigner node_signer); /** - * Get the list of node ids for peers which have completed the initial handshake. + * Get a list of tuples mapping from node id to network addresses for peers which have + * completed the initial handshake. * - * For outbound connections, this will be the same as the their_node_id parameter passed in to - * new_outbound_connection, however entries will only appear once the initial handshake has - * completed and we are sure the remote peer has the private key for the given node_id. + * For outbound connections, the [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`Self::new_outbound_connection`], however entries will only appear once the initial + * handshake has completed and we are sure the remote peer has the private key for the given + * [`PublicKey`]. + * + * 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_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ 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 + * Indicates a new outbound connection has been established to a node with the given `node_id` * and an optional remote network address. * * The remote network address adds the option to report a remote IP address back to a connecting @@ -26125,6 +27918,9 @@ MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_spa * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the * send buffer). * + * In order to avoid processing too many messages at once per peer, `data` should be on the + * order of 4KiB. + * * [`send_data`]: SocketDescriptor::send_data * [`process_events`]: PeerManager::process_events */ @@ -26159,15 +27955,12 @@ void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR th /** * Disconnect a peer given its node id. * - * Set `no_connection_possible` to true to prevent any further connection with this peer, - * force-closing any channels we have with it. - * * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the * peer. Thus, be very careful about reentrancy issues. * * [`disconnect_socket`]: SocketDescriptor::disconnect_socket */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** * Disconnects all currently-connected peers. This is useful on platforms where there may be @@ -26220,6 +28013,47 @@ uint64_t htlc_success_tx_weight(bool opt_anchors); */ uint64_t htlc_timeout_tx_weight(bool opt_anchors); +/** + * Creates a copy of the HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); + +/** + * Utility method to constructs a new OfferedTimeout-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_offered_timeout(void); + +/** + * Utility method to constructs a new OfferedPreimage-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_offered_preimage(void); + +/** + * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); + +/** + * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); + +/** + * Utility method to constructs a new Revocation-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_revocation(void); + +/** + * Checks if two HTLCClaims contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); + +/** + * Check if a given input witness attempts to claim a HTLC. + */ +MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); + /** * Build the commitment secret from the seed and the commitment number */ @@ -26278,21 +28112,15 @@ struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitme /** * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) * from the base secret and the per_commitment_point. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +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. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +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. @@ -26301,11 +28129,8 @@ struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_comm * commitment transaction, thus per_commitment_secret always come from cheater * and revocation_base_secret always come from punisher, which is the broadcaster * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +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 @@ -26320,7 +28145,7 @@ struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (* * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +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. @@ -26512,13 +28337,13 @@ 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 LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); +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); /** * Generate per-state keys from channel static keys. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** * A script either spendable by the revocation @@ -26642,7 +28467,19 @@ 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, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, bool use_non_zero_fee_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + +/** + * Returns the witness required to satisfy and spend a HTLC input. + * + * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors); + +/** + * Gets the witnessScript for the to_remote output when anchors are enabled. + */ +struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); /** * Gets the witnessScript for an anchor output from the funding public key. @@ -26654,6 +28491,11 @@ struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32 */ 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); + /** * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ @@ -26733,10 +28575,24 @@ enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct */ void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +/** + * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) + * It is intended merely for backwards compatibility with signers that need it. + * There is no support for this feature in LDK channel negotiation. + */ +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) + * It is intended merely for backwards compatibility with signers that need it. + * There is no support for this feature in LDK channel negotiation. + */ +void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); + /** * Constructs a new ChannelTransactionParameters given each field */ -MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg); +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg, enum LDKCOption_NoneZ opt_non_zero_fee_anchors_arg); /** * Creates a copy of the ChannelTransactionParameters @@ -27170,28 +29026,56 @@ uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey br * 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 InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); +bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); + +/** + * Checks if two NodeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); + +/** + * Checks if two ChannelFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); + +/** + * Checks if two InvoiceFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ +bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); + +/** + * Checks if two OfferFeaturess 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 OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); /** - * Checks if two NodeFeaturess contain equal inner contents. + * Checks if two InvoiceRequestFeaturess 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 NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); +bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); /** - * Checks if two ChannelFeaturess contain equal inner contents. + * Checks if two Bolt12InvoiceFeaturess contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); +bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); /** - * Checks if two InvoiceFeaturess contain equal inner contents. + * Checks if two BlindedHopFeaturess 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 InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); +bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); /** * Checks if two ChannelTypeFeaturess contain equal inner contents. @@ -27220,6 +29104,26 @@ struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures */ struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); +/** + * Creates a copy of the OfferFeatures + */ +struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); + +/** + * Creates a copy of the InvoiceRequestFeatures + */ +struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); + +/** + * Creates a copy of the Bolt12InvoiceFeatures + */ +struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); + +/** + * Creates a copy of the BlindedHopFeatures + */ +struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); + /** * Creates a copy of the ChannelTypeFeatures */ @@ -27245,6 +29149,26 @@ void ChannelFeatures_free(struct LDKChannelFeatures this_obj); */ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); +/** + * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. + */ +void OfferFeatures_free(struct LDKOfferFeatures this_obj); + +/** + * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. + */ +void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); + +/** + * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. + */ +void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); + +/** + * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. + */ +void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); + /** * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ @@ -27294,6 +29218,50 @@ MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); */ MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); + /** * Create a blank Features with no features set */ @@ -27345,6 +29313,16 @@ struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNUL */ struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); +/** + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read + */ +struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); + +/** + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); + /** * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ @@ -27715,6 +29693,21 @@ void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_P */ MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + /** * Checks if this feature is required. */ @@ -27730,6 +29723,11 @@ MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures * */ MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -27770,6 +29768,66 @@ MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONN */ MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -28127,15 +30185,186 @@ MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LD */ MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +/** + * Frees any resources used by the Retry + */ +void Retry_free(struct LDKRetry this_ptr); + +/** + * Creates a copy of the Retry + */ +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); + +/** + * Utility method to constructs a new Timeout-variant Retry + */ +struct LDKRetry Retry_timeout(uint64_t a); + +/** + * Checks if two Retrys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); + +/** + * Checks if two Retrys contain equal inner contents. + */ +uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); + +/** + * Creates a copy of the RetryableSendFailure + */ +enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure + */ +enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); + +/** + * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure + */ +enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); + +/** + * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure + */ +enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); + +/** + * Frees any resources used by the PaymentSendFailure + */ +void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); + +/** + * Creates a copy of the PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new ParameterError-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); + +/** + * Utility method to constructs a new PathParameterError-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); + +/** + * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); + +/** + * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); + +/** + * Utility method to constructs a new PartialFailure-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); + +/** + * Calls the free function if one is set + */ +void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); + +/** + * Calls the free function if one is set + */ +void Type_free(struct LDKType this_ptr); + +/** + * Creates a copy of the UtxoLookupError + */ +enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new UnknownChain-variant UtxoLookupError + */ +enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); + +/** + * Utility method to constructs a new UnknownTx-variant UtxoLookupError + */ +enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); + +/** + * Frees any resources used by the UtxoResult + */ +void UtxoResult_free(struct LDKUtxoResult this_ptr); + +/** + * Creates a copy of the UtxoResult + */ +struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Sync-variant UtxoResult + */ +struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); + +/** + * Utility method to constructs a new Async-variant UtxoResult + */ +struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); + /** * Calls the free function if one is set */ -void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +void UtxoLookup_free(struct LDKUtxoLookup this_ptr); + +/** + * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. + */ +void UtxoFuture_free(struct LDKUtxoFuture this_obj); + +/** + * Creates a copy of the UtxoFuture + */ +struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); + +/** + * Builds a new future for later resolution. + */ +MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); + +/** + * Resolves this future against the given `graph` and with the given `result`. + * + * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling + * forwarding the validated gossip message onwards to peers. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + */ +void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** - * Calls the free function if one is set + * Resolves this future against the given `graph` and with the given `result`. + * + * The given `gossip` is used to broadcast any validated messages onwards to all peers which + * have available buffer space. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events */ -void Type_free(struct LDKType this_ptr); +void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. @@ -28231,24 +30460,24 @@ void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); /** * Creates a new tracker of the actual state of the network of channels and nodes, * assuming an existing Network Graph. - * Chain monitor is used to make sure announced channels exist on-chain, - * channel data is correct, and that the announcement is signed with - * channel owners' keys. + * UTXO lookup is used to make sure announced channels exist on-chain, channel data is + * correct, and the announcement is signed with channel owners' keys. */ -MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); +MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); /** * Adds a provider used to check new announcements. Does not affect * existing announcements unless they are updated. * Add, update or remove the provider would replace the current one. */ -void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); +void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * Constructs a new EventHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is + * Handles any network updates originating from [`Event`]s. + * + * [`Event`]: crate::util::events::Event */ -struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. @@ -28513,13 +30742,6 @@ struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirected */ MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); -/** - * Returns information for the direction. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); - /** * Returns the maximum HTLC amount allowed over the channel in the direction. */ @@ -28557,7 +30779,7 @@ struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat) /** * Utility method to constructs a new Total-variant EffectiveCapacity */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); /** * Utility method to constructs a new Infinite-variant EffectiveCapacity @@ -28580,12 +30802,12 @@ MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacit void RoutingFees_free(struct LDKRoutingFees this_obj); /** - * Flat routing fee in satoshis + * Flat routing fee in millisatoshis. */ uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Flat routing fee in satoshis + * Flat routing fee in millisatoshis. */ void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); @@ -28796,24 +31018,6 @@ struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR */ void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); -/** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); - -/** - * Lowest fees enabling routing via any of the enabled, known channels to a node. - * The two fields (flat and proportional fee) are independent, - * meaning they don't have to refer to the same channel. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - /** * More information about a node from node_announcement. * Optional because we store a Node entry after learning about it from @@ -28835,7 +31039,7 @@ void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, st /** * Constructs a new NodeInfo given each field */ -MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); +MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); /** * Creates a copy of the NodeInfo @@ -28872,7 +31076,7 @@ struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice s /** * Creates a new, empty, network graph. */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); /** * Returns a read-only view of the network graph. @@ -28916,20 +31120,20 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** * Store or update channel info from a channel announcement without verifying the associated * signatures. Because we aren't given the associated signatures here we cannot relay the * channel announcement to any of our peers. * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** * Update channel from partial announcement data received via rapid gossip sync @@ -29046,6 +31250,79 @@ MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct */ MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +/** + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + */ +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); + +/** + * Constructs a new Router which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is + */ +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); + +/** + * Calls the free function if one is set + */ +void Router_free(struct LDKRouter this_ptr); + +/** + * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. + */ +void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); + +/** + * Initialize a new `ScorerAccountingForInFlightHtlcs`. + */ +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); + +/** + * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read + */ +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); + +/** + * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. + */ +void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); + +/** + * Creates a copy of the InFlightHtlcs + */ +struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); + +/** + * Constructs an empty `InFlightHtlcs`. + */ +MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); + +/** + * Returns liquidity in msat given the public key of the HTLC source, target, and short channel + * id. + */ +MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid); + +/** + * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read + */ +struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); + +/** + * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); + /** * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. */ @@ -29268,26 +31545,23 @@ 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 CLTV on the final hop of the failed payment path. - */ -uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr); - -/** - * The CLTV on the final hop of the failed payment path. - */ -void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val); - /** * Constructs a new RouteParameters given each field */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, uint32_t final_cltv_expiry_delta_arg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg); /** * Creates a copy of the RouteParameters */ struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +/** + * Checks if two RouteParameterss 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 RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); + /** * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ @@ -29431,10 +31705,20 @@ 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); +/** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ +uint32_t PaymentParameters_get_final_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ +void PaymentParameters_set_final_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); + /** * Constructs a new PaymentParameters given each field */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_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 LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_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, uint32_t final_cltv_expiry_delta_arg); /** * Creates a copy of the PaymentParameters @@ -29461,17 +31745,23 @@ struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NO /** * Read a PaymentParameters from a byte array, created by PaymentParameters_write */ -struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser); +struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); /** * Creates a payee with the node id of the given `pubkey`. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. @@ -30167,6 +32457,31 @@ void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilistic */ MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); +/** + * 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. + * + * 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. + * + * 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. + * + * Because the datapoints are decayed slowly over time, values will eventually return to + * `Some(([0; 8], [0; 8]))`. + */ +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); + /** * Marks the node with the given `node_id` as banned, i.e., * it will be avoided during path finding. @@ -30221,9 +32536,14 @@ struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); /** - * Frees any resources used by the BlindedRoute, if is_owned is set and inner is non-NULL. + * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. + */ +void BlindedPath_free(struct LDKBlindedPath this_obj); + +/** + * Creates a copy of the BlindedPath */ -void BlindedRoute_free(struct LDKBlindedRoute this_obj); +struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig); /** * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. @@ -30231,22 +32551,27 @@ void BlindedRoute_free(struct LDKBlindedRoute this_obj); void BlindedHop_free(struct LDKBlindedHop this_obj); /** - * Create a blinded route to be forwarded along `node_pks`. The last node pubkey in `node_pks` + * Creates a copy of the BlindedHop + */ +struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); + +/** + * Create a blinded path 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. */ -MUST_USE_RES struct LDKCResult_BlindedRouteNoneZ BlindedRoute_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager); +MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read + * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read */ -struct LDKCVec_u8Z BlindedRoute_write(const struct LDKBlindedRoute *NONNULL_PTR obj); +struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); /** - * Read a BlindedRoute from a byte array, created by BlindedRoute_write + * Read a BlindedPath from a byte array, created by BlindedPath_write */ -struct LDKCResult_BlindedRouteDecodeErrorZ BlindedRoute_read(struct LDKu8slice ser); +struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); /** * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read @@ -30268,15 +32593,20 @@ void OnionMessenger_free(struct LDKOnionMessenger this_obj); */ void Destination_free(struct LDKDestination this_ptr); +/** + * Creates a copy of the Destination + */ +struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); + /** * Utility method to constructs a new Node-variant Destination */ struct LDKDestination Destination_node(struct LDKPublicKey a); /** - * Utility method to constructs a new BlindedRoute-variant Destination + * Utility method to constructs a new BlindedPath-variant Destination */ -struct LDKDestination Destination_blinded_route(struct LDKBlindedRoute a); +struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); /** * Frees any resources used by the SendError @@ -30318,6 +32648,16 @@ struct LDKSendError SendError_invalid_message(void); */ struct LDKSendError SendError_buffer_full(void); +/** + * Utility method to constructs a new GetNodeIdFailed-variant SendError + */ +struct LDKSendError SendError_get_node_id_failed(void); + +/** + * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError + */ +struct LDKSendError SendError_blinded_path_advance_failed(void); + /** * Checks if two SendErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30333,7 +32673,7 @@ void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to * their respective handlers. */ -MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); /** * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`. @@ -30341,7 +32681,7 @@ MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface * * 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_custom_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKCustomOnionMessageContents msg, struct LDKBlindedRoute reply_path); +MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. @@ -30355,6 +32695,16 @@ struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct */ struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +/** + * Frees any resources used by the OnionMessageContents + */ +void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); + +/** + * Utility method to constructs a new Custom-variant OnionMessageContents + */ +struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); + /** * Calls the free function if one is set */ @@ -30379,7 +32729,7 @@ MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFile /** * Read `ChannelMonitor`s from disk. */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager); +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); /** * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. @@ -30923,35 +33273,35 @@ uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o); bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); /** - * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL. + * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL. */ -void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj); +void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj); -uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr); +uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr); -void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val); +void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new MinFinalCltvExpiry given each field + * Constructs a new MinFinalCltvExpiryDelta given each field */ -MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg); +MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg); /** - * Creates a copy of the MinFinalCltvExpiry + * Creates a copy of the MinFinalCltvExpiryDelta */ -struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig); +struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig); /** - * Checks if two MinFinalCltvExpirys contain equal inner contents. + * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents. */ -uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o); +uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o); /** - * Checks if two MinFinalCltvExpirys contain equal inner contents. + * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b); +bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b); /** * Frees any resources used by the Fallback @@ -30966,7 +33316,7 @@ struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig); /** * Utility method to constructs a new SegWitProgram-variant Fallback */ -struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program); +struct LDKFallback Fallback_seg_wit_program(struct LDKU5 version, struct LDKCVec_u8Z program); /** * Utility method to constructs a new PubKeyHash-variant Fallback @@ -31106,7 +33456,7 @@ MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvo * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawInvoice_min_final_cltv_expiry_delta(const struct LDKRawInvoice *NONNULL_PTR this_arg); /** * @@ -31258,10 +33608,10 @@ MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_a MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time); /** - * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise - * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. + * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise + * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry_delta(const struct LDKInvoice *NONNULL_PTR this_arg); /** * Returns a list of all routes included in the invoice @@ -31356,6 +33706,11 @@ enum LDKCreationError CreationError_invalid_amount(void); */ enum LDKCreationError CreationError_missing_route_hints(void); +/** + * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError + */ +enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void); + /** * Checks if two CreationErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -31465,50 +33820,56 @@ bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); /** - * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL. - */ -void InvoicePayer_free(struct LDKInvoicePayer this_obj); - -/** - * Calls the free function if one is set - */ -void Payer_free(struct LDKPayer this_ptr); - -/** - * Calls the free function if one is set - */ -void Router_free(struct LDKRouter this_ptr); - -/** - * Frees any resources used by the Retry - */ -void Retry_free(struct LDKRetry this_ptr); - -/** - * Creates a copy of the Retry - */ -struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Attempts-variant Retry + * Pays the given [`Invoice`], retrying if needed based on [`Retry`]. + * + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. */ -struct LDKRetry Retry_attempts(uintptr_t a); +struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** - * Utility method to constructs a new Timeout-variant Retry + * Pays the given [`Invoice`] 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 [`Invoice::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 LDKRetry Retry_timeout(uint64_t a); +struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** - * Checks if two Retrys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Pays the given zero-value [`Invoice`] using the given amount, retrying if needed based on + * [`Retry`]. + * + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see + * [`pay_zero_value_invoice_with_id`]. */ -bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); +struct LDKCResult_PaymentIdPaymentErrorZ pay_zero_value_invoice(const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** - * Checks if two Retrys contain equal inner contents. + * Pays the given zero-value [`Invoice`] using the given amount and 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 [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] + * has never been paid before. + * + * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the + * idempotency token. */ -uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); +struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKInvoice *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 @@ -31525,86 +33886,10 @@ struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_ */ struct LDKPaymentError PaymentError_invoice(struct LDKStr a); -/** - * Utility method to constructs a new Routing-variant PaymentError - */ -struct LDKPaymentError PaymentError_routing(struct LDKLightningError a); - /** * Utility method to constructs a new Sending-variant PaymentError */ -struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); - -/** - * Creates an invoice payer that retries failed payment paths. - * - * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once - * `retry` has been exceeded for a given [`Invoice`]. - */ -MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry); - -/** - * Pays the given [`Invoice`], caching it for later use in case a retry is needed. - * - * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has - * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so - * for you. - */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); - -/** - * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in - * case a retry is needed. - * - * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has - * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so - * for you. - */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats); - -/** - * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in - * case a retry is needed. - * - * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never - * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. - */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); - -/** - * Removes the payment cached by the given payment hash. - * - * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an - * [`EventHandler`]. Otherwise, calling this method is unnecessary. - */ -void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); - -/** - * Constructs a new EventHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is - */ -struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); - -/** - * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. - */ -void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); - -/** - * Returns liquidity in msat given the public key of the HTLC source, target, and short channel - * id. - */ -MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid); - -/** - * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read - */ -struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); - -/** - * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write - */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); +struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a); /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" @@ -31627,7 +33912,14 @@ struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. * - * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * `duration_since_epoch` is the current time since epoch in seconds. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this * requirement). * @@ -31636,10 +33928,14 @@ struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + * + * 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. * * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes 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.\" @@ -31664,7 +33960,9 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKC * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. * - * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * `duration_since_epoch` is the current time since epoch in seconds. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this * requirement). * @@ -31674,9 +33972,12 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKC * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels * + * 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. + * * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes 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 @@ -31687,8 +33988,15 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_descri * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom @@ -31700,45 +34008,37 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for * in excess of the current time. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * See [`create_invoice_from_channelmanager_with_description_hash`] * This version 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_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * See [`create_invoice_from_channelmanager`] * This version 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_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); - -/** - * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. - */ -void DefaultRouter_free(struct LDKDefaultRouter this_obj); - -/** - * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source - * `random_seed_bytes`. - */ -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); - -/** - * Constructs a new Router which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is - */ -struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Constructs a new Payer which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is + * See [`create_invoice_from_channelmanager_and_duration_since_epoch`] + * This version allows for providing a custom [`PaymentHash`] for the invoice. + * This may be useful if you're building an on-chain swap or involving another protocol where + * the payment hash is also involved outside the scope of lightning. */ -struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Read a SiPrefix object from a string @@ -31793,18 +34093,25 @@ void RapidGossipSync_free(struct LDKRapidGossipSync this_obj); /** * Instantiate a new [`RapidGossipSync`] instance. */ -MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph); +MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); /** * Update network graph from binary data. * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * `network_graph`: network graph to be updated - * * `update_data`: `&[u8]` binary stream that comprises the update data */ MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data); +/** + * Update network graph from binary data. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. + * + * `update_data`: `&[u8]` binary stream that comprises the update data + * `current_time_unix`: `Option` optional current timestamp to verify data age + */ +MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix); + /** * Returns whether a rapid gossip sync has completed at least once. */