X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=8afabdc1b96d4c5974801ef2dcf5277df3b6eb1f;hb=82601052fe2cac04a6249f5930495e987923303b;hp=af9b13476c1a9dde458a94be1b6ff1926ef85741;hpb=2f70a371708dbfde3fa6abfcc0315736d2795a01;p=ldk-c-bindings diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index af9b134..8afabdc 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 */ @@ -159,11 +141,11 @@ typedef enum LDKConfirmationTarget { } LDKConfirmationTarget; /** - * Errors that may occur when constructing a new `RawInvoice` or `Invoice` + * Errors that may occur when constructing a new [`RawInvoice`] or [`Invoice`] */ typedef enum LDKCreationError { /** - * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new)) + * The supplied description string was longer than 639 __bytes__ (see [`Description::new`]) */ LDKCreationError_DescriptionTooLong, /** @@ -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,36 @@ 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. */ @@ -339,10 +357,55 @@ typedef enum LDKNetwork { LDKNetwork_Sentinel, } LDKNetwork; +/** + * The reason the payment failed. Used in [`Event::PaymentFailed`]. + */ +typedef enum LDKPaymentFailureReason { + /** + * The intended recipient rejected our payment. + */ + LDKPaymentFailureReason_RecipientRejected, + /** + * The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`]. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + LDKPaymentFailureReason_UserAbandoned, + /** + * We exhausted all of our retry attempts while trying to send the payment, or we + * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry + * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will + * have come before this. + * + * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout + */ + LDKPaymentFailureReason_RetriesExhausted, + /** + * The payment expired while retrying, based on the provided + * [`PaymentParameters::expiry_time`]. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKPaymentFailureReason_PaymentExpired, + /** + * We failed to find a route while retrying the payment. + */ + LDKPaymentFailureReason_RouteNotFound, + /** + * This error should generally never happen. This likely means that there is a problem with + * your router. + */ + LDKPaymentFailureReason_UnexpectedError, + /** + * Must be last for serialization purposes + */ + LDKPaymentFailureReason_Sentinel, +} LDKPaymentFailureReason; + /** * Specifies the recipient of an invoice. * - * This indicates to [`KeysInterface::sign_invoice`] what node secret key should be used to sign + * This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign * the invoice. */ typedef enum LDKRecipient { @@ -363,6 +426,41 @@ typedef enum LDKRecipient { LDKRecipient_Sentinel, } LDKRecipient; +/** + * Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be + * surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::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::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::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 */ @@ -418,7 +516,7 @@ typedef enum LDKSecp256k1Error { } LDKSecp256k1Error; /** - * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the + * Errors that may occur when converting a [`RawInvoice`] to an [`Invoice`]. They relate to the * requirements sections in BOLT #11 */ typedef enum LDKSemanticError { @@ -495,6 +593,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! @@ -692,86 +808,336 @@ typedef struct LDKTxOut { } LDKTxOut; /** - * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not + * An enum which can either contain a u64 or not */ -typedef enum LDKCOption_HTLCClaimZ_Tag { +typedef enum LDKCOption_DurationZ_Tag { /** - * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim + * When we're in this state, this COption_DurationZ contains a u64 */ - LDKCOption_HTLCClaimZ_Some, + LDKCOption_DurationZ_Some, /** - * When we're in this state, this COption_HTLCClaimZ contains nothing + * When we're in this state, this COption_DurationZ contains nothing */ - LDKCOption_HTLCClaimZ_None, + LDKCOption_DurationZ_None, /** * Must be last for serialization purposes */ - LDKCOption_HTLCClaimZ_Sentinel, -} LDKCOption_HTLCClaimZ_Tag; + LDKCOption_DurationZ_Sentinel, +} LDKCOption_DurationZ_Tag; -typedef struct LDKCOption_HTLCClaimZ { - LDKCOption_HTLCClaimZ_Tag tag; +typedef struct LDKCOption_DurationZ { + LDKCOption_DurationZ_Tag tag; union { struct { - enum LDKHTLCClaim some; + uint64_t some; }; }; -} LDKCOption_HTLCClaimZ; +} LDKCOption_DurationZ; + + /** - * The contents of CResult_NoneNoneZ + * Onion messages and payments can be sent and received to blinded paths, which serve to hide the + * identity of the recipient. */ -typedef union LDKCResult_NoneNoneZPtr { +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. + */ + 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; +} LDKBlindedPath; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_BlindedPathZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKBlindedPath *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_BlindedPathZ; + +/** + * An enum which can either contain a u64 or not + */ +typedef enum LDKCOption_u64Z_Tag { + /** + * When we're in this state, this COption_u64Z contains a u64 + */ + LDKCOption_u64Z_Some, + /** + * When we're in this state, this COption_u64Z contains nothing + */ + LDKCOption_u64Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u64Z_Sentinel, +} LDKCOption_u64Z_Tag; + +typedef struct LDKCOption_u64Z { + LDKCOption_u64Z_Tag tag; + union { + struct { + uint64_t some; + }; + }; +} LDKCOption_u64Z; + + + +/** + * 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; + +/** + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) + */ +typedef enum LDKAPIError_Tag { + /** + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. + */ + LDKAPIError_APIMisuseError, + /** + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. + */ + LDKAPIError_FeeRateTooHigh, + /** + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). + */ + LDKAPIError_InvalidRoute, + /** + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call [`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 + */ + LDKAPIError_MonitorUpdateInProgress, + /** + * [`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 + */ + LDKAPIError_IncompatibleShutdownScript, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + /** + * A human-readable error message + */ + struct LDKStr err; + /** + * The feerate which was too high. + */ + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKInvalidRoute_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKInvalidRoute_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + /** + * The incompatible shutdown script. + */ + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKInvalidRoute_Body invalid_route; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + }; +} LDKAPIError; + +/** + * The contents of CResult_NoneAPIErrorZ + */ +typedef union LDKCResult_NoneAPIErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ void *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_NoneNoneZPtr; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; /** - * A CResult_NoneNoneZ represents the result of a fallible operation, - * containing a () on success and a () 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_NoneNoneZ { +typedef struct LDKCResult_NoneAPIErrorZ { /** - * The contents of this CResult_NoneNoneZ, accessible via either + * The contents of this CResult_NoneAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneNoneZPtr contents; + union LDKCResult_NoneAPIErrorZPtr contents; /** - * Whether this CResult_NoneNoneZ represents a success state. + * Whether this CResult_NoneAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneNoneZ; +} LDKCResult_NoneAPIErrorZ; +/** + * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKCResult_NoneAPIErrorZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; +/** + * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_APIErrorZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKAPIError *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_APIErrorZ; /** - * Implements the per-commitment secret storage scheme from - * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not + */ +typedef enum LDKCOption_CVec_u8ZZ_Tag { + /** + * When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z + */ + LDKCOption_CVec_u8ZZ_Some, + /** + * When we're in this state, this COption_CVec_u8ZZ contains nothing + */ + LDKCOption_CVec_u8ZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_CVec_u8ZZ_Sentinel, +} LDKCOption_CVec_u8ZZ_Tag; + +typedef struct LDKCOption_CVec_u8ZZ { + LDKCOption_CVec_u8ZZ_Tag tag; + union { + struct { + struct LDKCVec_u8Z some; + }; + }; +} LDKCOption_CVec_u8ZZ; + + + +/** + * Information which is provided, encrypted, to the payment recipient when sending HTLCs. * - * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes - * or so. + * This should generally be constructed with data communicated to us from the recipient (via a + * BOLT11 or BOLT12 invoice). */ -typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { +typedef struct MUST_USE_STRUCT LDKRecipientOnionFields { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeCounterpartyCommitmentSecrets *inner; + LDKnativeRecipientOnionFields *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; -} LDKCounterpartyCommitmentSecrets; +} LDKRecipientOnionFields; /** * An error in decoding a message or struct. @@ -779,29 +1145,32 @@ typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { typedef enum LDKDecodeError_Tag { /** * A version byte specified something we don't know how to handle. - * Includes unknown realm byte in an OnionHopData packet + * + * Includes unknown realm byte in an onion hop data packet. */ LDKDecodeError_UnknownVersion, /** - * Unknown feature mandating we fail to parse message (eg TLV with an even, unknown type) + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) */ LDKDecodeError_UnknownRequiredFeature, /** - * Value was invalid, eg a byte which was supposed to be a bool was something other than a 0 + * 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 + * syntactically incorrect, etc. */ LDKDecodeError_InvalidValue, /** - * Buffer too short + * The buffer to be read was too short. */ LDKDecodeError_ShortRead, /** - * A length descriptor in the packet didn't describe the later data correctly + * A length descriptor in the packet didn't describe the later data correctly. */ LDKDecodeError_BadLengthDescriptor, /** - * Error from std::io + * Error from [`std::io`]. */ LDKDecodeError_Io, /** @@ -823,6 +1192,121 @@ typedef struct MUST_USE_STRUCT LDKDecodeError { }; } LDKDecodeError; +/** + * The contents of CResult_RecipientOnionFieldsDecodeErrorZ + */ +typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRecipientOnionFields *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_RecipientOnionFieldsDecodeErrorZPtr; + +/** + * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RecipientOnionFieldsDecodeErrorZ { + /** + * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents; + /** + * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RecipientOnionFieldsDecodeErrorZ; + +/** + * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not + */ +typedef enum LDKCOption_HTLCClaimZ_Tag { + /** + * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim + */ + LDKCOption_HTLCClaimZ_Some, + /** + * When we're in this state, this COption_HTLCClaimZ contains nothing + */ + 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 + */ +typedef union LDKCResult_NoneNoneZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_NoneNoneZPtr; + +/** + * A CResult_NoneNoneZ represents the result of a fallible operation, + * containing a () on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneNoneZ { + /** + * The contents of this CResult_NoneNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneNoneZPtr contents; + /** + * Whether this CResult_NoneNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneNoneZ; + + + +/** + * Implements the per-commitment secret storage scheme from + * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * + * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes + * or so. + */ +typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCounterpartyCommitmentSecrets *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; +} LDKCounterpartyCommitmentSecrets; + /** * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ */ @@ -1500,28 +1984,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 */ @@ -1608,171 +2070,58 @@ 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; - -/** - * 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 paths, which serve to hide the identity of - * the recipient. - */ -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. - */ - 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; -} LDKBlindedPath; - -/** - * The contents of CResult_BlindedPathNoneZ - */ -typedef union LDKCResult_BlindedPathNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBlindedPath *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_BlindedPathNoneZPtr; - -/** - * 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 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. + * Information needed to route a payment across a [`BlindedPath`]. */ -typedef struct MUST_USE_STRUCT LDKBlindedHop { +typedef struct MUST_USE_STRUCT LDKBlindedPayInfo { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeBlindedPayInfo *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; +} LDKBlindedPayInfo; /** - * The contents of CResult_BlindedHopDecodeErrorZ + * The contents of CResult_BlindedPayInfoDecodeErrorZ */ -typedef union LDKCResult_BlindedHopDecodeErrorZPtr { +typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedHop *result; + struct LDKBlindedPayInfo *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; +} LDKCResult_BlindedPayInfoDecodeErrorZPtr; /** - * 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. + * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::BlindedPayInfo 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 { +typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ { /** - * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either + * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedHopDecodeErrorZPtr contents; + union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedHopDecodeErrorZ; +} LDKCResult_BlindedPayInfoDecodeErrorZ; @@ -1817,38 +2166,23 @@ typedef struct MUST_USE_STRUCT LDKChannelUsage { /** - * A hop in a route + * A path in a [`Route`] to the payment recipient. Must always be at least length one. + * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19. */ -typedef struct MUST_USE_STRUCT LDKRouteHop { +typedef struct MUST_USE_STRUCT LDKPath { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativePath *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(). - */ - struct LDKRouteHop *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_RouteHopZ; +} LDKPath; /** * An interface used to score payment channels for path finding. @@ -1875,19 +2209,19 @@ typedef struct LDKScore { /** * Handles updating channel penalties after failing to route through a channel. */ - void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); /** * Handles updating channel penalties after successfully routing along a path. */ - void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); + void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); /** * Handles updating channel penalties after a probe over the given path failed. */ - void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); /** * Handles updating channel penalties after a probe over the given path succeeded. */ - void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); + void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); /** * Serialize the object into a byte array */ @@ -2015,7 +2349,7 @@ typedef struct LDKCResult_NoneErrorZ { /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] */ typedef struct MUST_USE_STRUCT LDKChannelDetails { /** @@ -2122,33 +2456,6 @@ typedef struct LDKCResult_RouteLightningErrorZ { bool result_ok; } 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; - /** @@ -2203,6 +2510,27 @@ typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ { bool result_ok; } LDKCResult_InFlightHtlcsDecodeErrorZ; + + +/** + * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel + * that leads to it. + */ +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; + /** * The contents of CResult_RouteHopDecodeErrorZ */ @@ -2236,21 +2564,130 @@ typedef struct LDKCResult_RouteHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHopDecodeErrorZ; + + +/** + * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified + * by outside observers and thus can be used to hide the identity of the recipient. + */ +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; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_BlindedHopZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKBlindedHop *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_BlindedHopZ; + + + +/** + * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in + * their BOLT12 [`Invoice`]. + * + * [`Invoice`]: crate::offers::invoice::Invoice + */ +typedef struct MUST_USE_STRUCT LDKBlindedTail { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedTail *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; +} LDKBlindedTail; + +/** + * The contents of CResult_BlindedTailDecodeErrorZ + */ +typedef union LDKCResult_BlindedTailDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedTail *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_BlindedTailDecodeErrorZPtr; + +/** + * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::BlindedTail 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_BlindedTailDecodeErrorZ { + /** + * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedTailDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedTailDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedTailDecodeErrorZ; + +/** + * 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(). + */ + struct LDKRouteHop *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_RouteHopZ; + /** - * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. + * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_CVec_RouteHopZZ { +typedef struct LDKCVec_PathZ { /** * 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 LDKPath *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_CVec_RouteHopZZ; +} LDKCVec_PathZ; /** * The contents of CResult_RouteDecodeErrorZ @@ -2291,9 +2728,9 @@ typedef struct 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`]. * - * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed */ typedef struct MUST_USE_STRUCT LDKRouteParameters { /** @@ -2343,42 +2780,6 @@ typedef struct LDKCResult_RouteParametersDecodeErrorZ { 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. * This corresponds to std::vector in C++ @@ -2448,6 +2849,72 @@ typedef struct LDKCResult_PaymentParametersDecodeErrorZ { bool result_ok; } LDKCResult_PaymentParametersDecodeErrorZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ { + /** + * The element at position 0 + */ + struct LDKBlindedPayInfo a; + /** + * The element at position 1 + */ + struct LDKBlindedPath b; +} LDKC2Tuple_BlindedPayInfoBlindedPathZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ; + + + +/** + * 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; + /** @@ -2551,714 +3018,837 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { } LDKCResult_RouteHintHopDecodeErrorZ; /** - * 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. + * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. */ -typedef enum LDKPaymentPurpose_Tag { +typedef struct LDKPublicKey { /** - * Information for receiving a payment that we generated an invoice for. + * The bytes of the public key */ - LDKPaymentPurpose_InvoicePayment, + 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 { /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKPaymentPurpose_SpontaneousPayment, + struct LDKPublicKey *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKPaymentPurpose_Sentinel, -} LDKPaymentPurpose_Tag; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; -typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_usizeTransactionZ { /** - * The preimage to the payment_hash, if the payment hash (and secret) were fetched via - * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to - * [`ChannelManager::claim_funds`]. - * - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The element at position 0 */ - struct LDKThirtyTwoBytes payment_preimage; + uintptr_t a; /** - * The \"payment secret\". This authenticates the sender to the recipient, preventing a - * number of deanonymization attacks during the routing process. - * It is provided here for your reference, however its accuracy is enforced directly by - * [`ChannelManager`] using the values you previously provided to - * [`ChannelManager::create_inbound_payment`] or - * [`ChannelManager::create_inbound_payment_for_hash`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash + * The element at position 1 */ - struct LDKThirtyTwoBytes payment_secret; -} LDKPaymentPurpose_LDKInvoicePayment_Body; + struct LDKTransaction b; +} LDKC2Tuple_usizeTransactionZ; -typedef struct MUST_USE_STRUCT LDKPaymentPurpose { - LDKPaymentPurpose_Tag tag; - union { - LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; - struct { - struct LDKThirtyTwoBytes spontaneous_payment; - }; - }; -} LDKPaymentPurpose; +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_usizeTransactionZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_usizeTransactionZZ; /** - * The contents of CResult_PaymentPurposeDecodeErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr { +typedef struct LDKC2Tuple_TxidBlockHashZ { /** - * 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 LDKPaymentPurpose *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 */ - struct LDKDecodeError *err; -} LDKCResult_PaymentPurposeDecodeErrorZPtr; + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_TxidBlockHashZ; /** - * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { +typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ { /** - * The contents of this CResult_PaymentPurposeDecodeErrorZ, 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_PaymentPurposeDecodeErrorZPtr contents; + struct LDKC2Tuple_TxidBlockHashZ *data; /** - * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_PaymentPurposeDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidBlockHashZZ; + + /** - * The reason the channel was closed. See individual variants more details. + * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on + * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the + * preimage claim backward will lead to loss of funds. */ -typedef enum LDKClosureReason_Tag { +typedef struct MUST_USE_STRUCT LDKHTLCUpdate { /** - * 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, + LDKnativeHTLCUpdate *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; +} LDKHTLCUpdate; + + + +/** + * 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 { /** - * The channel was closed after negotiating a cooperative close and we've now broadcasted - * the cooperative close transaction. Note the shutdown may have been initiated by us. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKClosureReason_CooperativeClosure, + LDKnativeOutPoint *inner; /** - * A commitment transaction was confirmed on chain, closing the channel. Most likely this - * commitment transaction came from our counterparty, but it may also have come from - * a copy of our own `ChannelMonitor`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKClosureReason_CommitmentTxConfirmed, + bool is_owned; +} LDKOutPoint; + +/** + * An event to be processed by the ChannelManager. + */ +typedef enum LDKMonitorEvent_Tag { /** - * The funding transaction failed to confirm in a timely manner on an inbound channel. + * A monitor event containing an HTLCUpdate. */ - LDKClosureReason_FundingTimedOut, + LDKMonitorEvent_HTLCEvent, /** - * Closure generated from processing an event, likely a HTLC forward/relay/reception. + * A monitor event that the Channel's commitment transaction was confirmed. */ - LDKClosureReason_ProcessingError, + LDKMonitorEvent_CommitmentTxConfirmed, /** - * 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. + * Indicates a [`ChannelMonitor`] update has completed. See + * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ - LDKClosureReason_DisconnectedPeer, + LDKMonitorEvent_Completed, /** - * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than - * the [`ChannelManager`] deserialized. + * Indicates a [`ChannelMonitor`] update has failed. See + * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used. * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure */ - LDKClosureReason_OutdatedChannelManager, + LDKMonitorEvent_UpdateFailed, /** * Must be last for serialization purposes */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; + LDKMonitorEvent_Sentinel, +} LDKMonitorEvent_Tag; -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { +typedef struct LDKMonitorEvent_LDKCompleted_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 funding outpoint of the [`ChannelMonitor`] that was updated */ - struct LDKStr peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { + struct LDKOutPoint funding_txo; /** - * A developer-readable error message which we generated. + * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or + * [`ChannelMonitor::get_latest_update_id`]. + * + * Note that this should only be set to a given update's ID if all previous updates for the + * same [`ChannelMonitor`] have been applied and persisted. */ - struct LDKStr err; -} LDKClosureReason_LDKProcessingError_Body; + uint64_t monitor_update_id; +} LDKMonitorEvent_LDKCompleted_Body; -typedef struct MUST_USE_STRUCT LDKClosureReason { - LDKClosureReason_Tag tag; +typedef struct MUST_USE_STRUCT LDKMonitorEvent { + LDKMonitorEvent_Tag tag; union { - LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; - LDKClosureReason_LDKProcessingError_Body processing_error; + struct { + struct LDKHTLCUpdate htlc_event; + }; + struct { + struct LDKOutPoint commitment_tx_confirmed; + }; + LDKMonitorEvent_LDKCompleted_Body completed; + struct { + struct LDKOutPoint update_failed; + }; }; -} LDKClosureReason; +} LDKMonitorEvent; /** - * An enum which can either contain a crate::lightning::util::events::ClosureReason or not + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_ClosureReasonZ_Tag { - /** - * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason - */ - LDKCOption_ClosureReasonZ_Some, +typedef struct LDKCVec_MonitorEventZ { /** - * When we're in this state, this COption_ClosureReasonZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_ClosureReasonZ_None, + struct LDKMonitorEvent *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_ClosureReasonZ_Sentinel, -} LDKCOption_ClosureReasonZ_Tag; - -typedef struct LDKCOption_ClosureReasonZ { - LDKCOption_ClosureReasonZ_Tag tag; - union { - struct { - struct LDKClosureReason some; - }; - }; -} LDKCOption_ClosureReasonZ; + uintptr_t datalen; +} LDKCVec_MonitorEventZ; /** - * The contents of CResult_COption_ClosureReasonZDecodeErrorZ + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr { +typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { /** - * 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 LDKCOption_ClosureReasonZ *result; + struct LDKOutPoint 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 */ - struct LDKDecodeError *err; -} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; + struct LDKCVec_MonitorEventZ b; + /** + * The element at position 2 + */ + struct LDKPublicKey c; +} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; /** - * 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`. + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { +typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { /** - * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, 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_COption_ClosureReasonZDecodeErrorZPtr contents; + struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data; /** - * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; + + /** - * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + * [`Score`] implementation that uses a fixed penalty. */ -typedef enum LDKHTLCDestination_Tag { - /** - * We tried forwarding to a channel but failed to do so. An example of such an instance is when - * there is insufficient capacity in our outbound channel. - */ - LDKHTLCDestination_NextHopChannel, +typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { /** - * Scenario where we are unsure of the next node to forward the HTLC to. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKHTLCDestination_UnknownNextHop, + LDKnativeFixedPenaltyScorer *inner; /** - * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate - * intercept HTLC. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKHTLCDestination_InvalidForward, + bool is_owned; +} LDKFixedPenaltyScorer; + +/** + * The contents of CResult_FixedPenaltyScorerDecodeErrorZ + */ +typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr { /** - * Failure scenario where an HTLC may have been forwarded to be intended for us, - * but is invalid for some reason, so we reject it. - * - * Some of the reasons may include: - * * HTLC Timeouts - * * Expected MPP amount to claim does not equal HTLC total - * * Claimable amount does not match expected amount + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKHTLCDestination_FailedPayment, + struct LDKFixedPenaltyScorer *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKHTLCDestination_Sentinel, -} LDKHTLCDestination_Tag; + struct LDKDecodeError *err; +} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr; -typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { - /** - * The `node_id` of the next node. For backwards compatibility, this field is - * marked as optional, versions prior to 0.0.110 may not always be able to provide - * counterparty node information. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKPublicKey node_id; +/** + * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::FixedPenaltyScorer 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_FixedPenaltyScorerDecodeErrorZ { /** - * The outgoing `channel_id` between us and the next node. + * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes channel_id; -} LDKHTLCDestination_LDKNextHopChannel_Body; - -typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { + union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents; /** - * Short channel id we are requesting to forward an HTLC to. + * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. */ - uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKUnknownNextHop_Body; + bool result_ok; +} LDKCResult_FixedPenaltyScorerDecodeErrorZ; -typedef struct LDKHTLCDestination_LDKInvalidForward_Body { +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64u64Z { /** - * Short channel id we are requesting to forward an HTLC to. + * The element at position 0 */ - uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKInvalidForward_Body; - -typedef struct LDKHTLCDestination_LDKFailedPayment_Body { + uint64_t a; /** - * The payment hash of the payment we attempted to process. + * The element at position 1 */ - struct LDKThirtyTwoBytes payment_hash; -} LDKHTLCDestination_LDKFailedPayment_Body; - -typedef struct MUST_USE_STRUCT LDKHTLCDestination { - LDKHTLCDestination_Tag tag; - union { - LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; - LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; - LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; - LDKHTLCDestination_LDKFailedPayment_Body failed_payment; - }; -} LDKHTLCDestination; + uint64_t b; +} LDKC2Tuple_u64u64Z; /** - * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not */ -typedef enum LDKCOption_HTLCDestinationZ_Tag { +typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { /** - * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z */ - LDKCOption_HTLCDestinationZ_Some, + LDKCOption_C2Tuple_u64u64ZZ_Some, /** - * When we're in this state, this COption_HTLCDestinationZ contains nothing + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing */ - LDKCOption_HTLCDestinationZ_None, + LDKCOption_C2Tuple_u64u64ZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_HTLCDestinationZ_Sentinel, -} LDKCOption_HTLCDestinationZ_Tag; + LDKCOption_C2Tuple_u64u64ZZ_Sentinel, +} LDKCOption_C2Tuple_u64u64ZZ_Tag; -typedef struct LDKCOption_HTLCDestinationZ { - LDKCOption_HTLCDestinationZ_Tag tag; +typedef struct LDKCOption_C2Tuple_u64u64ZZ { + LDKCOption_C2Tuple_u64u64ZZ_Tag tag; union { struct { - struct LDKHTLCDestination some; + struct LDKC2Tuple_u64u64Z some; }; }; -} LDKCOption_HTLCDestinationZ; +} LDKCOption_C2Tuple_u64u64ZZ; /** - * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + * 8 u16s */ -typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { +typedef struct LDKEightU16s { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The eight 16-bit integers */ - struct LDKCOption_HTLCDestinationZ *result; + uint16_t data[8]; +} LDKEightU16s; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_Z { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The element at position 0 */ - struct LDKDecodeError *err; -} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr; + struct LDKEightU16s a; + /** + * The element at position 1 + */ + struct LDKEightU16s b; +} LDKC2Tuple_Z; /** - * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { +typedef struct LDKC2Tuple__u168_u168Z { /** - * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The element at position 0 */ - union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; + struct LDKEightU16s a; /** - * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + * The element at position 1 */ - bool result_ok; -} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; + struct LDKEightU16s b; +} LDKC2Tuple__u168_u168Z; /** - * An enum which can either contain a crate::c_types::U128 or not + * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not */ -typedef enum LDKCOption_u128Z_Tag { +typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag { /** - * When we're in this state, this COption_u128Z contains a crate::c_types::U128 + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z */ - LDKCOption_u128Z_Some, + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some, /** - * When we're in this state, this COption_u128Z contains nothing + * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing */ - LDKCOption_u128Z_None, + LDKCOption_C2Tuple_EightU16sEightU16sZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_u128Z_Sentinel, -} LDKCOption_u128Z_Tag; + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel, +} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag; -typedef struct LDKCOption_u128Z { - LDKCOption_u128Z_Tag tag; +typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ { + LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag; union { struct { - struct LDKU128 some; + struct LDKC2Tuple__u168_u168Z some; }; }; -} LDKCOption_u128Z; +} LDKCOption_C2Tuple_EightU16sEightU16sZZ; + +/** + * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_NodeIdZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKNodeId *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_NodeIdZ; /** - * A channel_update message to be sent or received from a peer + * A Record, unit of logging output with Metadata to enable filtering + * Module_path, file, line to inform on log's source */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef struct MUST_USE_STRUCT LDKRecord { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelUpdate *inner; + LDKnativeRecord *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelUpdate; +} LDKRecord; /** - * 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 + * A trait encapsulating the operations required of a logger */ -typedef enum LDKNetworkUpdate_Tag { +typedef struct LDKLogger { /** - * An error indicating a `channel_update` messages should be applied via - * [`NetworkGraph::update_channel`]. + * 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. */ - LDKNetworkUpdate_ChannelUpdateMessage, + void *this_arg; /** - * An error indicating that a channel failed to route a payment, which should be applied via - * [`NetworkGraph::channel_failed`]. + * Logs the `Record` */ - LDKNetworkUpdate_ChannelFailure, + void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); /** - * An error indicating that a node failed to route a payment, which should be applied via - * [`NetworkGraph::node_failed_permanent`] if permanent. + * 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. */ - LDKNetworkUpdate_NodeFailure, + void (*free)(void *this_arg); +} LDKLogger; + + + +/** + * Represents the network as nodes and channels between them + */ +typedef struct MUST_USE_STRUCT LDKNetworkGraph { /** - * Must be last for serialization purposes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKNetworkUpdate_Sentinel, -} LDKNetworkUpdate_Tag; - -typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { + LDKnativeNetworkGraph *inner; /** - * The update to apply via [`NetworkGraph::update_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. */ - struct LDKChannelUpdate msg; -} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + bool is_owned; +} LDKNetworkGraph; -typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { + + +/** + * [`Score`] implementation using channel success probability distributions. + * + * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel, + * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC. + * When a payment is forwarded through a channel (but fails later in the route), we learn the + * lower-bound on the channel's available liquidity must be at least the value of the HTLC. + * + * These bounds are then used to determine a success probability using the formula from + * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt + * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`). + * + * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and + * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in + * milli-satoshis. The penalties, when added across all hops, have the property of being linear in + * terms of the entire path's success probability. This allows the router to directly compare + * penalties for different paths. See the documentation of those parameters for the exact formulas. + * + * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`]. + * + * Further, we track the history of our upper and lower liquidity bounds for each channel, + * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`] + * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability + * formula, but using the history of a channel rather than our latest estimates for the liquidity + * bounds. + * + * # Note + * + * Mixing the `no-std` feature between serialization and deserialization results in undefined + * behavior. + * + * [1]: https://arxiv.org/abs/2107.05322 + * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat + * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life + * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat + * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat + */ +typedef struct MUST_USE_STRUCT LDKProbabilisticScorer { /** - * The short channel id of the closed channel. + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 short_channel_id; + LDKnativeProbabilisticScorer *inner; /** - * Whether the channel should be permanently removed or temporarily disabled until a new - * `channel_update` message is received. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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_permanent; -} LDKNetworkUpdate_LDKChannelFailure_Body; + bool is_owned; +} LDKProbabilisticScorer; -typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { +/** + * The contents of CResult_ProbabilisticScorerDecodeErrorZ + */ +typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr { /** - * The node id of the failed node. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPublicKey node_id; + struct LDKProbabilisticScorer *result; /** - * Whether the node should be permanently removed from consideration or can be restored - * when a new `channel_update` message is received. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - 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; + struct LDKDecodeError *err; +} LDKCResult_ProbabilisticScorerDecodeErrorZPtr; /** - * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not + * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::ProbabilisticScorer 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 enum LDKCOption_NetworkUpdateZ_Tag { - /** - * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate - */ - LDKCOption_NetworkUpdateZ_Some, +typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ { /** - * When we're in this state, this COption_NetworkUpdateZ contains nothing + * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_NetworkUpdateZ_None, + union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state. */ - LDKCOption_NetworkUpdateZ_Sentinel, -} LDKCOption_NetworkUpdateZ_Tag; - -typedef struct LDKCOption_NetworkUpdateZ { - LDKCOption_NetworkUpdateZ_Tag tag; - union { - struct { - struct LDKNetworkUpdate some; - }; - }; -} LDKCOption_NetworkUpdateZ; + bool result_ok; +} LDKCResult_ProbabilisticScorerDecodeErrorZ; /** - * 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. + * Features used within an `init` message. */ -typedef struct MUST_USE_STRUCT LDKOutPoint { +typedef struct MUST_USE_STRUCT LDKInitFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeOutPoint *inner; + LDKnativeInitFeatures *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKOutPoint; +} LDKInitFeatures; + +/** + * The contents of CResult_InitFeaturesDecodeErrorZ + */ +typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInitFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_InitFeaturesDecodeErrorZPtr; + +/** + * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InitFeaturesDecodeErrorZ { + /** + * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InitFeaturesDecodeErrorZ; /** - * Information about a spendable output to a P2WSH script. - * - * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this. + * Features used within a `channel_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { +typedef struct MUST_USE_STRUCT LDKChannelFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDelayedPaymentOutputDescriptor *inner; + LDKnativeChannelFeatures *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKDelayedPaymentOutputDescriptor; +} LDKChannelFeatures; + +/** + * The contents of CResult_ChannelFeaturesDecodeErrorZ + */ +typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ChannelFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { + /** + * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelFeaturesDecodeErrorZ; /** - * Information about a spendable output to our \"payment key\". - * - * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. + * Features used within a `node_announcement` message. */ -typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { +typedef struct MUST_USE_STRUCT LDKNodeFeatures { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeStaticPaymentOutputDescriptor *inner; + LDKnativeNodeFeatures *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKStaticPaymentOutputDescriptor; +} LDKNodeFeatures; /** - * 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 + * The contents of CResult_NodeFeaturesDecodeErrorZ */ -typedef enum LDKSpendableOutputDescriptor_Tag { +typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { /** - * 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 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`]: KeysInterface::get_shutdown_scriptpubkey - * [`get_destination_script`]: KeysInterface::get_shutdown_scriptpubkey + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKSpendableOutputDescriptor_StaticOutput, + struct LDKNodeFeatures *result; /** - * 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 - * [`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 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 [`BaseSign::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 [`BaseSign::pubkeys`]. - * - * 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 - * [`BaseSign::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 [`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`]. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKSpendableOutputDescriptor_DelayedPaymentOutput, + struct LDKDecodeError *err; +} LDKCResult_NodeFeaturesDecodeErrorZPtr; + +/** + * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { /** - * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key - * which corresponds to the `payment_point` in [`BaseSign::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. + * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKSpendableOutputDescriptor_StaticPaymentOutput, + union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. */ - LDKSpendableOutputDescriptor_Sentinel, -} LDKSpendableOutputDescriptor_Tag; + bool result_ok; +} LDKCResult_NodeFeaturesDecodeErrorZ; -typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { + + +/** + * Features used within an invoice. + */ +typedef struct MUST_USE_STRUCT LDKInvoiceFeatures { /** - * The outpoint which is spendable. + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 LDKOutPoint outpoint; + LDKnativeInvoiceFeatures *inner; /** - * The output which is referenced by the given outpoint. + * Indicates that this is the only struct which contains the same pointer. + * Rust 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 LDKTxOut output; -} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; + bool is_owned; +} LDKInvoiceFeatures; -typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { - LDKSpendableOutputDescriptor_Tag tag; - union { - LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; - struct { - struct LDKDelayedPaymentOutputDescriptor delayed_payment_output; - }; - struct { - struct LDKStaticPaymentOutputDescriptor static_payment_output; - }; - }; -} LDKSpendableOutputDescriptor; +/** + * The contents of CResult_InvoiceFeaturesDecodeErrorZ + */ +typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_InvoiceFeaturesDecodeErrorZPtr; /** - * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_SpendableOutputDescriptorZ { +typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ { /** - * 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_InvoiceFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKSpendableOutputDescriptor *data; + union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_SpendableOutputDescriptorZ; + 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; @@ -3290,2467 +3880,2700 @@ typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures { } LDKChannelTypeFeatures; /** - * An Event which you should probably take some action in response to. - * - * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use - * them directly as they don't round-trip exactly (for example FundingGenerationReady is never - * written as it makes no sense to respond to it after reconnecting to peers). + * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ */ -typedef enum LDKEvent_Tag { +typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr { /** - * Used to indicate that the client should generate a funding transaction with the given - * parameters and then call [`ChannelManager::funding_transaction_generated`]. - * Generated in [`ChannelManager`] message handling. - * Note that *all inputs* in the funding transaction must spend SegWit outputs or your - * counterparty can steal your funds! - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_FundingGenerationReady, + struct LDKChannelTypeFeatures *result; /** - * 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 - * automatically failed. - * - * # Note - * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `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 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_PaymentClaimable, + struct LDKDecodeError *err; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { /** - * 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::PaymentClaimable`]. However, if we previously crashed during a - * [`ChannelManager::claim_funds`] call you may see this event without a corresponding - * [`Event::PaymentClaimable`] event. - * - * # Note - * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `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 + * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_PaymentClaimed, + union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents; /** - * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target - * and we got back the payment preimage for it). - * - * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed` - * event. In this situation, you SHOULD treat this payment as having succeeded. + * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. */ - LDKEvent_PaymentSent, + bool result_ok; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZ; + +/** + * 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 { /** - * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events - * provide failure information for each MPP part in the payment. - * - * This event is provided once there are no further pending HTLCs for the payment and the - * payment is no longer retryable due to [`ChannelManager::abandon_payment`] having been - * called for the corresponding payment. - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * Information for receiving a payment that we generated an invoice for. */ - LDKEvent_PaymentFailed, + LDKPaymentPurpose_InvoicePayment, /** - * Indicates that a path for an outbound payment was successful. - * - * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See - * [`Event::PaymentSent`] for obtaining the payment preimage. + * Because this is a spontaneous payment, the payer generated their own preimage rather than us + * (the payee) providing a preimage. */ - LDKEvent_PaymentPathSuccessful, + LDKPaymentPurpose_SpontaneousPayment, /** - * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped - * something. You may wish to retry with a different route. - * - * If you have given up retrying this payment and wish to fail it, you MUST call - * [`ChannelManager::abandon_payment`] at least once for a given [`PaymentId`] or memory - * related to payment tracking will leak. - * - * Note that this does *not* indicate that all paths for an MPP payment have failed, see - * [`Event::PaymentFailed`] and [`all_paths_failed`]. - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed + * Must be last for serialization purposes */ - LDKEvent_PaymentPathFailed, + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; + +typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { /** - * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. + * The preimage to the payment_hash, if the payment hash (and secret) were fetched via + * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to + * [`ChannelManager::claim_funds`]. + * + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKEvent_ProbeSuccessful, + struct LDKThirtyTwoBytes payment_preimage; /** - * Indicates that a probe payment we sent failed at an intermediary node on the path. + * The \"payment secret\". This authenticates the sender to the recipient, preventing a + * number of deanonymization attacks during the routing process. + * It is provided here for your reference, however its accuracy is enforced directly by + * [`ChannelManager`] using the values you previously provided to + * [`ChannelManager::create_inbound_payment`] or + * [`ChannelManager::create_inbound_payment_for_hash`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash */ - LDKEvent_ProbeFailed, + struct LDKThirtyTwoBytes payment_secret; +} LDKPaymentPurpose_LDKInvoicePayment_Body; + +typedef struct MUST_USE_STRUCT LDKPaymentPurpose { + LDKPaymentPurpose_Tag tag; + union { + LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; + struct { + struct LDKThirtyTwoBytes spontaneous_payment; + }; + }; +} LDKPaymentPurpose; + +/** + * The contents of CResult_PaymentPurposeDecodeErrorZ + */ +typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr { /** - * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at - * a time in the future. - * - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKEvent_PendingHTLCsForwardable, + struct LDKPaymentPurpose *result; /** - * 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 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKEvent_HTLCIntercepted, + struct LDKDecodeError *err; +} LDKCResult_PaymentPurposeDecodeErrorZPtr; + +/** + * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::PaymentPurpose 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_PaymentPurposeDecodeErrorZ { /** - * Used to indicate that an output which you should know how to spend was confirmed on chain - * and is now spendable. - * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your - * counterparty spending them due to some kind of timeout. Thus, you need to store them - * somewhere and spend them when you create on-chain transactions. + * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKEvent_SpendableOutputs, + union LDKCResult_PaymentPurposeDecodeErrorZPtr contents; /** - * This event is generated when a payment has been successfully forwarded through us and a - * forwarding fee earned. + * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. */ - LDKEvent_PaymentForwarded, + bool result_ok; +} LDKCResult_PaymentPurposeDecodeErrorZ; + + + +/** + * 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 struct MUST_USE_STRUCT LDKChannelUpdate { /** - * 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. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKEvent_ChannelReady, + LDKnativeChannelUpdate *inner; /** - * Used to indicate that a previously opened channel with the given `channel_id` is in the - * process of closure. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKEvent_ChannelClosed, + 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 { /** - * Used to indicate to the user that they can abandon the funding transaction and recycle the - * inputs for another purpose. + * An error indicating a `channel_update` messages should be applied via + * [`NetworkGraph::update_channel`]. */ - LDKEvent_DiscardFunding, + LDKNetworkUpdate_ChannelUpdateMessage, /** - * Indicates a request to open a new channel by a peer. - * - * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the - * request, call [`ChannelManager::force_close_without_broadcasting_txn`]. - * - * The event is only triggered when a new open channel request is received and the - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * An error indicating that a channel failed to route a payment, which should be applied via + * [`NetworkGraph::channel_failed_permanent`] if permanent. */ - LDKEvent_OpenChannelRequest, + LDKNetworkUpdate_ChannelFailure, /** - * Indicates that the HTLC was accepted, but could not be processed when or after attempting to - * forward it. - * - * Some scenarios where this event may be sent include: - * * Insufficient capacity in the outbound channel - * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes - * * When an unknown SCID is requested for forwarding a payment. - * * Claiming an amount for an MPP payment that exceeds the HTLC total - * * The HTLC has timed out - * - * This event, however, does not get generated if an HTLC fails to meet the forwarding - * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). + * An error indicating that a node failed to route a payment, which should be applied via + * [`NetworkGraph::node_failed_permanent`] if permanent. */ - LDKEvent_HTLCHandlingFailed, + LDKNetworkUpdate_NodeFailure, /** * Must be last for serialization purposes */ - LDKEvent_Sentinel, -} LDKEvent_Tag; + LDKNetworkUpdate_Sentinel, +} LDKNetworkUpdate_Tag; -typedef struct LDKEvent_LDKFundingGenerationReady_Body { +typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { /** - * The random channel_id we picked which you'll need to pass into - * [`ChannelManager::funding_transaction_generated`]. - * - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * The update to apply via [`NetworkGraph::update_channel`]. */ - struct LDKThirtyTwoBytes temporary_channel_id; + struct LDKChannelUpdate msg; +} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + +typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { /** - * The counterparty's node_id, which you'll need to pass back into - * [`ChannelManager::funding_transaction_generated`]. - * - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * The short channel id of the closed channel. */ - struct LDKPublicKey counterparty_node_id; + uint64_t short_channel_id; /** - * The value, in satoshis, that the output should have. + * Whether the channel should be permanently removed or temporarily disabled until a new + * `channel_update` message is received. */ - uint64_t channel_value_satoshis; + bool is_permanent; +} LDKNetworkUpdate_LDKChannelFailure_Body; + +typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { /** - * The script which should be used in the transaction output. + * The node id of the failed node. */ - struct LDKCVec_u8Z output_script; + struct LDKPublicKey node_id; /** - * 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 + * Whether the node should be permanently removed from consideration or can be restored + * when a new `channel_update` message is received. */ - struct LDKU128 user_channel_id; -} LDKEvent_LDKFundingGenerationReady_Body; + bool is_permanent; +} LDKNetworkUpdate_LDKNodeFailure_Body; -typedef struct LDKEvent_LDKPaymentClaimable_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 { /** - * 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 + * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate */ - struct LDKPublicKey receiver_node_id; + LDKCOption_NetworkUpdateZ_Some, /** - * 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. + * When we're in this state, this COption_NetworkUpdateZ contains nothing */ - struct LDKThirtyTwoBytes payment_hash; + LDKCOption_NetworkUpdateZ_None, /** - * The value, in thousandths of a satoshi, that this payment is for. + * Must be last for serialization purposes */ - uint64_t amount_msat; + LDKCOption_NetworkUpdateZ_Sentinel, +} LDKCOption_NetworkUpdateZ_Tag; + +typedef struct LDKCOption_NetworkUpdateZ { + LDKCOption_NetworkUpdateZ_Tag tag; + union { + struct { + struct LDKNetworkUpdate some; + }; + }; +} LDKCOption_NetworkUpdateZ; + +/** + * 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 enum LDKPathFailure_Tag { /** - * Information for claiming this received payment, based on whether the purpose of the - * payment is to pay an invoice or to send a spontaneous payment. + * We failed to initially send the payment and no HTLC was committed to. Contains the relevant + * error. */ - struct LDKPaymentPurpose purpose; + LDKPathFailure_InitialSend, /** - * 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 + * A hop on the path failed to forward our payment. */ - struct LDKThirtyTwoBytes via_channel_id; + LDKPathFailure_OnPath, /** - * The `user_channel_id` indicating over which channel we received the payment. + * Must be last for serialization purposes */ - struct LDKCOption_u128Z via_user_channel_id; -} LDKEvent_LDKPaymentClaimable_Body; + LDKPathFailure_Sentinel, +} LDKPathFailure_Tag; -typedef struct LDKEvent_LDKPaymentClaimed_Body { +typedef struct LDKPathFailure_LDKInitialSend_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 + * The error surfaced from initial send. + */ + struct LDKAPIError err; +} LDKPathFailure_LDKInitialSend_Body; + +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. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ - struct LDKPublicKey receiver_node_id; + 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::events::PathFailure or not + */ +typedef enum LDKCOption_PathFailureZ_Tag { /** - * The payment hash of the claimed payment. Note that LDK will not stop you from - * registering duplicate payment hashes for inbound payments. + * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure */ - struct LDKThirtyTwoBytes payment_hash; + LDKCOption_PathFailureZ_Some, /** - * The value, in thousandths of a satoshi, that this payment is for. + * When we're in this state, this COption_PathFailureZ contains nothing */ - uint64_t amount_msat; + LDKCOption_PathFailureZ_None, /** - * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a - * spontaneous payment. + * Must be last for serialization purposes */ - struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentClaimed_Body; + LDKCOption_PathFailureZ_Sentinel, +} LDKCOption_PathFailureZ_Tag; -typedef struct LDKEvent_LDKPaymentSent_Body { +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 { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes payment_id; + struct LDKCOption_PathFailureZ *result; /** - * The preimage to the hash given to ChannelManager::send_payment. - * Note that this serves as a payment receipt, if you wish to have such a thing, you must - * store it somehow! + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKThirtyTwoBytes payment_preimage; + struct LDKDecodeError *err; +} LDKCResult_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 hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes payment_hash; + union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents; /** - * The total fee which was spent at intermediate hops in this payment, across all paths. - * - * Note that, like [`Route::get_total_fees`] this does *not* include any potential - * overpayment to the recipient node. - * - * If the recipient or an intermediate node misbehaves and gives us free money, this may - * overstate the amount paid, though this is unlikely. - * - * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees + * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. */ - struct LDKCOption_u64Z fee_paid_msat; -} LDKEvent_LDKPaymentSent_Body; + bool result_ok; +} LDKCResult_COption_PathFailureZDecodeErrorZ; -typedef struct LDKEvent_LDKPaymentFailed_Body { + + +/** + * Struct to `Display` fields in a safe way using `PrintableString` + */ +typedef struct MUST_USE_STRUCT LDKUntrustedString { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKThirtyTwoBytes payment_id; + LDKnativeUntrustedString *inner; /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKThirtyTwoBytes payment_hash; -} LDKEvent_LDKPaymentFailed_Body; + bool is_owned; +} LDKUntrustedString; -typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { +/** + * The reason the channel was closed. See individual variants more details. + */ +typedef enum LDKClosureReason_Tag { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * Closure generated from receiving a peer error message. * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. */ - struct LDKThirtyTwoBytes payment_id; + LDKClosureReason_CounterpartyForceClosed, /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. */ - struct LDKThirtyTwoBytes payment_hash; + LDKClosureReason_HolderForceClosed, /** - * The payment path that was successful. - * - * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + * 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. */ - struct LDKCVec_RouteHopZ path; -} LDKEvent_LDKPaymentPathSuccessful_Body; - -typedef struct LDKEvent_LDKPaymentPathFailed_Body { + LDKClosureReason_CooperativeClosure, /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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`. */ - struct LDKThirtyTwoBytes payment_id; + LDKClosureReason_CommitmentTxConfirmed, /** - * The hash that was given to [`ChannelManager::send_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * The funding transaction failed to confirm in a timely manner on an inbound channel. */ - struct LDKThirtyTwoBytes payment_hash; + LDKClosureReason_FundingTimedOut, /** - * 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. + * Closure generated from processing an event, likely a HTLC forward/relay/reception. */ - bool payment_failed_permanently; + LDKClosureReason_ProcessingError, /** - * Any failure information conveyed via the Onion return packet by a node along the failed - * payment route. + * 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. * - * Should be applied to the [`NetworkGraph`] so that routing decisions can take into - * account the update. + * 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. * - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - struct LDKCOption_NetworkUpdateZ network_update; + LDKClosureReason_DisconnectedPeer, /** - * 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) + * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than + * the [`ChannelManager`] deserialized. * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - bool all_paths_failed; + LDKClosureReason_OutdatedChannelManager, /** - * The payment path that failed. + * Must be last for serialization purposes */ - struct LDKCVec_RouteHopZ path; + LDKClosureReason_Sentinel, +} LDKClosureReason_Tag; + +typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { /** - * The channel responsible for the failed payment path. + * The error which the peer sent us. * - * Note that for route hints or for the first hop in a path this may be an SCID alias and - * may not refer to a channel in the public network graph. These aliases may also collide - * with channels in the public network graph. + * Be careful about printing the peer_msg, a well-crafted message could exploit + * a security vulnerability in the terminal emulator or the logging subsystem. + * To be safe, use `Display` on `UntrustedString` * - * If this is `Some`, then the corresponding channel should be avoided when the payment is - * retried. May be `None` for older [`Event`] serializations. + * [`UntrustedString`]: crate::util::string::UntrustedString */ - struct LDKCOption_u64Z short_channel_id; + struct LDKUntrustedString peer_msg; +} LDKClosureReason_LDKCounterpartyForceClosed_Body; + +typedef struct LDKClosureReason_LDKProcessingError_Body { /** - * Parameters needed to compute a new [`Route`] when retrying the failed payment path. - * - * See [`find_route`] for details. - * - * [`Route`]: crate::routing::router::Route - * [`find_route`]: crate::routing::router::find_route - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * A developer-readable error message which we generated. */ - struct LDKRouteParameters retry; -} LDKEvent_LDKPaymentPathFailed_Body; + struct LDKStr err; +} LDKClosureReason_LDKProcessingError_Body; -typedef struct LDKEvent_LDKProbeSuccessful_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::events::ClosureReason or not + */ +typedef enum LDKCOption_ClosureReasonZ_Tag { /** - * The id returned by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason */ - struct LDKThirtyTwoBytes payment_id; + LDKCOption_ClosureReasonZ_Some, /** - * The hash generated by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * When we're in this state, this COption_ClosureReasonZ contains nothing */ - struct LDKThirtyTwoBytes payment_hash; + LDKCOption_ClosureReasonZ_None, /** - * The payment path that was successful. + * Must be last for serialization purposes */ - struct LDKCVec_RouteHopZ path; -} LDKEvent_LDKProbeSuccessful_Body; + LDKCOption_ClosureReasonZ_Sentinel, +} LDKCOption_ClosureReasonZ_Tag; -typedef struct LDKEvent_LDKProbeFailed_Body { - /** - * The id returned by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe - */ - struct LDKThirtyTwoBytes payment_id; - /** - * The hash generated by [`ChannelManager::send_probe`]. - * - * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe - */ - struct LDKThirtyTwoBytes payment_hash; +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 { /** - * The payment path that failed. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_RouteHopZ path; + struct LDKCOption_ClosureReasonZ *result; /** - * The channel responsible for the failed probe. - * - * Note that for route hints or for the first hop in a path this may be an SCID alias and - * may not refer to a channel in the public network graph. These aliases may also collide - * with channels in the public network graph. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCOption_u64Z short_channel_id; -} LDKEvent_LDKProbeFailed_Body; + struct LDKDecodeError *err; +} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { +/** + * 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 minimum amount of time that should be waited prior to calling - * process_pending_htlc_forwards. To increase the effort required to correlate payments, - * you should wait a random amount of time in roughly the range (now + time_forwardable, - * now + 5*time_forwardable). + * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; - -typedef struct LDKEvent_LDKHTLCIntercepted_Body { + union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents; /** - * An id to help LDK identify which HTLC is being forwarded or failed. + * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. */ - struct LDKThirtyTwoBytes intercept_id; + bool result_ok; +} LDKCResult_COption_ClosureReasonZDecodeErrorZ; + +/** + * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + */ +typedef enum LDKHTLCDestination_Tag { /** - * 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 + * We tried forwarding to a channel but failed to do so. An example of such an instance is when + * there is insufficient capacity in our outbound channel. */ - uint64_t requested_next_hop_scid; + LDKHTLCDestination_NextHopChannel, /** - * The payment hash used for this HTLC. + * Scenario where we are unsure of the next node to forward the HTLC to. */ - struct LDKThirtyTwoBytes payment_hash; + LDKHTLCDestination_UnknownNextHop, /** - * How many msats were received on the inbound edge of this HTLC. + * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate + * intercept HTLC. */ - uint64_t inbound_amount_msat; + LDKHTLCDestination_InvalidForward, /** - * 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. + * Failure scenario where an HTLC may have been forwarded to be intended for us, + * but is invalid for some reason, so we reject it. * - * 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. + * Some of the reasons may include: + * * HTLC Timeouts + * * Excess HTLCs for a payment that we have already fully received, over-paying for the + * payment, + * * The counterparty node modified the HTLC in transit, + * * A probing attack where an intermediary node is trying to detect if we are the ultimate + * recipient for a payment. */ - uint64_t expected_outbound_amount_msat; -} LDKEvent_LDKHTLCIntercepted_Body; - -typedef struct LDKEvent_LDKSpendableOutputs_Body { + LDKHTLCDestination_FailedPayment, /** - * The outputs which you should store as spendable by you. + * Must be last for serialization purposes */ - struct LDKCVec_SpendableOutputDescriptorZ outputs; -} LDKEvent_LDKSpendableOutputs_Body; + LDKHTLCDestination_Sentinel, +} LDKHTLCDestination_Tag; -typedef struct LDKEvent_LDKPaymentForwarded_Body { +typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { /** - * The incoming channel between the previous node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. + * The `node_id` of the next node. For backwards compatibility, this field is + * marked as optional, versions prior to 0.0.110 may not always be able to provide + * counterparty node information. * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes prev_channel_id; + struct LDKPublicKey node_id; /** - * The outgoing channel between the next node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * The outgoing `channel_id` between us and the next node. */ - struct LDKThirtyTwoBytes next_channel_id; + struct LDKThirtyTwoBytes channel_id; +} LDKHTLCDestination_LDKNextHopChannel_Body; + +typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { /** - * The fee, in milli-satoshis, which was earned as a result of the payment. - * - * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC - * was pending, the amount the next hop claimed will have been rounded down to the nearest - * whole satoshi. Thus, the fee calculated here may be higher than expected as we still - * claimed the full value in millisatoshis from the source. In this case, - * `claim_from_onchain_tx` will be set. - * - * If the channel which sent us the payment has been force-closed, we will claim the funds - * via an on-chain transaction. In that case we do not yet know the on-chain transaction - * fees which we will spend and will instead set this to `None`. It is possible duplicate - * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is - * `None`. + * Short channel id we are requesting to forward an HTLC to. */ - struct LDKCOption_u64Z fee_earned_msat; + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKUnknownNextHop_Body; + +typedef struct LDKHTLCDestination_LDKInvalidForward_Body { /** - * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain - * transaction. + * Short channel id we are requesting to forward an HTLC to. */ - bool claim_from_onchain_tx; -} LDKEvent_LDKPaymentForwarded_Body; + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKInvalidForward_Body; -typedef struct LDKEvent_LDKChannelReady_Body { +typedef struct LDKHTLCDestination_LDKFailedPayment_Body { /** - * The channel_id of the channel that is ready. + * The payment hash of the payment we attempted to process. */ - struct LDKThirtyTwoBytes channel_id; + struct LDKThirtyTwoBytes payment_hash; +} LDKHTLCDestination_LDKFailedPayment_Body; + +typedef struct MUST_USE_STRUCT LDKHTLCDestination { + LDKHTLCDestination_Tag tag; + union { + LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; + LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; + LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; + LDKHTLCDestination_LDKFailedPayment_Body failed_payment; + }; +} LDKHTLCDestination; + +/** + * An enum which can either contain a crate::lightning::events::HTLCDestination or not + */ +typedef enum LDKCOption_HTLCDestinationZ_Tag { /** - * 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 + * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination */ - struct LDKU128 user_channel_id; + LDKCOption_HTLCDestinationZ_Some, /** - * The node_id of the channel counterparty. + * When we're in this state, this COption_HTLCDestinationZ contains nothing */ - struct LDKPublicKey counterparty_node_id; + LDKCOption_HTLCDestinationZ_None, /** - * The features that this channel will operate with. + * Must be last for serialization purposes */ - struct LDKChannelTypeFeatures channel_type; -} LDKEvent_LDKChannelReady_Body; + LDKCOption_HTLCDestinationZ_Sentinel, +} LDKCOption_HTLCDestinationZ_Tag; -typedef struct LDKEvent_LDKChannelClosed_Body { - /** - * The channel_id of the channel which has been closed. Note that on-chain transactions - * resolving the channel are likely still awaiting confirmation. - */ - struct LDKThirtyTwoBytes channel_id; +typedef struct LDKCOption_HTLCDestinationZ { + LDKCOption_HTLCDestinationZ_Tag tag; + union { + struct { + struct LDKHTLCDestination some; + }; + }; +} LDKCOption_HTLCDestinationZ; + +/** + * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + */ +typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { /** - * 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 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 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKU128 user_channel_id; + struct LDKCOption_HTLCDestinationZ *result; /** - * The reason the channel was closed. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKClosureReason reason; -} LDKEvent_LDKChannelClosed_Body; + struct LDKDecodeError *err; +} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr; -typedef struct LDKEvent_LDKDiscardFunding_Body { +/** + * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_HTLCDestinationZ 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_HTLCDestinationZDecodeErrorZ { /** - * The channel_id of the channel which has been closed. + * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes channel_id; + union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; /** - * The full transaction received from the user + * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. */ - struct LDKTransaction transaction; -} LDKEvent_LDKDiscardFunding_Body; + bool result_ok; +} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; -typedef struct LDKEvent_LDKOpenChannelRequest_Body { +/** + * The contents of CResult_PaymentFailureReasonDecodeErrorZ + */ +typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr { /** - * The temporary channel ID of the channel requested to be opened. - * - * When responding to the request, the `temporary_channel_id` should be passed - * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, - * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes temporary_channel_id; + enum LDKPaymentFailureReason *result; /** - * The node_id of the counterparty requesting to open the channel. - * - * When responding to the request, the `counterparty_node_id` should be passed - * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to - * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the - * request. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPublicKey counterparty_node_id; + struct LDKDecodeError *err; +} LDKCResult_PaymentFailureReasonDecodeErrorZPtr; + +/** + * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::PaymentFailureReason 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_PaymentFailureReasonDecodeErrorZ { /** - * The channel value of the requested channel. + * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t funding_satoshis; + union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents; /** - * Our starting balance in the channel if the request is accepted, in milli-satoshi. + * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state. */ - uint64_t push_msat; - /** - * The features that this channel will operate with. If you reject the channel, a - * well-behaved counterparty may automatically re-attempt the channel with a new set of - * feature flags. - * - * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type, - * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to - * 0.0.106. - * - * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type, - * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to - * 0.0.107. Channels setting this type also need to get manually accepted via - * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`], - * or will be rejected otherwise. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - struct LDKChannelTypeFeatures channel_type; -} LDKEvent_LDKOpenChannelRequest_Body; - -typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { - /** - * The channel over which the HTLC was received. - */ - struct LDKThirtyTwoBytes prev_channel_id; - /** - * Destination of the HTLC that failed to be processed. - */ - struct LDKHTLCDestination failed_next_destination; -} LDKEvent_LDKHTLCHandlingFailed_Body; - -typedef struct MUST_USE_STRUCT LDKEvent { - LDKEvent_Tag tag; - union { - LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKPaymentClaimable_Body payment_claimable; - LDKEvent_LDKPaymentClaimed_Body payment_claimed; - LDKEvent_LDKPaymentSent_Body payment_sent; - LDKEvent_LDKPaymentFailed_Body payment_failed; - LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful; - LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; - 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; - LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed; - }; -} LDKEvent; + bool result_ok; +} LDKCResult_PaymentFailureReasonDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::util::events::Event or not + * An enum which can either contain a crate::c_types::U128 or not */ -typedef enum LDKCOption_EventZ_Tag { +typedef enum LDKCOption_u128Z_Tag { /** - * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event + * When we're in this state, this COption_u128Z contains a crate::c_types::U128 */ - LDKCOption_EventZ_Some, + LDKCOption_u128Z_Some, /** - * When we're in this state, this COption_EventZ contains nothing + * When we're in this state, this COption_u128Z contains nothing */ - LDKCOption_EventZ_None, + LDKCOption_u128Z_None, /** * Must be last for serialization purposes */ - LDKCOption_EventZ_Sentinel, -} LDKCOption_EventZ_Tag; + LDKCOption_u128Z_Sentinel, +} LDKCOption_u128Z_Tag; -typedef struct LDKCOption_EventZ { - LDKCOption_EventZ_Tag tag; +typedef struct LDKCOption_u128Z { + LDKCOption_u128Z_Tag tag; union { struct { - struct LDKEvent some; + struct LDKU128 some; }; }; -} LDKCOption_EventZ; +} LDKCOption_u128Z; /** - * The contents of CResult_COption_EventZDecodeErrorZ + * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not */ -typedef union LDKCResult_COption_EventZDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCOption_EventZ *result; +typedef enum LDKCOption_PaymentFailureReasonZ_Tag { /** - * 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_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason */ - struct LDKDecodeError *err; -} LDKCResult_COption_EventZDecodeErrorZPtr; - -/** - * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_COption_EventZDecodeErrorZ { + LDKCOption_PaymentFailureReasonZ_Some, /** - * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_PaymentFailureReasonZ contains nothing */ - union LDKCResult_COption_EventZDecodeErrorZPtr contents; + LDKCOption_PaymentFailureReasonZ_None, /** - * Whether this CResult_COption_EventZDecodeErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_COption_EventZDecodeErrorZ; - + LDKCOption_PaymentFailureReasonZ_Sentinel, +} LDKCOption_PaymentFailureReasonZ_Tag; - -/** - * An accept_channel message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAcceptChannel { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeAcceptChannel *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKAcceptChannel; +typedef struct LDKCOption_PaymentFailureReasonZ { + LDKCOption_PaymentFailureReasonZ_Tag tag; + union { + struct { + enum LDKPaymentFailureReason some; + }; + }; +} LDKCOption_PaymentFailureReasonZ; /** - * An open_channel message to be sent or received from a peer + * 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 LDKOpenChannel { +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. */ - LDKnativeOpenChannel *inner; + 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. */ bool is_owned; -} LDKOpenChannel; +} LDKDelayedPaymentOutputDescriptor; /** - * A funding_created message to be sent or received from a peer + * 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 LDKFundingCreated { +typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFundingCreated *inner; + LDKnativeStaticPaymentOutputDescriptor *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; -} LDKFundingCreated; - - +} LDKStaticPaymentOutputDescriptor; /** - * A funding_signed message to be sent or received from a peer + * 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::events::Event::SpendableOutputs */ -typedef struct MUST_USE_STRUCT LDKFundingSigned { +typedef enum LDKSpendableOutputDescriptor_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. + * 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 */ - LDKnativeFundingSigned *inner; + LDKSpendableOutputDescriptor_StaticOutput, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * 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 + * [`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 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 [`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 [`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`]. */ - bool is_owned; -} LDKFundingSigned; - - - -/** - * A channel_ready message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelReady { + LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An 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. */ - LDKnativeChannelReady *inner; + LDKSpendableOutputDescriptor_StaticPaymentOutput, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Must be last for serialization purposes */ - bool is_owned; -} LDKChannelReady; - - + LDKSpendableOutputDescriptor_Sentinel, +} LDKSpendableOutputDescriptor_Tag; -/** - * An announcement_signatures message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { +typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The outpoint which is spendable. */ - LDKnativeAnnouncementSignatures *inner; + struct LDKOutPoint outpoint; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 output which is referenced by the given outpoint. */ - bool is_owned; -} LDKAnnouncementSignatures; - + struct LDKTxOut output; +} LDKSpendableOutputDescriptor_LDKStaticOutput_Body; +typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { + LDKSpendableOutputDescriptor_Tag tag; + union { + LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output; + struct { + struct LDKDelayedPaymentOutputDescriptor delayed_payment_output; + }; + struct { + struct LDKStaticPaymentOutputDescriptor static_payment_output; + }; + }; +} LDKSpendableOutputDescriptor; /** - * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment - * transaction updates if they were pending. + * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKCommitmentUpdate { +typedef struct LDKCVec_SpendableOutputDescriptorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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(). */ - LDKnativeCommitmentUpdate *inner; + struct LDKSpendableOutputDescriptor *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; -} LDKCommitmentUpdate; - - + uintptr_t datalen; +} LDKCVec_SpendableOutputDescriptorZ; /** - * A revoke_and_ack message to be sent or received from a peer + * An Event which you should probably take some action in response to. + * + * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use + * them directly as they don't round-trip exactly (for example FundingGenerationReady is never + * written as it makes no sense to respond to it after reconnecting to peers). */ -typedef struct MUST_USE_STRUCT LDKRevokeAndACK { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRevokeAndACK *inner; +typedef enum LDKEvent_Tag { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to indicate that the client should generate a funding transaction with the given + * parameters and then call [`ChannelManager::funding_transaction_generated`]. + * Generated in [`ChannelManager`] message handling. + * Note that *all inputs* in the funding transaction must spend SegWit outputs or your + * counterparty can steal your funds! + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - bool is_owned; -} LDKRevokeAndACK; - - - -/** - * A closing_signed message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKClosingSigned { + LDKEvent_FundingGenerationReady, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates that 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`] 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 + * `PaymentClaimable` events may be generated for the same payment. In such a case it is + * polite (and required in the lightning specification) to fail the payment the second time + * and give the sender their money back rather than accepting double 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 */ - LDKnativeClosingSigned *inner; + LDKEvent_PaymentClaimable, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 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::PaymentClaimable`]. However, if we previously crashed during a + * [`ChannelManager::claim_funds`] call you may see this event without a corresponding + * [`Event::PaymentClaimable`] event. + * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `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 */ - bool is_owned; -} LDKClosingSigned; - - - -/** - * A shutdown message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKShutdown { + LDKEvent_PaymentClaimed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target + * and we got back the payment preimage for it). + * + * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed` + * event. In this situation, you SHOULD treat this payment as having succeeded. */ - LDKnativeShutdown *inner; + LDKEvent_PaymentSent, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events + * 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, 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 */ - bool is_owned; -} LDKShutdown; - - - -/** - * A channel_reestablish message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelReestablish { + LDKEvent_PaymentFailed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates that a path for an outbound payment was successful. + * + * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See + * [`Event::PaymentSent`] for obtaining the payment preimage. */ - LDKnativeChannelReestablish *inner; + LDKEvent_PaymentPathSuccessful, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * 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`]. + * + * 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 */ - bool is_owned; -} LDKChannelReestablish; - - - -/** - * A channel_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { + LDKEvent_PaymentPathFailed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. */ - LDKnativeChannelAnnouncement *inner; + LDKEvent_ProbeSuccessful, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 a probe payment we sent failed at an intermediary node on the path. */ - bool is_owned; -} LDKChannelAnnouncement; - - - -/** - * An error message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKErrorMessage { + LDKEvent_ProbeFailed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at + * a time in the future. + * + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ - LDKnativeErrorMessage *inner; + LDKEvent_PendingHTLCsForwardable, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to indicate that 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 */ - bool is_owned; -} LDKErrorMessage; - - - -/** - * A warning message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKWarningMessage { + LDKEvent_HTLCIntercepted, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that an output which you should know how to spend was confirmed on chain + * and is now spendable. + * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your + * counterparty spending them due to some kind of timeout. Thus, you need to store them + * somewhere and spend them when you create on-chain transactions. */ - LDKnativeWarningMessage *inner; + LDKEvent_SpendableOutputs, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * This event is generated when a payment has been successfully forwarded through us and a + * forwarding fee earned. */ - bool is_owned; -} LDKWarningMessage; - -/** - * Used to put an error message in a LightningError - */ -typedef enum LDKErrorAction_Tag { + LDKEvent_PaymentForwarded, /** - * The peer took some action which made us think they were useless. Disconnect them. + * Used to indicate that a channel with the given `channel_id` is being opened and pending + * confirmation on-chain. + * + * This event is emitted when the funding transaction has been signed and is broadcast to the + * network. For 0conf channels it will be immediately followed by the corresponding + * [`Event::ChannelReady`] event. */ - LDKErrorAction_DisconnectPeer, + LDKEvent_ChannelPending, /** - * The peer did something harmless that we weren't able to process, just log and ignore + * 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. */ - LDKErrorAction_IgnoreError, + LDKEvent_ChannelReady, /** - * The peer did something harmless that we weren't able to meaningfully process. - * If the error is logged, log it at the given level. + * Used to indicate that a previously opened channel with the given `channel_id` is in the + * process of closure. */ - LDKErrorAction_IgnoreAndLog, + LDKEvent_ChannelClosed, /** - * The peer provided us with a gossip message which we'd already seen. In most cases this - * should be ignored, but it may result in the message being forwarded if it is a duplicate of - * our own channel announcements. + * Used to indicate to the user that they can abandon the funding transaction and recycle the + * inputs for another purpose. */ - LDKErrorAction_IgnoreDuplicateGossip, + LDKEvent_DiscardFunding, /** - * The peer did something incorrect. Tell them. + * Indicates a request to open a new channel by a peer. + * + * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the + * request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + * + * The event is only triggered when a new open channel request is received and the + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ - LDKErrorAction_SendErrorMessage, + LDKEvent_OpenChannelRequest, /** - * The peer did something incorrect. Tell them without closing any channels. + * Indicates that the HTLC was accepted, but could not be processed when or after attempting to + * forward it. + * + * Some scenarios where this event may be sent include: + * * Insufficient capacity in the outbound channel + * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes + * * When an unknown SCID is requested for forwarding a payment. + * * Expected MPP amount has already been reached + * * The HTLC has timed out + * + * This event, however, does not get generated if an HTLC fails to meet the forwarding + * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). */ - LDKErrorAction_SendWarningMessage, + LDKEvent_HTLCHandlingFailed, /** * Must be last for serialization purposes */ - LDKErrorAction_Sentinel, -} LDKErrorAction_Tag; + LDKEvent_Sentinel, +} LDKEvent_Tag; -typedef struct LDKErrorAction_LDKDisconnectPeer_Body { +typedef struct LDKEvent_LDKFundingGenerationReady_Body { /** - * An error message which we should make an effort to send before we disconnect. + * The random channel_id we picked which you'll need to pass into + * [`ChannelManager::funding_transaction_generated`]. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKDisconnectPeer_Body; - -typedef struct LDKErrorAction_LDKSendErrorMessage_Body { + struct LDKThirtyTwoBytes temporary_channel_id; /** - * The message to send. + * The counterparty's node_id, which you'll need to pass back into + * [`ChannelManager::funding_transaction_generated`]. + * + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - struct LDKErrorMessage msg; -} LDKErrorAction_LDKSendErrorMessage_Body; - -typedef struct LDKErrorAction_LDKSendWarningMessage_Body { + struct LDKPublicKey counterparty_node_id; /** - * The message to send. + * The value, in satoshis, that the output should have. */ - struct LDKWarningMessage msg; + uint64_t channel_value_satoshis; /** - * The peer may have done something harmless that we weren't able to meaningfully process, - * though we should still tell them about it. - * If this event is logged, log it at the given level. + * The script which should be used in the transaction output. */ - enum LDKLevel log_level; -} LDKErrorAction_LDKSendWarningMessage_Body; - -typedef struct MUST_USE_STRUCT LDKErrorAction { - LDKErrorAction_Tag tag; - union { - LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; - struct { - enum LDKLevel ignore_and_log; - }; - LDKErrorAction_LDKSendErrorMessage_Body send_error_message; - LDKErrorAction_LDKSendWarningMessage_Body send_warning_message; - }; -} LDKErrorAction; - - + struct LDKCVec_u8Z output_script; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a + * random value for an inbound channel. This may be zero for objects serialized with LDK + * versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + */ + struct LDKU128 user_channel_id; +} LDKEvent_LDKFundingGenerationReady_Body; -/** - * A query_channel_range message is used to query a peer for channel - * UTXOs in a range of blocks. The recipient of a query makes a best - * effort to reply to the query using one or more reply_channel_range - * messages. - */ -typedef struct MUST_USE_STRUCT LDKQueryChannelRange { +typedef struct LDKEvent_LDKPaymentClaimable_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The 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 */ - LDKnativeQueryChannelRange *inner; + struct LDKPublicKey receiver_node_id; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will + * not stop you from registering duplicate payment hashes for inbound payments. */ - bool is_owned; -} 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. - * The query recipient will reply with the latest, if available, - * channel_announcement, channel_update and node_announcement messages - * it maintains for the requested short_channel_ids followed by a - * reply_short_channel_ids_end message. The short_channel_ids sent in - * this query are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. - */ -typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { + struct LDKThirtyTwoBytes payment_hash; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The fields in the onion which were received with each HTLC. Only fields which were + * identical in each HTLC involved in the payment will be included here. + * + * Payments received on LDK versions prior to 0.0.115 will have this field unset. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKnativeQueryShortChannelIds *inner; + struct LDKRecipientOnionFields onion_fields; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The value, in thousandths of a satoshi, that this payment is for. */ - bool is_owned; -} 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 - * best effort to respond based on their local network view which may - * not be a perfect view of the network. The short_channel_ids in the - * reply are encoded. We only support encoding_type=0 uncompressed - * serialization and do not support encoding_type=1 zlib serialization. - */ -typedef struct MUST_USE_STRUCT LDKReplyChannelRange { + uint64_t amount_msat; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Information for claiming this received payment, based on whether the purpose of the + * payment is to pay an invoice or to send a spontaneous payment. */ - LDKnativeReplyChannelRange *inner; + struct LDKPaymentPurpose purpose; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust 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 `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 */ - bool is_owned; -} LDKReplyChannelRange; - - - -/** - * 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. - */ -typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { + struct LDKThirtyTwoBytes via_channel_id; /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The `user_channel_id` indicating over which channel we received the payment. */ - LDKnativeGossipTimestampFilter *inner; + struct LDKCOption_u128Z via_user_channel_id; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The block height at which this payment will be failed back and will no longer be + * eligible for claiming. + * + * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to + * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ - bool is_owned; -} LDKGossipTimestampFilter; + struct LDKCOption_u32Z claim_deadline; +} LDKEvent_LDKPaymentClaimable_Body; -/** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. - */ -typedef enum LDKMessageSendEvent_Tag { +typedef struct LDKEvent_LDKPaymentClaimed_Body { /** - * Used to indicate that we've accepted a channel open and should send the accept_channel - * message provided to the given peer. + * 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 */ - LDKMessageSendEvent_SendAcceptChannel, + struct LDKPublicKey receiver_node_id; /** - * Used to indicate that we've initiated a channel open and should send the open_channel - * message provided to the given peer. + * The payment hash of the claimed payment. Note that LDK will not stop you from + * registering duplicate payment hashes for inbound payments. */ - LDKMessageSendEvent_SendOpenChannel, + struct LDKThirtyTwoBytes payment_hash; /** - * Used to indicate that a funding_created message should be sent to the peer with the given node_id. + * The value, in thousandths of a satoshi, that this payment is for. */ - LDKMessageSendEvent_SendFundingCreated, + uint64_t amount_msat; /** - * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a + * spontaneous payment. */ - LDKMessageSendEvent_SendFundingSigned, + struct LDKPaymentPurpose purpose; +} LDKEvent_LDKPaymentClaimed_Body; + +typedef struct LDKEvent_LDKPaymentSent_Body { /** - * Used to indicate that a channel_ready message should be sent to the peer with the given node_id. + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKMessageSendEvent_SendChannelReady, + struct LDKThirtyTwoBytes payment_id; /** - * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. + * The preimage to the hash given to ChannelManager::send_payment. + * Note that this serves as a payment receipt, if you wish to have such a thing, you must + * store it somehow! */ - LDKMessageSendEvent_SendAnnouncementSignatures, + struct LDKThirtyTwoBytes payment_preimage; /** - * Used to indicate that a series of HTLC update messages, as well as a commitment_signed - * message should be sent to the peer with the given node_id. + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKMessageSendEvent_UpdateHTLCs, + struct LDKThirtyTwoBytes payment_hash; /** - * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + * The total fee which was spent at intermediate hops in this payment, across all paths. + * + * Note that, like [`Route::get_total_fees`] this does *not* include any potential + * overpayment to the recipient node. + * + * If the recipient or an intermediate node misbehaves and gives us free money, this may + * overstate the amount paid, though this is unlikely. + * + * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees */ - LDKMessageSendEvent_SendRevokeAndACK, + struct LDKCOption_u64Z fee_paid_msat; +} LDKEvent_LDKPaymentSent_Body; + +typedef struct LDKEvent_LDKPaymentFailed_Body { /** - * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKMessageSendEvent_SendClosingSigned, + struct LDKThirtyTwoBytes payment_id; /** - * Used to indicate that a shutdown message should be sent to the peer with the given node_id. + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKMessageSendEvent_SendShutdown, + struct LDKThirtyTwoBytes payment_hash; /** - * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + * The reason the payment failed. This is only `None` for events generated or serialized + * by versions prior to 0.0.115. */ - LDKMessageSendEvent_SendChannelReestablish, + struct LDKCOption_PaymentFailureReasonZ reason; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { /** - * Used to send a channel_announcement and channel_update to a specific peer, likely on - * initial connection to ensure our peers know about our channels. + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKMessageSendEvent_SendChannelAnnouncement, + struct LDKThirtyTwoBytes payment_id; /** - * Used to indicate that a channel_announcement and channel_update should be broadcast to all - * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * The hash that was given to [`ChannelManager::send_payment`]. * - * Note that after doing so, you very likely (unless you did so very recently) want to - * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This - * ensures that any nodes which see our channel_announcement also have a relevant - * node_announcement, including relevant feature flags which may be important for routing - * through or to us. + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * - * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKMessageSendEvent_BroadcastChannelAnnouncement, + struct LDKThirtyTwoBytes payment_hash; /** - * Used to indicate that a channel_update should be broadcast to all peers. + * The payment path that was successful. + * + * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. */ - LDKMessageSendEvent_BroadcastChannelUpdate, + struct LDKPath path; +} LDKEvent_LDKPaymentPathSuccessful_Body; + +typedef struct LDKEvent_LDKPaymentPathFailed_Body { /** - * Used to indicate that a channel_update should be sent to a single peer. - * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a - * private channel and we shouldn't be informing all of our peers of channel parameters. + * The `payment_id` passed to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_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 */ - LDKMessageSendEvent_SendChannelUpdate, + struct LDKThirtyTwoBytes payment_id; /** - * Broadcast an error downstream to be handled + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ - LDKMessageSendEvent_HandleError, + struct LDKThirtyTwoBytes payment_hash; /** - * Query a peer for channels with funding transaction UTXOs in a block range. + * 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, the payment may + * be retried via a different route. */ - LDKMessageSendEvent_SendChannelRangeQuery, + bool payment_failed_permanently; /** - * Request routing gossip messages from a peer for a list of channels identified by - * their short_channel_ids. + * 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 */ - LDKMessageSendEvent_SendShortIdsQuery, + struct LDKPathFailure failure; /** - * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events - * emitted during processing of the query. + * The payment path that failed. */ - LDKMessageSendEvent_SendReplyChannelRange, + struct LDKPath path; /** - * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to - * enable receiving gossip messages from the peer. + * The channel responsible for the failed payment path. + * + * Note that for route hints or for the first hop in a path this may be an SCID alias and + * may not refer to a channel in the public network graph. These aliases may also collide + * with channels in the public network graph. + * + * If this is `Some`, then the corresponding channel should be avoided when the payment is + * retried. May be `None` for older [`Event`] serializations. */ - LDKMessageSendEvent_SendGossipTimestampFilter, + struct LDKCOption_u64Z short_channel_id; +} LDKEvent_LDKPaymentPathFailed_Body; + +typedef struct LDKEvent_LDKProbeSuccessful_Body { /** - * Must be last for serialization purposes + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ - LDKMessageSendEvent_Sentinel, -} LDKMessageSendEvent_Tag; - -typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { + struct LDKThirtyTwoBytes payment_id; /** - * The node_id of the node which should receive this message + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes payment_hash; /** - * The message which should be sent. + * The payment path that was successful. */ - struct LDKAcceptChannel msg; -} LDKMessageSendEvent_LDKSendAcceptChannel_Body; + struct LDKPath path; +} LDKEvent_LDKProbeSuccessful_Body; -typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { +typedef struct LDKEvent_LDKProbeFailed_Body { /** - * The node_id of the node which should receive this message + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes payment_id; /** - * The message which should be sent. + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ - struct LDKOpenChannel msg; -} LDKMessageSendEvent_LDKSendOpenChannel_Body; - -typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { + struct LDKThirtyTwoBytes payment_hash; /** - * The node_id of the node which should receive this message + * The payment path that failed. */ - struct LDKPublicKey node_id; + struct LDKPath path; /** - * The message which should be sent. + * The channel responsible for the failed probe. + * + * Note that for route hints or for the first hop in a path this may be an SCID alias and + * may not refer to a channel in the public network graph. These aliases may also collide + * with channels in the public network graph. */ - struct LDKFundingCreated msg; -} LDKMessageSendEvent_LDKSendFundingCreated_Body; + struct LDKCOption_u64Z short_channel_id; +} LDKEvent_LDKProbeFailed_Body; -typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { +typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { /** - * The node_id of the node which should receive this message + * The minimum amount of time that should be waited prior to calling + * process_pending_htlc_forwards. To increase the effort required to correlate payments, + * you should wait a random amount of time in roughly the range (now + time_forwardable, + * now + 5*time_forwardable). */ - struct LDKPublicKey node_id; + uint64_t time_forwardable; +} LDKEvent_LDKPendingHTLCsForwardable_Body; + +typedef struct LDKEvent_LDKHTLCIntercepted_Body { /** - * The message which should be sent. + * An id to help LDK identify which HTLC is being forwarded or failed. */ - struct LDKFundingSigned msg; -} LDKMessageSendEvent_LDKSendFundingSigned_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body { + struct LDKThirtyTwoBytes intercept_id; /** - * The node_id of the node which should receive these message(s) + * 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 */ - struct LDKPublicKey node_id; + uint64_t requested_next_hop_scid; /** - * The channel_ready message which should be sent. + * The payment hash used for this HTLC. */ - struct LDKChannelReady msg; -} LDKMessageSendEvent_LDKSendChannelReady_Body; - -typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + struct LDKThirtyTwoBytes payment_hash; /** - * The node_id of the node which should receive these message(s) + * How many msats were received on the inbound edge of this HTLC. */ - struct LDKPublicKey node_id; + uint64_t inbound_amount_msat; /** - * The announcement_signatures message which should be sent. + * 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. */ - struct LDKAnnouncementSignatures msg; -} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + uint64_t expected_outbound_amount_msat; +} LDKEvent_LDKHTLCIntercepted_Body; -typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { +typedef struct LDKEvent_LDKSpendableOutputs_Body { /** - * The node_id of the node which should receive these message(s) + * The outputs which you should store as spendable by you. */ - struct LDKPublicKey node_id; + struct LDKCVec_SpendableOutputDescriptorZ outputs; +} LDKEvent_LDKSpendableOutputs_Body; + +typedef struct LDKEvent_LDKPaymentForwarded_Body { /** - * The update messages which should be sent. ALL messages in the struct should be sent! + * The incoming channel between the previous node and us. This is only `None` for events + * generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCommitmentUpdate updates; -} LDKMessageSendEvent_LDKUpdateHTLCs_Body; - -typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { + struct LDKThirtyTwoBytes prev_channel_id; /** - * The node_id of the node which should receive this message + * The outgoing channel between the next node and us. This is only `None` for events + * generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes next_channel_id; /** - * The message which should be sent. + * The fee, in milli-satoshis, which was earned as a result of the payment. + * + * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC + * was pending, the amount the next hop claimed will have been rounded down to the nearest + * whole satoshi. Thus, the fee calculated here may be higher than expected as we still + * claimed the full value in millisatoshis from the source. In this case, + * `claim_from_onchain_tx` will be set. + * + * If the channel which sent us the payment has been force-closed, we will claim the funds + * via an on-chain transaction. In that case we do not yet know the on-chain transaction + * fees which we will spend and will instead set this to `None`. It is possible duplicate + * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is + * `None`. */ - struct LDKRevokeAndACK msg; -} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; - -typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { + struct LDKCOption_u64Z fee_earned_msat; /** - * The node_id of the node which should receive this message + * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain + * transaction. */ - struct LDKPublicKey node_id; + bool claim_from_onchain_tx; /** - * The message which should be sent. + * The final amount forwarded, in milli-satoshis, after the fee is deducted. + * + * The caveat described above the `fee_earned_msat` field applies here as well. */ - struct LDKClosingSigned msg; -} LDKMessageSendEvent_LDKSendClosingSigned_Body; + struct LDKCOption_u64Z outbound_amount_forwarded_msat; +} LDKEvent_LDKPaymentForwarded_Body; -typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { +typedef struct LDKEvent_LDKChannelPending_Body { /** - * The node_id of the node which should receive this message + * The `channel_id` of the channel that is pending confirmation. */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes channel_id; /** - * The message which should be sent. + * 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 LDKShutdown msg; -} LDKMessageSendEvent_LDKSendShutdown_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { + struct LDKU128 user_channel_id; /** - * The node_id of the node which should receive this message + * The `temporary_channel_id` this channel used to be known by during channel establishment. + * + * Will be `None` for channels created prior to LDK version 0.0.115. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes former_temporary_channel_id; /** - * The message which should be sent. + * The `node_id` of the channel counterparty. */ - struct LDKChannelReestablish msg; -} LDKMessageSendEvent_LDKSendChannelReestablish_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body { + struct LDKPublicKey counterparty_node_id; /** - * The node_id of the node which should receive this message + * The outpoint of the channel's funding transaction. */ - struct LDKPublicKey node_id; + struct LDKOutPoint funding_txo; +} LDKEvent_LDKChannelPending_Body; + +typedef struct LDKEvent_LDKChannelReady_Body { /** - * The channel_announcement which should be sent. + * The `channel_id` of the channel that is ready. */ - struct LDKChannelAnnouncement msg; + struct LDKThirtyTwoBytes channel_id; /** - * The followup channel_update which should be sent. + * 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 LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKSendChannelAnnouncement_Body; - -typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + struct LDKU128 user_channel_id; /** - * The channel_announcement which should be sent. + * The `node_id` of the channel counterparty. */ - struct LDKChannelAnnouncement msg; + struct LDKPublicKey counterparty_node_id; /** - * The followup channel_update which should be sent. + * The features that this channel will operate with. */ - struct LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKChannelReady_Body; -typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { +typedef struct LDKEvent_LDKChannelClosed_Body { /** - * The channel_update which should be sent. + * The `channel_id` of the channel which has been closed. Note that on-chain transactions + * resolving the channel are likely still awaiting confirmation. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body; - -typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body { + struct LDKThirtyTwoBytes channel_id; /** - * The node_id of the node which should receive this message + * 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 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 */ - struct LDKPublicKey node_id; + struct LDKU128 user_channel_id; /** - * The channel_update which should be sent. + * The reason the channel was closed. */ - struct LDKChannelUpdate msg; -} LDKMessageSendEvent_LDKSendChannelUpdate_Body; + struct LDKClosureReason reason; +} LDKEvent_LDKChannelClosed_Body; -typedef struct LDKMessageSendEvent_LDKHandleError_Body { +typedef struct LDKEvent_LDKDiscardFunding_Body { /** - * The node_id of the node which should receive this message + * The channel_id of the channel which has been closed. */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes channel_id; /** - * The action which should be taken. + * The full transaction received from the user */ - struct LDKErrorAction action; -} LDKMessageSendEvent_LDKHandleError_Body; + struct LDKTransaction transaction; +} LDKEvent_LDKDiscardFunding_Body; -typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { - /** - * The node_id of this message recipient - */ - struct LDKPublicKey node_id; +typedef struct LDKEvent_LDKOpenChannelRequest_Body { /** - * The query_channel_range which should be sent. + * The temporary channel ID of the channel requested to be opened. + * + * When responding to the request, the `temporary_channel_id` should be passed + * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, + * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ - struct LDKQueryChannelRange msg; -} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; - -typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { + struct LDKThirtyTwoBytes temporary_channel_id; /** - * The node_id of this message recipient + * The node_id of the counterparty requesting to open the channel. + * + * When responding to the request, the `counterparty_node_id` should be passed + * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to + * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the + * request. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ - struct LDKPublicKey node_id; + struct LDKPublicKey counterparty_node_id; /** - * The query_short_channel_ids which should be sent. + * The channel value of the requested channel. */ - struct LDKQueryShortChannelIds msg; -} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; - -typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { + uint64_t funding_satoshis; /** - * The node_id of this message recipient + * Our starting balance in the channel if the request is accepted, in milli-satoshi. */ - struct LDKPublicKey node_id; + uint64_t push_msat; /** - * The reply_channel_range which should be sent. + * The features that this channel will operate with. If you reject the channel, a + * well-behaved counterparty may automatically re-attempt the channel with a new set of + * feature flags. + * + * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type, + * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to + * 0.0.106. + * + * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type, + * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to + * 0.0.107. Channels setting this type also need to get manually accepted via + * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`], + * or will be rejected otherwise. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - struct LDKReplyChannelRange msg; -} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKOpenChannelRequest_Body; -typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body { +typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { /** - * The node_id of this message recipient + * The channel over which the HTLC was received. */ - struct LDKPublicKey node_id; + struct LDKThirtyTwoBytes prev_channel_id; /** - * The gossip_timestamp_filter which should be sent. + * Destination of the HTLC that failed to be processed. */ - struct LDKGossipTimestampFilter msg; -} LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body; + struct LDKHTLCDestination failed_next_destination; +} LDKEvent_LDKHTLCHandlingFailed_Body; -typedef struct MUST_USE_STRUCT LDKMessageSendEvent { - LDKMessageSendEvent_Tag tag; +typedef struct MUST_USE_STRUCT LDKEvent { + LDKEvent_Tag tag; union { - LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel; - LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; - LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; - LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; - LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready; - LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures; - LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs; - LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack; - LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed; - LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown; - LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish; - LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement; - LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement; - LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; - LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update; - LDKMessageSendEvent_LDKHandleError_Body handle_error; - LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query; - LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; - LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range; - LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter; + LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; + LDKEvent_LDKPaymentClaimable_Body payment_claimable; + LDKEvent_LDKPaymentClaimed_Body payment_claimed; + LDKEvent_LDKPaymentSent_Body payment_sent; + LDKEvent_LDKPaymentFailed_Body payment_failed; + LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful; + LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; + 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_LDKChannelPending_Body channel_pending; + LDKEvent_LDKChannelReady_Body channel_ready; + LDKEvent_LDKChannelClosed_Body channel_closed; + LDKEvent_LDKDiscardFunding_Body discard_funding; + LDKEvent_LDKOpenChannelRequest_Body open_channel_request; + LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed; }; -} LDKMessageSendEvent; +} LDKEvent; /** - * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a crate::lightning::events::Event or not */ -typedef struct LDKCVec_MessageSendEventZ { +typedef enum LDKCOption_EventZ_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * When we're in this state, this COption_EventZ contains a crate::lightning::events::Event */ - struct LDKMessageSendEvent *data; + LDKCOption_EventZ_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_EventZ contains nothing */ - uintptr_t datalen; -} LDKCVec_MessageSendEventZ; + LDKCOption_EventZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_EventZ_Sentinel, +} LDKCOption_EventZ_Tag; + +typedef struct LDKCOption_EventZ { + LDKCOption_EventZ_Tag tag; + union { + struct { + struct LDKEvent some; + }; + }; +} LDKCOption_EventZ; /** - * The contents of CResult_TxOutAccessErrorZ + * The contents of CResult_COption_EventZDecodeErrorZ */ -typedef union LDKCResult_TxOutAccessErrorZPtr { +typedef union LDKCResult_COption_EventZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTxOut *result; + struct LDKCOption_EventZ *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; + struct LDKDecodeError *err; +} LDKCResult_COption_EventZDecodeErrorZPtr; /** - * 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. + * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_TxOutAccessErrorZ { +typedef struct LDKCResult_COption_EventZDecodeErrorZ { /** - * The contents of this CResult_TxOutAccessErrorZ, accessible via either + * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TxOutAccessErrorZPtr contents; + union LDKCResult_COption_EventZDecodeErrorZPtr contents; /** - * Whether this CResult_TxOutAccessErrorZ represents a success state. + * Whether this CResult_COption_EventZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TxOutAccessErrorZ; +} LDKCResult_COption_EventZDecodeErrorZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * 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 LDKC2Tuple_usizeTransactionZ { +typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** - * 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. */ - uintptr_t a; + LDKnativeAcceptChannel *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 LDKTransaction b; -} LDKC2Tuple_usizeTransactionZ; + bool is_owned; +} LDKAcceptChannel; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_C2Tuple_usizeTransactionZZ { +typedef struct MUST_USE_STRUCT LDKOpenChannel { /** - * 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_usizeTransactionZ *data; + LDKnativeOpenChannel *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_usizeTransactionZZ; + bool is_owned; +} LDKOpenChannel; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * 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 LDKC2Tuple_TxidBlockHashZ { +typedef struct MUST_USE_STRUCT LDKFundingCreated { /** - * 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; + LDKnativeFundingCreated *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 LDKThirtyTwoBytes b; -} LDKC2Tuple_TxidBlockHashZ; + bool is_owned; +} LDKFundingCreated; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_C2Tuple_TxidBlockHashZZ { +typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * 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_TxidBlockHashZ *data; + LDKnativeFundingSigned *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_TxidBlockHashZZ; + bool is_owned; +} LDKFundingSigned; /** - * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on - * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the - * preimage claim backward will lead to loss of funds. + * 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 LDKHTLCUpdate { +typedef struct MUST_USE_STRUCT LDKChannelReady { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeHTLCUpdate *inner; + LDKnativeChannelReady *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; -} LDKHTLCUpdate; +} LDKChannelReady; + + /** - * An event to be processed by the ChannelManager. + * 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 enum LDKMonitorEvent_Tag { - /** - * A monitor event containing an HTLCUpdate. - */ - LDKMonitorEvent_HTLCEvent, +typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures { /** - * A monitor event that the Channel's commitment transaction was confirmed. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMonitorEvent_CommitmentTxConfirmed, + LDKnativeAnnouncementSignatures *inner; /** - * Indicates a [`ChannelMonitor`] update has completed. See - * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. - * - * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKMonitorEvent_Completed, + bool is_owned; +} LDKAnnouncementSignatures; + + + +/** + * 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 { /** - * Indicates a [`ChannelMonitor`] update has failed. See - * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used. - * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKMonitorEvent_UpdateFailed, + LDKnativeCommitmentUpdate *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. */ - LDKMonitorEvent_Sentinel, -} LDKMonitorEvent_Tag; + bool is_owned; +} LDKCommitmentUpdate; -typedef struct LDKMonitorEvent_LDKCompleted_Body { + + +/** + * 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 { /** - * The funding outpoint of the [`ChannelMonitor`] that was updated + * A pointer to the opaque Rust object. + * Nearly everywhere, 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 LDKOutPoint funding_txo; + LDKnativeRevokeAndACK *inner; /** - * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or - * [`ChannelMonitor::get_latest_update_id`]. - * - * Note that this should only be set to a given update's ID if all previous updates for the - * same [`ChannelMonitor`] have been applied and persisted. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uint64_t monitor_update_id; -} LDKMonitorEvent_LDKCompleted_Body; + bool is_owned; +} LDKRevokeAndACK; + -typedef struct MUST_USE_STRUCT LDKMonitorEvent { - LDKMonitorEvent_Tag tag; - union { - struct { - struct LDKHTLCUpdate htlc_event; - }; - struct { - struct LDKOutPoint commitment_tx_confirmed; - }; - LDKMonitorEvent_LDKCompleted_Body completed; - struct { - struct LDKOutPoint update_failed; - }; - }; -} LDKMonitorEvent; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_MonitorEventZ { +typedef struct MUST_USE_STRUCT LDKClosingSigned { /** - * 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 LDKMonitorEvent *data; + LDKnativeClosingSigned *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_MonitorEventZ; + bool is_owned; +} LDKClosingSigned; + + /** - * A tuple of 3 elements. See the individual fields for the types contained. + * 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 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; +typedef struct MUST_USE_STRUCT LDKShutdown { /** - * The element at position 1 + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKCVec_MonitorEventZ b; + LDKnativeShutdown *inner; /** - * The element at position 2 + * Indicates that this is the only struct which contains the same pointer. + * Rust 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 LDKPublicKey c; -} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; + bool is_owned; +} LDKShutdown; + + /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size. - * This corresponds to std::vector in C++ + * 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 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { +typedef struct MUST_USE_STRUCT LDKChannelReestablish { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data; + LDKnativeChannelReestablish *inner; /** - * The number of elements pointed to by `data`. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - uintptr_t datalen; -} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; + bool is_owned; +} LDKChannelReestablish; /** - * [`Score`] implementation that uses a fixed penalty. + * 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 LDKFixedPenaltyScorer { +typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFixedPenaltyScorer *inner; + LDKnativeChannelAnnouncement *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; -} LDKFixedPenaltyScorer; +} LDKChannelAnnouncement; + + /** - * The contents of CResult_FixedPenaltyScorerDecodeErrorZ + * 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 union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKFixedPenaltyScorer *result; + LDKnativeNodeAnnouncement *inner; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - struct LDKDecodeError *err; -} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr; + bool is_owned; +} LDKNodeAnnouncement; + + /** - * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::scoring::FixedPenaltyScorer 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 [`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 LDKCResult_FixedPenaltyScorerDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKErrorMessage { /** - * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, 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_FixedPenaltyScorerDecodeErrorZPtr contents; + LDKnativeErrorMessage *inner; /** - * Whether this CResult_FixedPenaltyScorerDecodeErrorZ 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_FixedPenaltyScorerDecodeErrorZ; + bool is_owned; +} LDKErrorMessage; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * 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 LDKC2Tuple_u64u64Z { +typedef struct MUST_USE_STRUCT LDKWarningMessage { /** - * 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. */ - uint64_t a; + LDKnativeWarningMessage *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. */ - uint64_t b; -} LDKC2Tuple_u64u64Z; + bool is_owned; +} LDKWarningMessage; /** - * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not + * Used to put an error message in a [`LightningError`]. */ -typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { +typedef enum LDKErrorAction_Tag { /** - * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z + * The peer took some action which made us think they were useless. Disconnect them. */ - LDKCOption_C2Tuple_u64u64ZZ_Some, + LDKErrorAction_DisconnectPeer, /** - * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing + * The peer did something harmless that we weren't able to process, just log and ignore */ - LDKCOption_C2Tuple_u64u64ZZ_None, + LDKErrorAction_IgnoreError, /** - * Must be last for serialization purposes + * The peer did something harmless that we weren't able to meaningfully process. + * If the error is logged, log it at the given level. */ - LDKCOption_C2Tuple_u64u64ZZ_Sentinel, -} LDKCOption_C2Tuple_u64u64ZZ_Tag; - -typedef struct LDKCOption_C2Tuple_u64u64ZZ { - LDKCOption_C2Tuple_u64u64ZZ_Tag tag; - union { - struct { - struct LDKC2Tuple_u64u64Z some; - }; - }; -} LDKCOption_C2Tuple_u64u64ZZ; - -/** - * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_NodeIdZ { + LDKErrorAction_IgnoreAndLog, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The peer provided us with a gossip message which we'd already seen. In most cases this + * should be ignored, but it may result in the message being forwarded if it is a duplicate of + * our own channel announcements. */ - struct LDKNodeId *data; + LDKErrorAction_IgnoreDuplicateGossip, /** - * The number of elements pointed to by `data`. + * The peer did something incorrect. Tell them. */ - uintptr_t datalen; -} LDKCVec_NodeIdZ; - - - -/** - * A Record, unit of logging output with Metadata to enable filtering - * Module_path, file, line to inform on log's source - */ -typedef struct MUST_USE_STRUCT LDKRecord { + LDKErrorAction_SendErrorMessage, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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 peer did something incorrect. Tell them without closing any channels. */ - LDKnativeRecord *inner; + LDKErrorAction_SendWarningMessage, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Must be last for serialization purposes */ - bool is_owned; -} LDKRecord; + LDKErrorAction_Sentinel, +} LDKErrorAction_Tag; -/** - * A trait encapsulating the operations required of a logger - */ -typedef struct LDKLogger { +typedef struct LDKErrorAction_LDKDisconnectPeer_Body { /** - * 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. + * An error message which we should make an effort to send before we disconnect. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - void *this_arg; + struct LDKErrorMessage msg; +} LDKErrorAction_LDKDisconnectPeer_Body; + +typedef struct LDKErrorAction_LDKSendErrorMessage_Body { /** - * Logs the `Record` + * The message to send. */ - void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); + struct LDKErrorMessage msg; +} LDKErrorAction_LDKSendErrorMessage_Body; + +typedef struct LDKErrorAction_LDKSendWarningMessage_Body { /** - * 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 message to send. */ - void (*free)(void *this_arg); -} LDKLogger; + struct LDKWarningMessage msg; + /** + * The peer may have done something harmless that we weren't able to meaningfully process, + * though we should still tell them about it. + * If this event is logged, log it at the given level. + */ + enum LDKLevel log_level; +} LDKErrorAction_LDKSendWarningMessage_Body; + +typedef struct MUST_USE_STRUCT LDKErrorAction { + LDKErrorAction_Tag tag; + union { + LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer; + struct { + enum LDKLevel ignore_and_log; + }; + LDKErrorAction_LDKSendErrorMessage_Body send_error_message; + LDKErrorAction_LDKSendWarningMessage_Body send_warning_message; + }; +} LDKErrorAction; /** - * Represents the network as nodes and channels between them + * 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 [`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 LDKNetworkGraph { +typedef struct MUST_USE_STRUCT LDKQueryChannelRange { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNetworkGraph *inner; + LDKnativeQueryChannelRange *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNetworkGraph; +} LDKQueryChannelRange; /** - * [`Score`] implementation using channel success probability distributions. - * - * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel, - * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC. - * When a payment is forwarded through a channel (but fails later in the route), we learn the - * lower-bound on the channel's available liquidity must be at least the value of the HTLC. - * - * These bounds are then used to determine a success probability using the formula from - * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt - * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`). - * - * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and - * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in - * milli-satoshis. The penalties, when added across all hops, have the property of being linear in - * terms of the entire path's success probability. This allows the router to directly compare - * penalties for different paths. See the documentation of those parameters for the exact formulas. - * - * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`]. + * 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. * - * Further, we track the history of our upper and lower liquidity bounds for each channel, - * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`] - * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability - * formula, but using the history of a channel rather than our latest estimates for the liquidity - * bounds. - * - * # Note - * - * Mixing the `no-std` feature between serialization and deserialization results in undefined - * behavior. + * The query recipient will reply with the latest, if available, + * [`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. * - * [1]: https://arxiv.org/abs/2107.05322 - * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat - * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat - * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life - * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat - * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat + * [`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 LDKProbabilisticScorer { +typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeProbabilisticScorer *inner; + LDKnativeQueryShortChannelIds *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; -} LDKProbabilisticScorer; +} LDKQueryShortChannelIds; + -/** - * The contents of CResult_ProbabilisticScorerDecodeErrorZ - */ -typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKProbabilisticScorer *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_ProbabilisticScorerDecodeErrorZPtr; /** - * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A [`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_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 LDKCResult_ProbabilisticScorerDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKReplyChannelRange { /** - * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, 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_ProbabilisticScorerDecodeErrorZPtr contents; + LDKnativeReplyChannelRange *inner; /** - * Whether this CResult_ProbabilisticScorerDecodeErrorZ 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_ProbabilisticScorerDecodeErrorZ; + bool is_owned; +} LDKReplyChannelRange; /** - * Features used within an `init` message. + * 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_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message */ -typedef struct MUST_USE_STRUCT LDKInitFeatures { +typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInitFeatures *inner; + LDKnativeGossipTimestampFilter *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInitFeatures; +} LDKGossipTimestampFilter; /** - * The contents of CResult_InitFeaturesDecodeErrorZ + * An event generated by ChannelManager which indicates a message should be sent to a peer (or + * broadcast to most peers). + * These events are handled by PeerManager::process_events if you are using a PeerManager. */ -typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { +typedef enum LDKMessageSendEvent_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Used to indicate that we've accepted a channel open and should send the accept_channel + * message provided to the given peer. */ - struct LDKInitFeatures *result; + LDKMessageSendEvent_SendAcceptChannel, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Used to indicate that we've initiated a channel open and should send the open_channel + * message provided to the given peer. */ - struct LDKDecodeError *err; -} LDKCResult_InitFeaturesDecodeErrorZPtr; - -/** - * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InitFeaturesDecodeErrorZ { + LDKMessageSendEvent_SendOpenChannel, /** - * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Used to indicate that a funding_created message should be sent to the peer with the given node_id. */ - union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + LDKMessageSendEvent_SendFundingCreated, /** - * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ - bool result_ok; -} LDKCResult_InitFeaturesDecodeErrorZ; - - - -/** - * Features used within a `channel_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKChannelFeatures { + LDKMessageSendEvent_SendFundingSigned, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a channel_ready message should be sent to the peer with the given node_id. */ - LDKnativeChannelFeatures *inner; + LDKMessageSendEvent_SendChannelReady, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. */ - bool is_owned; -} LDKChannelFeatures; - -/** - * The contents of CResult_ChannelFeaturesDecodeErrorZ - */ -typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { + LDKMessageSendEvent_SendAnnouncementSignatures, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Used to indicate that a series of HTLC update messages, as well as a commitment_signed + * message should be sent to the peer with the given node_id. */ - struct LDKChannelFeatures *result; + LDKMessageSendEvent_UpdateHTLCs, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelFeaturesDecodeErrorZPtr; - -/** - * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { + LDKMessageSendEvent_SendRevokeAndACK, /** - * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. */ - union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + LDKMessageSendEvent_SendClosingSigned, /** - * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + * Used to indicate that a shutdown message should be sent to the peer with the given node_id. */ - bool result_ok; -} LDKCResult_ChannelFeaturesDecodeErrorZ; - - - -/** - * Features used within a `node_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKNodeFeatures { + LDKMessageSendEvent_SendShutdown, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. */ - LDKnativeNodeFeatures *inner; + LDKMessageSendEvent_SendChannelReestablish, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Used to send a channel_announcement and channel_update to a specific peer, likely on + * initial connection to ensure our peers know about our channels. */ - bool is_owned; -} LDKNodeFeatures; - -/** - * The contents of CResult_NodeFeaturesDecodeErrorZ - */ -typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { + LDKMessageSendEvent_SendChannelAnnouncement, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Used to indicate that a channel_announcement and channel_update should be broadcast to all + * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + * + * Note that after doing so, you very likely (unless you did so very recently) want to + * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This + * ensures that any nodes which see our channel_announcement also have a relevant + * node_announcement, including relevant feature flags which may be important for routing + * through or to us. + * + * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement */ - struct LDKNodeFeatures *result; + LDKMessageSendEvent_BroadcastChannelAnnouncement, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Used to indicate that a channel_update should be broadcast to all peers. */ - struct LDKDecodeError *err; -} LDKCResult_NodeFeaturesDecodeErrorZPtr; - -/** - * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { + LDKMessageSendEvent_BroadcastChannelUpdate, /** - * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Used to indicate that a node_announcement should be broadcast to all peers. */ - union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + LDKMessageSendEvent_BroadcastNodeAnnouncement, /** - * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + * Used to indicate that a channel_update should be sent to a single peer. + * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a + * private channel and we shouldn't be informing all of our peers of channel parameters. */ - bool result_ok; -} LDKCResult_NodeFeaturesDecodeErrorZ; - - - -/** - * Features used within an invoice. - */ -typedef struct MUST_USE_STRUCT LDKInvoiceFeatures { + LDKMessageSendEvent_SendChannelUpdate, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Broadcast an error downstream to be handled */ - LDKnativeInvoiceFeatures *inner; + LDKMessageSendEvent_HandleError, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Query a peer for channels with funding transaction UTXOs in a block range. */ - bool is_owned; -} LDKInvoiceFeatures; - -/** - * The contents of CResult_InvoiceFeaturesDecodeErrorZ - */ -typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr { + LDKMessageSendEvent_SendChannelRangeQuery, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Request routing gossip messages from a peer for a list of channels identified by + * their short_channel_ids. */ - struct LDKInvoiceFeatures *result; + LDKMessageSendEvent_SendShortIdsQuery, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events + * emitted during processing of the query. */ - struct LDKDecodeError *err; -} LDKCResult_InvoiceFeaturesDecodeErrorZPtr; - -/** - * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ { + LDKMessageSendEvent_SendReplyChannelRange, /** - * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to + * enable receiving gossip messages from the peer. */ - union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents; + LDKMessageSendEvent_SendGossipTimestampFilter, /** - * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_InvoiceFeaturesDecodeErrorZ; + LDKMessageSendEvent_Sentinel, +} LDKMessageSendEvent_Tag; -/** - * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ - */ -typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr { +typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The node_id of the node which should receive this message */ - struct LDKChannelTypeFeatures *result; + struct LDKPublicKey node_id; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The message which should be sent. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr; + struct LDKAcceptChannel msg; +} LDKMessageSendEvent_LDKSendAcceptChannel_Body; -/** - * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { +typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body { /** - * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The node_id of the node which should receive this message */ - union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents; + struct LDKPublicKey node_id; /** - * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + * The message which should be sent. */ - bool result_ok; -} LDKCResult_ChannelTypeFeaturesDecodeErrorZ; - - + struct LDKOpenChannel msg; +} LDKMessageSendEvent_LDKSendOpenChannel_Body; -/** - * Features used within an `offer`. - */ -typedef struct MUST_USE_STRUCT LDKOfferFeatures { +typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The node_id of the node which should receive this message */ - LDKnativeOfferFeatures *inner; + struct LDKPublicKey node_id; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The message which should be sent. */ - bool is_owned; -} LDKOfferFeatures; + struct LDKFundingCreated msg; +} LDKMessageSendEvent_LDKSendFundingCreated_Body; -/** - * The contents of CResult_OfferFeaturesDecodeErrorZ - */ -typedef union LDKCResult_OfferFeaturesDecodeErrorZPtr { +typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The node_id of the node which should receive this message */ - struct LDKOfferFeatures *result; + struct LDKPublicKey node_id; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The message which should be sent. */ - struct LDKDecodeError *err; -} LDKCResult_OfferFeaturesDecodeErrorZPtr; + struct LDKFundingSigned msg; +} LDKMessageSendEvent_LDKSendFundingSigned_Body; -/** - * A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::OfferFeatures 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_OfferFeaturesDecodeErrorZ { +typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body { /** - * The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The node_id of the node which should receive these message(s) */ - union LDKCResult_OfferFeaturesDecodeErrorZPtr contents; + struct LDKPublicKey node_id; /** - * Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state. + * The channel_ready message which should be sent. */ - bool result_ok; -} LDKCResult_OfferFeaturesDecodeErrorZ; + struct LDKChannelReady msg; +} LDKMessageSendEvent_LDKSendChannelReady_Body; + +typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { + /** + * The node_id of the node which should receive these message(s) + */ + struct LDKPublicKey node_id; + /** + * The announcement_signatures message which should be sent. + */ + struct LDKAnnouncementSignatures msg; +} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body; + +typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { + /** + * The node_id of the node which should receive these message(s) + */ + struct LDKPublicKey node_id; + /** + * The update messages which should be sent. ALL messages in the struct should be sent! + */ + struct LDKCommitmentUpdate updates; +} LDKMessageSendEvent_LDKUpdateHTLCs_Body; + +typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKRevokeAndACK msg; +} LDKMessageSendEvent_LDKSendRevokeAndACK_Body; + +typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKClosingSigned msg; +} LDKMessageSendEvent_LDKSendClosingSigned_Body; + +typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKShutdown msg; +} LDKMessageSendEvent_LDKSendShutdown_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKChannelReestablish msg; +} LDKMessageSendEvent_LDKSendChannelReestablish_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The channel_announcement which should be sent. + */ + struct LDKChannelAnnouncement msg; + /** + * The followup channel_update which should be sent. + */ + struct LDKChannelUpdate update_msg; +} LDKMessageSendEvent_LDKSendChannelAnnouncement_Body; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + /** + * The channel_announcement which should be sent. + */ + 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; + +typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { + /** + * The channel_update which should be sent. + */ + 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 + */ + struct LDKPublicKey node_id; + /** + * The channel_update which should be sent. + */ + struct LDKChannelUpdate msg; +} LDKMessageSendEvent_LDKSendChannelUpdate_Body; + +typedef struct LDKMessageSendEvent_LDKHandleError_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The action which should be taken. + */ + struct LDKErrorAction action; +} LDKMessageSendEvent_LDKHandleError_Body; + +typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The query_channel_range which should be sent. + */ + struct LDKQueryChannelRange msg; +} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body; +typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The query_short_channel_ids which should be sent. + */ + struct LDKQueryShortChannelIds msg; +} LDKMessageSendEvent_LDKSendShortIdsQuery_Body; +typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The reply_channel_range which should be sent. + */ + struct LDKReplyChannelRange msg; +} LDKMessageSendEvent_LDKSendReplyChannelRange_Body; + +typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The gossip_timestamp_filter which should be sent. + */ + struct LDKGossipTimestampFilter msg; +} LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body; + +typedef struct MUST_USE_STRUCT LDKMessageSendEvent { + LDKMessageSendEvent_Tag tag; + union { + LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel; + LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; + LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; + LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; + LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready; + LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures; + LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs; + LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack; + LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed; + LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown; + LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish; + 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; + LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; + LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range; + LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter; + }; +} LDKMessageSendEvent; /** - * Features used within an `invoice_request`. + * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { +typedef struct LDKCVec_MessageSendEventZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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(). */ - LDKnativeInvoiceRequestFeatures *inner; + struct LDKMessageSendEvent *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; -} LDKInvoiceRequestFeatures; + uintptr_t datalen; +} LDKCVec_MessageSendEventZ; + +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ChainHashZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ChainHashZ; /** - * The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ + * The contents of CResult_PublicKeyErrorZ */ -typedef union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr { +typedef union LDKCResult_PublicKeyErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoiceRequestFeatures *result; + struct LDKPublicKey *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_InvoiceRequestFeaturesDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeyErrorZPtr; /** - * A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::InvoiceRequestFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * 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 struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ { +typedef struct LDKCResult_PublicKeyErrorZ { /** - * The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either + * The contents of this CResult_PublicKeyErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr contents; + union LDKCResult_PublicKeyErrorZPtr contents; /** - * Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state. + * Whether this CResult_PublicKeyErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceRequestFeaturesDecodeErrorZ; +} LDKCResult_PublicKeyErrorZ; /** * The contents of CResult_NodeIdDecodeErrorZ @@ -5819,10 +6642,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 struct LDKAccess { +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 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. @@ -5835,40 +6751,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 @@ -6167,7 +7083,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 { /** @@ -6185,7 +7103,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 { /** @@ -6205,7 +7123,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, @@ -6715,94 +7634,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; - -/** - * 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; - -/** - * 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 */ @@ -6894,6 +7725,73 @@ typedef struct LDKCResult_SharedSecretNoneZ { bool result_ok; } LDKCResult_SharedSecretNoneZ; +/** + * 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; + +/** + * 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; + /** @@ -6921,7 +7819,9 @@ typedef struct MUST_USE_STRUCT LDKClosingTransaction { /** - * The unsigned part of a channel_announcement + * The unsigned part of a [`channel_announcement`] message. + * + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { /** @@ -6939,15 +7839,10 @@ typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { } LDKUnsignedChannelAnnouncement; /** - * 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. + * 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. @@ -6995,13 +7890,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 ); /** * 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 - * [`BaseSign`] object uniquely and lookup or re-derive its keys. + * [`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. * @@ -7114,32 +8043,27 @@ 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. Since these - * are static channel data, they MUST NOT be allowed to change to different values once set, - * as LDK may call this method more than once. - * - * channel_parameters.is_populated() MUST be true. + * Implementation of ChannelSigner for this object. */ - void (*provide_channel_parameters)(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 writeable signer. @@ -7150,16 +8074,16 @@ typedef struct LDKBaseSign { * [`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 */ @@ -7169,107 +8093,40 @@ typedef struct LDKSign { * 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; +} LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr; /** - * 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. + * 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_SignDecodeErrorZ { +typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ { /** - * The contents of this CResult_SignDecodeErrorZ, accessible via either + * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignDecodeErrorZPtr contents; + union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents; /** - * Whether this CResult_SignDecodeErrorZ represents a success state. + * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ 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; - -/** - * 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; +} LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ; /** * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. @@ -7322,7 +8179,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. @@ -7549,211 +8406,126 @@ 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_InvalidRoute, + 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 { - /** - * A human-readable error message - */ - struct LDKStr err; +typedef struct LDKRecentPaymentDetails_LDKPending_Body { /** - * The feerate which was too high. + * Hash of the payment that is currently being sent but has yet to be fulfilled or + * abandoned. */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKInvalidRoute_Body { + struct LDKThirtyTwoBytes payment_hash; /** - * A human-readable error message + * Total amount (in msat, excluding fees) across all paths for this payment, + * not just the amount currently inflight. */ - struct LDKStr err; -} LDKAPIError_LDKInvalidRoute_Body; + uint64_t total_msat; +} LDKRecentPaymentDetails_LDKPending_Body; -typedef struct LDKAPIError_LDKChannelUnavailable_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_LDKChannelUnavailable_Body; + struct LDKThirtyTwoBytes payment_hash; +} LDKRecentPaymentDetails_LDKFulfilled_Body; -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { +typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { /** - * The incompatible shutdown script. + * Hash of the payment that we have given up trying to send. */ - 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_LDKInvalidRoute_Body invalid_route; - 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; +} LDKRecentPaymentDetails; /** - * 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. + * A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_CResult_NoneAPIErrorZZ { +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 LDKCResult_NoneAPIErrorZ *data; + struct LDKRecentPaymentDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_CResult_NoneAPIErrorZZ; +} LDKCVec_RecentPaymentDetailsZ; /** - * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_APIErrorZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKAPIError *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_APIErrorZ; - -/** - * The contents of CResult__u832APIErrorZ - */ -typedef union LDKCResult__u832APIErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKThirtyTwoBytes *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; - -/** - * A CResult__u832APIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult__u832APIErrorZ { - /** - * The contents of this CResult__u832APIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult__u832APIErrorZPtr contents; - /** - * Whether this CResult__u832APIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult__u832APIErrorZ; - -/** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * If a payment fails to send with [`ChannelManager::send_payment_with_route`], 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_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route */ typedef enum LDKPaymentSendFailure_Tag { /** @@ -7762,9 +8534,11 @@ typedef enum LDKPaymentSendFailure_Tag { * * You can freely resend the payment in full (with the parameter error fixed). * - * Because the payment failed outright, no payment tracking is done, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed */ LDKPaymentSendFailure_ParameterError, /** @@ -7773,12 +8547,14 @@ typedef enum LDKPaymentSendFailure_Tag { * * 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. * - * Because the payment failed outright, no payment tracking is done, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed */ LDKPaymentSendFailure_PathParameterError, /** @@ -7786,32 +8562,33 @@ typedef enum LDKPaymentSendFailure_Tag { * 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, you do not need to call - * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work - * for this payment. + * Because the payment failed outright, no payment tracking is done and no + * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. + * + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed */ LDKPaymentSendFailure_AllFailedResendSafe, /** * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not - * yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via - * [`ChannelManager::abandon_payment`]). + * yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]). * - * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::PaymentSent`]: crate::events::Event::PaymentSent + * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed */ LDKPaymentSendFailure_DuplicatePayment, /** - * 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. + * 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 which was passed to - * send_payment, and any `Err`s which are not [`APIError::MonitorUpdateInProgress`] can be - * safely retried via [`ChannelManager::retry_payment`]. + * 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, /** @@ -7822,13 +8599,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 */ @@ -7872,7 +8648,7 @@ typedef union LDKCResult_NonePaymentSendFailureZPtr { /** * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * 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_NonePaymentSendFailureZ { @@ -7887,6 +8663,38 @@ typedef struct LDKCResult_NonePaymentSendFailureZ { bool result_ok; } LDKCResult_NonePaymentSendFailureZ; +/** + * The contents of CResult_NoneRetryableSendFailureZ + */ +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 */ @@ -7905,7 +8713,7 @@ typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { /** * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { @@ -7920,6 +8728,39 @@ typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { bool result_ok; } 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. */ @@ -7952,7 +8793,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 { @@ -8447,7 +9288,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. @@ -8487,6 +9328,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. @@ -8502,65 +9364,172 @@ typedef struct LDKu8slice { uintptr_t datalen; } LDKu8slice; + + +/** + * 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 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 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 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, 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; + /** - * A trait to describe an object which can get user secrets and key material. + * Represents the set of gossip messages that require a signature from a node's identity key. */ -typedef struct LDKKeysInterface { +typedef enum LDKUnsignedGossipMessage_Tag { + /** + * An unsigned channel announcement. + */ + LDKUnsignedGossipMessage_ChannelAnnouncement, + /** + * An unsigned channel update. + */ + 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 node secret key based on the provided [`Recipient`]. + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. * - * The `node_id`/`network_key` is the public key that corresponds to this secret key. + * 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 with a given [`Recipient`] - * parameter. + * This method must return the same value each time it is called. * - * Errors if the [`Recipient`] variant is not supported by the implementation. + * [phantom node payments]: PhantomKeysManager */ - struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient); + struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); /** - * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in - * [`get_node_secret`]. + * Get node id based on the provided [`Recipient`]. * * 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`]: Self::get_node_secret */ struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); /** - * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if + * 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. + * 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. * - * [`node secret`]: Self::get_node_secret + * Errors if the [`Recipient`] variant is not supported by the implementation. */ struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * Sign an invoice. * - * 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. + * 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_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. */ - struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); /** - * Get a script pubkey which we will send funds to when closing a channel. + * Sign a gossip message. * - * 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. + * 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 LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); + 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; /** - * Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! + * 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 a different value each time it is called. */ @@ -8569,23 +9538,15 @@ typedef struct LDKKeysInterface { * Derives the private key material backing a `Signer`. * * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through - * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * [`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 - * [`BaseSign::channel_keys_id`]. + * [`ChannelSigner::channel_keys_id`]. */ - struct LDKSign (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. - * - * This method must return a different value each time it is called. - */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); - /** - * Reads a [`Signer`] for this [`KeysInterface`] from the given input stream. + * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. * This is only called during deserialization of other objects which contain - * [`Sign`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). + * [`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. @@ -8597,37 +9558,27 @@ typedef struct LDKKeysInterface { * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); /** - * 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-encoded. - * - * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. * - * Errors if the [`Recipient`] variant is not supported by the implementation. + * 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 LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient receipient); + struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. - * - * 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. + * Get a script pubkey which we will send funds to when closing a channel. * - * [phantom node payments]: PhantomKeysManager + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. */ - struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); + 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 @@ -8660,45 +9611,90 @@ 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; + /** * Manager which keeps track of a number of channels and sends messages to the appropriate * channel, also tracking HTLC preimages and forwarding onion packets appropriately. * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through * to individual Channels. * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * Implements [`Writeable`] to write out all channel state to disk. Implies [`peer_disconnected`] for * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). + * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e., + * called [`funding_transaction_generated`] for outbound channels) being closed. * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with + * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before + * returning from [`chain::Watch::watch_channel`]/[`update_channel`], with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other `ChannelManager` operations from occurring during * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * [`ChannelMonitor`] passed by reference to [`read`], those channels will be force-closed based on the + * `ChannelMonitor` state and no funds will be lost (mod on-chain transaction fees). * - * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! + * Note that the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which + * tells you the last block hash which was connected. You should get the best block tip before using the manager. + * See [`chain::Listen`] and [`chain::Confirm`] for more details. * - * Note that ChannelManager is responsible for tracking liveness of its channels and generating - * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid + * Note that `ChannelManager` is responsible for tracking liveness of its channels and generating + * [`ChannelUpdate`] messages informing peers that the channel is temporarily disabled. To avoid * spam due to quick disconnection/reconnection, updates are not sent until the channel has been * offline for a full minute. In order to track this, you must call - * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. + * [`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 - * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when + * Rather than using a plain `ChannelManager`, it is preferable to use either a [`SimpleArcChannelManager`] + * a [`SimpleRefChannelManager`], for conciseness. See their documentation for more details, but + * essentially you should default to using a [`SimpleRefChannelManager`], and use a + * [`SimpleArcChannelManager`] when you require a `ChannelManager` with a static lifetime, such as when * you're using lightning-net-tokio. + * + * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected + * [`funding_created`]: msgs::FundingCreated + * [`funding_transaction_generated`]: Self::funding_transaction_generated + * [`BlockHash`]: bitcoin::hash_types::BlockHash + * [`update_channel`]: chain::Watch::update_channel + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`timer_tick_occurred`]: Self::timer_tick_occurred + * [`read`]: ReadableArgs::read */ typedef struct MUST_USE_STRUCT LDKChannelManager { /** @@ -8816,6 +9812,99 @@ 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_UntrustedStringDecodeErrorZ + */ +typedef union LDKCResult_UntrustedStringDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKUntrustedString *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_UntrustedStringDecodeErrorZPtr; + +/** + * A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::string::UntrustedString 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_UntrustedStringDecodeErrorZ { + /** + * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_UntrustedStringDecodeErrorZPtr contents; + /** + * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_UntrustedStringDecodeErrorZ; + /** * The contents of CResult_OutPointDecodeErrorZ */ @@ -8947,10 +10036,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. */ @@ -8968,10 +10053,7 @@ typedef struct MUST_USE_STRUCT LDKPaymentError { struct LDKStr invoice; }; struct { - struct LDKLightningError routing; - }; - struct { - struct LDKPaymentSendFailure sending; + enum LDKRetryableSendFailure sending; }; }; } LDKPaymentError; @@ -9074,39 +10156,6 @@ typedef struct LDKCResult_StringErrorZ { bool result_ok; } LDKCResult_StringErrorZ; -/** - * The contents of CResult_PublicKeyErrorZ - */ -typedef union LDKCResult_PublicKeyErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - 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; - -/** - * 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 struct LDKCResult_PublicKeyErrorZ { - /** - * The contents of this CResult_PublicKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PublicKeyErrorZPtr contents; - /** - * Whether this CResult_PublicKeyErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PublicKeyErrorZ; - /** * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ */ @@ -9308,7 +10357,7 @@ typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * A dynamically-allocated array of crate::lightning::events::Events of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_EventZ { @@ -9725,6 +10774,36 @@ typedef struct LDKCOption_NetAddressZ { }; } LDKCOption_NetAddressZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ { + /** + * The element at position 0 + */ + struct LDKPublicKey a; + /** + * The element at position 1 + */ + struct LDKCOption_NetAddressZ b; +} LDKC2Tuple_PublicKeyCOption_NetAddressZZ; + +/** + * 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_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_PublicKeyCOption_NetAddressZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ; + /** @@ -9878,15 +10957,15 @@ typedef enum LDKSendError_Tag { */ LDKSendError_BufferFull, /** - * Failed to retrieve our node id from the provided [`KeysInterface`]. + * Failed to retrieve our node id from the provided [`NodeSigner`]. * - * [`KeysInterface`]: crate::chain::keysinterface::KeysInterface + * [`NodeSigner`]: crate::chain::keysinterface::NodeSigner */ LDKSendError_GetNodeIdFailed, /** * 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 - * [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the + * [`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. */ LDKSendError_BlindedPathAdvanceFailed, @@ -9937,6 +11016,104 @@ typedef struct LDKCResult_NoneSendErrorZ { bool result_ok; } LDKCResult_NoneSendErrorZ; +/** + * The contents of CResult_BlindedPathNoneZ + */ +typedef union LDKCResult_BlindedPathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedPath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_BlindedPathNoneZPtr; + +/** + * A CResult_BlindedPathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +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::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; + +/** + * 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::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; + /** * Sub-errors which don't have specific information in them use this type. */ @@ -10040,9 +11217,11 @@ typedef struct 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)` + * 1. using [`InvoiceBuilder`] + * 2. using [`Invoice::from_signed`] + * 3. using `str::parse::(&str)` (see [`Invoice::from_str`]) + * + * [`Invoice::from_str`]: crate::Invoice#impl-FromStr */ typedef struct MUST_USE_STRUCT LDKInvoice { /** @@ -10127,11 +11306,11 @@ typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { /** - * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be + * 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`. + * The hash has to be either from the deserialized invoice or from the serialized [`RawInvoice`]. */ typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { /** @@ -10184,11 +11363,11 @@ typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { /** - * Represents an syntactically correct Invoice for a payment on the lightning network, + * 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. + * Decoding and encoding should not lead to information loss but may lead to different hashes. * - * For methods without docs see the corresponding methods in `Invoice`. + * For methods without docs see the corresponding methods in [`Invoice`]. */ typedef struct MUST_USE_STRUCT LDKRawInvoice { /** @@ -10459,6 +11638,22 @@ typedef struct LDKCResult_InvoiceSemanticErrorZ { bool result_ok; } LDKCResult_InvoiceSemanticErrorZ; +/** + * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_AddressZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKStr *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_AddressZ; + /** @@ -10548,71 +11743,6 @@ typedef struct LDKCResult_PrivateRouteCreationErrorZ { bool result_ok; } LDKCResult_PrivateRouteCreationErrorZ; -/** - * All-encompassing standard error type that processing can return - */ -typedef enum LDKGraphSyncError_Tag { - /** - * Error trying to read the update data, typically due to an erroneous data length indication - * that is greater than the actual amount of data provided - */ - LDKGraphSyncError_DecodeError, - /** - * Error applying the patch to the network graph, usually the result of updates that are too - * old or missing prerequisite data to the application of updates out of order - */ - LDKGraphSyncError_LightningError, - /** - * Must be last for serialization purposes - */ - LDKGraphSyncError_Sentinel, -} LDKGraphSyncError_Tag; - -typedef struct MUST_USE_STRUCT LDKGraphSyncError { - LDKGraphSyncError_Tag tag; - union { - struct { - struct LDKDecodeError decode_error; - }; - struct { - struct LDKLightningError lightning_error; - }; - }; -} LDKGraphSyncError; - -/** - * The contents of CResult_u32GraphSyncErrorZ - */ -typedef union LDKCResult_u32GraphSyncErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - uint32_t *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKGraphSyncError *err; -} LDKCResult_u32GraphSyncErrorZPtr; - -/** - * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, - * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_u32GraphSyncErrorZ { - /** - * The contents of this CResult_u32GraphSyncErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_u32GraphSyncErrorZPtr contents; - /** - * Whether this CResult_u32GraphSyncErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_u32GraphSyncErrorZ; - /** * The contents of CResult_NetAddressDecodeErrorZ */ @@ -10649,7 +11779,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 { /** @@ -10685,7 +11817,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 { /** @@ -10721,7 +11855,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 { /** @@ -10757,7 +11893,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 { /** @@ -10926,6 +12064,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. */ @@ -10980,7 +12119,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 { /** @@ -11132,7 +12273,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 { /** @@ -11350,7 +12493,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 { /** @@ -11469,7 +12614,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 { /** @@ -11522,7 +12668,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 { /** @@ -11575,7 +12723,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 { /** @@ -11691,26 +12841,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 */ @@ -11843,26 +12973,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 */ @@ -11896,26 +13006,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 */ @@ -11985,10 +13075,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 { /** @@ -12154,7 +13246,7 @@ typedef struct LDKCVec_PhantomRouteHintsZ { } LDKCVec_PhantomRouteHintsZ; /** - * When signing using a fallible method either an user-supplied `SignError` or a `CreationError` + * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`] * may occur. */ typedef enum LDKSignOrCreationError_Tag { @@ -12216,6 +13308,44 @@ typedef struct LDKCResult_InvoiceSignOrCreationErrorZ { +/** + * A simple future which can complete once, and calls some callback(s) when it does so. + * + * Clones can be made and all futures cloned from the same source will complete at the same time. + */ +typedef struct MUST_USE_STRUCT LDKFuture { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeFuture *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; +} LDKFuture; + +/** + * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_FutureZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKFuture *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_FutureZ; + + + /** * A transaction output watched by a [`ChannelMonitor`] for spends on-chain. * @@ -12458,135 +13588,74 @@ typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { } LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; /** - * A trait indicating an object may generate message send events + * All-encompassing standard error type that processing can return */ -typedef struct LDKMessageSendEventsProvider { +typedef enum LDKGraphSyncError_Tag { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * Error trying to read the update data, typically due to an erroneous data length indication + * that is greater than the actual amount of data provided */ - void *this_arg; + LDKGraphSyncError_DecodeError, /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * Error applying the patch to the network graph, usually the result of updates that are too + * old or missing prerequisite data to the application of updates out of order */ - struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + LDKGraphSyncError_LightningError, /** - * 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. + * Must be last for serialization purposes */ - void (*free)(void *this_arg); -} LDKMessageSendEventsProvider; + LDKGraphSyncError_Sentinel, +} LDKGraphSyncError_Tag; -/** - * A trait indicating an object may generate onion messages to send - */ -typedef struct LDKOnionMessageProvider { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Gets the next pending onion message for the peer with the given node id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKOnionMessageProvider; +typedef struct MUST_USE_STRUCT LDKGraphSyncError { + LDKGraphSyncError_Tag tag; + union { + struct { + struct LDKDecodeError decode_error; + }; + struct { + struct LDKLightningError lightning_error; + }; + }; +} LDKGraphSyncError; /** - * 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`. + * The contents of CResult_u32GraphSyncErrorZ */ -typedef struct LDKEventHandler { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef union LDKCResult_u32GraphSyncErrorZPtr { /** - * Handles the given [`Event`]. - * - * See [`EventsProvider`] for details that must be considered when implementing this method. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*handle_event)(const void *this_arg, struct LDKEvent event); + uint32_t *result; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*free)(void *this_arg); -} LDKEventHandler; + struct LDKGraphSyncError *err; +} LDKCResult_u32GraphSyncErrorZPtr; /** - * A trait indicating an object may generate events. - * - * 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 - * event since the last invocation. - * - * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s - * and replay any unhandled events on startup. An [`Event`] is considered handled when - * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any - * relevant changes to disk *before* returning. - * - * Further, because an application may crash between an [`Event`] being handled and the - * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in - * effect, [`Event`]s may be replayed. - * - * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to - * consult the provider's documentation on the implication of processing events and how a handler - * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and - * [`ChainMonitor::process_pending_events`]). - * - * (C-not implementable) As there is likely no reason for a user to implement this trait on their - * own type(s). - * - * [`process_pending_events`]: Self::process_pending_events - * [`handle_event`]: EventHandler::handle_event - * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events - * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events - * [`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 + * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, + * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKEventsProvider { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef struct LDKCResult_u32GraphSyncErrorZ { /** - * Processes any events generated since the last call using the given event handler. - * - * See the trait-level documentation for requirements. + * The contents of this CResult_u32GraphSyncErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); + union LDKCResult_u32GraphSyncErrorZPtr contents; /** - * 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. + * Whether this CResult_u32GraphSyncErrorZ represents a success state. */ - void (*free)(void *this_arg); -} LDKEventsProvider; + bool result_ok; +} LDKCResult_u32GraphSyncErrorZ; /** - * 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 @@ -12688,22 +13757,23 @@ typedef struct LDKFutureCallback { /** - * A simple future which can complete once, and calls some callback(s) when it does so. + * A struct which can be used to select across many [`Future`]s at once without relying on a full + * async context. */ -typedef struct MUST_USE_STRUCT LDKFuture { +typedef struct MUST_USE_STRUCT LDKSleeper { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFuture *inner; + LDKnativeSleeper *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; -} LDKFuture; +} LDKSleeper; @@ -12734,7 +13804,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. * @@ -12922,6 +13992,9 @@ typedef struct LDKConfirm { * 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. @@ -13029,7 +14102,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. @@ -13047,8 +14120,15 @@ typedef struct LDKPersist { * or used independently to monitor channels remotely. See the [module-level documentation] for * details. * + * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from + * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, + * detecting substantial mempool feerate changes between blocks, and ensuring reliability if + * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an + * environment with spotty connections, like on mobile. + * * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [module-level documentation]: crate::chain::chainmonitor + * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims */ typedef struct MUST_USE_STRUCT LDKChainMonitor { /** @@ -13065,11 +14145,104 @@ typedef struct MUST_USE_STRUCT LDKChainMonitor { bool is_owned; } LDKChainMonitor; +/** + * A trait implemented for objects handling events from [`EventsProvider`]. + * + * An async variation also exists for implementations of [`EventsProvider`] that support async + * event handling. The async event handler should satisfy the generic bounds: `F: + * core::future::Future, H: Fn(Event) -> F`. + */ +typedef struct LDKEventHandler { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Handles the given [`Event`]. + * + * See [`EventsProvider`] for details that must be considered when implementing this method. + */ + void (*handle_event)(const void *this_arg, struct LDKEvent event); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKEventHandler; + +/** + * A trait indicating an object may generate events. + * + * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. + * + * 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 + * event since the last invocation. + * + * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s + * and replay any unhandled events on startup. An [`Event`] is considered handled when + * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any + * relevant changes to disk *before* returning. + * + * Further, because an application may crash between an [`Event`] being handled and the + * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in + * effect, [`Event`]s may be replayed. + * + * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to + * consult the provider's documentation on the implication of processing events and how a handler + * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and + * [`ChainMonitor::process_pending_events`]). + * + * (C-not implementable) As there is likely no reason for a user to implement this trait on their + * own type(s). + * + * [`process_pending_events`]: Self::process_pending_events + * [`handle_event`]: EventHandler::handle_event + * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events + * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + * [`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 { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Processes any events generated since the last call using the given event handler. + * + * See the trait-level documentation for requirements. + */ + void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); + /** + * 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); +} LDKEventsProvider; + +/** + * 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`] implementation 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'. * Unilateral closes may use seed/1'. @@ -13155,11 +14328,69 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { bool is_owned; } LDKChainParameters; +/** + * Strategies available to retry payment path failures. + */ +typedef enum LDKRetry_Tag { + /** + * Max number of attempts to retry payment. + * + * Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a + * retry, and may retry multiple failed HTLCs at once if they failed around the same time and + * were retried along a route from a single call to [`Router::find_route_with_id`]. + */ + LDKRetry_Attempts, + /** + * Time elapsed before abandoning retries for a payment. At least one attempt at payment is made; + * see [`PaymentParameters::expiry_time`] to avoid any attempt at payment after a specific time. + * + * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + */ + LDKRetry_Timeout, + /** + * Must be last for serialization purposes + */ + LDKRetry_Sentinel, +} LDKRetry_Tag; + +typedef struct MUST_USE_STRUCT LDKRetry { + LDKRetry_Tag tag; + union { + struct { + uintptr_t attempts; + }; + struct { + uint64_t timeout; + }; + }; +} LDKRetry; + +/** + * A trait indicating an object may generate message send events + */ +typedef struct LDKMessageSendEventsProvider { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + */ + struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKMessageSendEventsProvider; + /** * A trait 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 { /** @@ -13168,93 +14399,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); /** @@ -13337,9 +14562,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 { /** @@ -13360,8 +14585,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 { @@ -13394,8 +14620,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 { @@ -13405,36 +14631,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 @@ -13444,7 +14670,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 @@ -13459,15 +14685,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`] @@ -13493,6 +14726,28 @@ typedef struct LDKRoutingMessageHandler { void (*free)(void *this_arg); } LDKRoutingMessageHandler; +/** + * A trait indicating an object may generate onion messages to send + */ +typedef struct LDKOnionMessageProvider { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Gets the next pending onion message for the peer with the given node id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKOnionMessageProvider; + /** * A trait to describe an object that can receive onion messages. */ @@ -13503,7 +14758,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); /** @@ -13514,15 +14769,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`] @@ -13573,7 +14825,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 { /** @@ -13582,15 +14841,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); /** @@ -13705,7 +14964,7 @@ typedef struct MUST_USE_STRUCT LDKMessageHandler { * to a remote host. You will need to be able to generate multiple of these which meet Eq and * implement Hash to meet the PeerManager API. * - * For efficiency, Clone should be relatively cheap for this type. + * For efficiency, [`Clone`] should be relatively cheap for this type. * * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it @@ -13784,10 +15043,10 @@ typedef struct LDKSocketDescriptor { * [`PeerManager`] functions related to the same connection must occur only in serial, making new * calls only after previous ones have returned. * - * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager - * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefPeerManager, and use a - * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when + * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`] + * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but + * essentially you should default to using a [`SimpleRefPeerManager`], and use a + * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when * you're using lightning-net-tokio. * * [`read_event`]: PeerManager::read_event @@ -13831,6 +15090,66 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { bool is_owned; } LDKDirectedChannelTransactionParameters; + + +/** + * Features used within an `offer`. + */ +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; + + + +/** + * Features used within an `invoice_request`. + */ +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. + */ + 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; +} 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` */ @@ -13841,22 +15160,168 @@ typedef struct LDKWitnessVersion { /** - * A read-only view of [`NetworkGraph`]. + * A semantically valid [`Invoice`] that hasn't been signed. */ -typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { +typedef struct MUST_USE_STRUCT LDKUnsignedInvoice { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeUnsignedInvoice *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; +} LDKUnsignedInvoice; + + + +/** + * A semantically valid [`InvoiceRequest`] that hasn't been signed. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedInvoiceRequest *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKUnsignedInvoiceRequest; + + + +/** + * An `InvoiceRequest` is a request for an [`Invoice`] formulated from an [`Offer`]. + * + * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request + * specifies these such that its recipient can send an invoice for payment. + * + * [`Invoice`]: crate::offers::invoice::Invoice + * [`Offer`]: crate::offers::offer::Offer + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequest { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceRequest *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInvoiceRequest; + + + +/** + * An `Offer` is a potentially long-lived proposal for payment of a good or service. + * + * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a + * customer may request an [`Invoice`] for a specific quantity and using an amount sufficient to + * cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`]. + * + * Offers may be denominated in currency other than bitcoin but are ultimately paid using the + * latter. + * + * Through the use of [`BlindedPath`]s, offers provide recipient privacy. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Invoice`]: crate::offers::invoice::Invoice + */ +typedef struct MUST_USE_STRUCT LDKOffer { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOffer *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; +} LDKOffer; + + + +/** + * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or + * another currency. + */ +typedef struct MUST_USE_STRUCT LDKAmount { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeAmount *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKAmount; + + + +/** + * Quantity of items supported by an [`Offer`]. + */ +typedef struct MUST_USE_STRUCT LDKQuantity { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeQuantity *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKQuantity; + + + +/** + * A `Refund` is a request to send an [`Invoice`] without a preceding [`Offer`]. + * + * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to + * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a + * bitcoin ATM. + * + * [`Invoice`]: crate::offers::invoice::Invoice + * [`Offer`]: crate::offers::offer::Offer + */ +typedef struct MUST_USE_STRUCT LDKRefund { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRefund *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; +} LDKRefund; @@ -13884,6 +15349,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. @@ -13994,51 +15479,6 @@ typedef struct MUST_USE_STRUCT LDKDefaultRouter { bool is_owned; } LDKDefaultRouter; -/** - * 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, struct LDKInFlightHtlcs 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, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); - /** - * 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; - /** @@ -14064,6 +15504,37 @@ typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { bool is_owned; } LDKScorerAccountingForInFlightHtlcs; +/** + * Routing hints for the tail of the route. + */ +typedef enum LDKHints_Tag { + /** + * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves + * will be included in the final [`Route`]. + */ + LDKHints_Blinded, + /** + * The recipient included these route hints in their BOLT11 invoice. + */ + LDKHints_Clear, + /** + * Must be last for serialization purposes + */ + LDKHints_Sentinel, +} LDKHints_Tag; + +typedef struct MUST_USE_STRUCT LDKHints { + LDKHints_Tag tag; + union { + struct { + struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded; + }; + struct { + struct LDKCVec_RouteHintZ clear; + }; + }; +} LDKHints; + /** @@ -14143,16 +15614,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::blinded_path::BlindedPath; + * # use lightning::chain::keysinterface::KeysManager; * # use lightning::ln::peer_handler::IgnoringMessageHandler; - * # use lightning::onion_message::blinded_path::BlindedPath; - * # use lightning::onion_message::messenger::{CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger}; + * # use lightning::onion_message::messenger::{Destination, OnionMessenger}; + * # 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!() } * # } @@ -14168,7 +15639,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 { @@ -14193,7 +15664,7 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * // 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_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap(); + * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap(); * * // Send a custom onion message to a blinded path. * # let intermediate_hops = [hop_node_id1, hop_node_id2]; @@ -14309,17161 +15780,18977 @@ typedef struct MUST_USE_STRUCT LDKFilesystemPersister { /** - * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep - * Rust-Lightning running properly, and (2) either can or should be run in the background. Its - * responsibilities are: - * * Processing [`Event`]s with a user-provided [`EventHandler`]. - * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, - * writing it to disk/backups by invoking the callback given to it at startup. - * [`ChannelManager`] persistence should be done in the background. - * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`] - * at the appropriate intervals. - * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a - * [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]). - * - * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied - * upon as doing so may result in high latency. - * - * # Note - * - * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then - * there is a risk of channels force-closing on startup when the manager realizes it's outdated. - * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for - * unilateral chain closure fees are at risk. - * - * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor - * [`Event`]: lightning::util::events::Event - *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. + * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep + * Rust-Lightning running properly, and (2) either can or should be run in the background. Its + * responsibilities are: + * * Processing [`Event`]s with a user-provided [`EventHandler`]. + * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, + * writing it to disk/backups by invoking the callback given to it at startup. + * [`ChannelManager`] persistence should be done in the background. + * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`] + * and [`PeerManager::timer_tick_occurred`] at the appropriate intervals. + * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a + * [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]). + * + * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied + * upon as doing so may result in high latency. + * + * # Note + * + * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then + * there is a risk of channels force-closing on startup when the manager realizes it's outdated. + * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for + * unilateral chain closure fees are at risk. + * + * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor + * [`Event`]: lightning::events::Event + *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. + */ +typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBackgroundProcessor *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; +} LDKBackgroundProcessor; + + + +/** + * The main Rapid Gossip Sync object. + * + * See [crate-level documentation] for usage. + * + * [crate-level documentation]: crate + */ +typedef struct MUST_USE_STRUCT LDKRapidGossipSync { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRapidGossipSync *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; +} LDKRapidGossipSync; + +/** + * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + */ +typedef enum LDKGossipSync_Tag { + /** + * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. + */ + LDKGossipSync_P2P, + /** + * Rapid gossip sync from a trusted server. + */ + LDKGossipSync_Rapid, + /** + * No gossip sync. + */ + LDKGossipSync_None, + /** + * Must be last for serialization purposes + */ + LDKGossipSync_Sentinel, +} LDKGossipSync_Tag; + +typedef struct MUST_USE_STRUCT LDKGossipSync { + LDKGossipSync_Tag tag; + union { + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKP2PGossipSync p2p; + }; + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKRapidGossipSync rapid; + }; + }; +} LDKGossipSync; + + + +/** + * Data of the [`RawInvoice`] that is encoded in the data part + */ +typedef struct MUST_USE_STRUCT LDKRawDataPart { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRawDataPart *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; +} LDKRawDataPart; + + + +/** + * SHA-256 hash + */ +typedef struct MUST_USE_STRUCT LDKSha256 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSha256 *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSha256; + + + +/** + * Positive duration that defines when (relatively to the timestamp) in the future the invoice + * expires + */ +typedef struct MUST_USE_STRUCT LDKExpiryTime { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeExpiryTime *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKExpiryTime; + + + +/** + * `min_final_cltv_expiry_delta` to use for the last HTLC in the route + */ +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. + */ + 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; +} LDKMinFinalCltvExpiryDelta; + +/** + * A 20-byte byte array. + */ +typedef struct LDKTwentyBytes { + /** + * The twenty bytes + */ + uint8_t data[20]; +} LDKTwentyBytes; + +/** + * Fallback address in case no LN payment is possible + */ +typedef enum LDKFallback_Tag { + LDKFallback_SegWitProgram, + LDKFallback_PubKeyHash, + LDKFallback_ScriptHash, + /** + * Must be last for serialization purposes + */ + LDKFallback_Sentinel, +} LDKFallback_Tag; + +typedef struct LDKFallback_LDKSegWitProgram_Body { + struct LDKWitnessVersion version; + struct LDKCVec_u8Z program; +} LDKFallback_LDKSegWitProgram_Body; + +typedef struct MUST_USE_STRUCT LDKFallback { + LDKFallback_Tag tag; + union { + LDKFallback_LDKSegWitProgram_Body seg_wit_program; + struct { + struct LDKTwentyBytes pub_key_hash; + }; + struct { + struct LDKTwentyBytes script_hash; + }; + }; +} LDKFallback; + +extern const uintptr_t MAX_BUF_SIZE; + +extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; + +extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; + +extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; + +extern const uint32_t ANTI_REORG_DELAY; + +extern const uint16_t BREAKDOWN_TIMEOUT; + +extern const uint16_t MIN_CLTV_EXPIRY_DELTA; + +extern const 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; + +extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; + +extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t DEFAULT_MAX_PATH_COUNT; + +extern const uint64_t MAX_TIMESTAMP; + +extern const uint64_t DEFAULT_EXPIRY_TIME; + +extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t TAG_PAYMENT_HASH; + +extern const uint8_t TAG_DESCRIPTION; + +extern const uint8_t TAG_PAYEE_PUB_KEY; + +extern const uint8_t TAG_DESCRIPTION_HASH; + +extern const uint8_t TAG_EXPIRY_TIME; + +extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t TAG_FALLBACK; + +extern const uint8_t TAG_PRIVATE_ROUTE; + +extern const uint8_t TAG_PAYMENT_SECRET; + +extern const uint8_t TAG_PAYMENT_METADATA; + +extern const uint8_t TAG_FEATURES; + +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 + */ +struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); + +/** + * Creates a new Bech32Error which has the same data as `orig` + */ +struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `Bech32Error` (which is currently none) + */ +void Bech32Error_free(struct LDKBech32Error o); + +/** + * Frees the data buffer, if data_is_owned is set and datalen > 0. + */ +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 + */ +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); + +/** + * Frees the data pointed to by script_pubkey. + */ +void TxOut_free(struct LDKTxOut _res); + +/** + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + */ +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +/** + * Frees the data buffer, if chars_is_owned is set and len > 0. + */ +void Str_free(struct LDKStr _res); + +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif + +/** + * Constructs a new COption_DurationZ containing a u64 + */ +struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o); + +/** + * Constructs a new COption_DurationZ containing nothing + */ +struct LDKCOption_DurationZ COption_DurationZ_none(void); + +/** + * Frees any resources associated with the u64, if we are in the Some state + */ +void COption_DurationZ_free(struct LDKCOption_DurationZ _res); + +/** + * Creates a new COption_DurationZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _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); + +/** + * Creates a new CResult_NoneAPIErrorZ in the success state. + */ +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); + +/** + * Creates a new CResult_NoneAPIErrorZ in the error state. + */ +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneAPIErrorZ. + */ +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); + +/** + * Creates a new CResult_NoneAPIErrorZ 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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_u8Z_free(struct LDKCVec_u8Z _res); + +/** + * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o); + +/** + * Constructs a new COption_CVec_u8ZZ containing nothing + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + */ +void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res); + +/** + * Creates a new COption_CVec_u8ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state. + */ +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state. + */ +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ. + */ +void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim + */ +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); + +/** + * Constructs a new COption_HTLCClaimZ containing nothing + */ +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state + */ +void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); + +/** + * Creates a new CResult_NoneNoneZ in the success state. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); + +/** + * Creates a new CResult_NoneNoneZ in the error state. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneNoneZ. + */ +void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); + +/** + * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + */ +void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + */ +void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + */ +void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_u32Z containing a u32 + */ +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); + +/** + * Constructs a new COption_u32Z containing nothing + */ +struct LDKCOption_u32Z COption_u32Z_none(void); + +/** + * Frees any resources associated with the u32, if we are in the Some state + */ +void COption_u32Z_free(struct LDKCOption_u32Z _res); + +/** + * Creates a new COption_u32Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + */ +void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); + +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_NoneZ containing a + */ +enum LDKCOption_NoneZ COption_NoneZ_some(void); + +/** + * Constructs a new COption_NoneZ containing nothing + */ +enum LDKCOption_NoneZ COption_NoneZ_none(void); + +/** + * Frees any resources associated with the , if we are in the Some state + */ +void COption_NoneZ_free(enum LDKCOption_NoneZ _res); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + */ +void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); + +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + */ +void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); + +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); + +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + */ +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); + +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); + +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + */ +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); + +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); + +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + */ +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + */ +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); + +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + */ +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); + +/** + * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); + +/** + * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + */ +void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); + +/** + * 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); + +/** + * 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); + +/** + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o); + +/** + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. + */ +void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *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); + +/** + * Frees any resources used by the CResult_NoneErrorZ. + */ +void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); + +/** + * Creates a new CResult_NoneErrorZ 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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); + +/** + * Creates a new CResult_RouteLightningErrorZ in the success state. + */ +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); + +/** + * Creates a new CResult_RouteLightningErrorZ in the error state. + */ +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteLightningErrorZ. + */ +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); + +/** + * Creates a new CResult_RouteLightningErrorZ 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); + +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); + +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + */ +void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); + +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); + +/** + * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + */ +void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +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_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res); + +/** + * Creates a new CResult_BlindedTailDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o); + +/** + * Creates a new CResult_BlindedTailDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedTailDecodeErrorZ. + */ +void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *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. + */ +void CVec_PathZ_free(struct LDKCVec_PathZ _res); + +/** + * Creates a new CResult_RouteDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); + +/** + * Creates a new CResult_RouteDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteDecodeErrorZ. + */ +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); + +/** + * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + */ +void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_u64Z_free(struct LDKCVec_u64Z _res); + +/** + * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); + +/** + * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. + */ +void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements. + */ +struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b); + +/** + * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ. + */ +void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + */ +void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + */ +void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _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); + +/** + * Frees any resources used by the C2Tuple_usizeTransactionZ. + */ +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +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_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_TxidBlockHashZ from the contained elements. + */ +struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_TxidBlockHashZ. + */ +void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements. + */ +struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c); + +/** + * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ. + */ +void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res); + +/** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + */ +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); + +/** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + */ +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + */ +void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); + +/** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *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_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64u64Z from the contained elements. + */ +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); + +/** + * Frees any resources used by the C2Tuple_u64u64Z. + */ +void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); + +/** + * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); + +/** + * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + */ +void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); + +/** + * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +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. + */ +void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); + +/** + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + */ +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); + +/** + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + */ +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + */ +void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); + +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); + +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + */ +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + */ +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + */ +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_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 */ -typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeBackgroundProcessor *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; -} LDKBackgroundProcessor; +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_InvoiceFeaturesDecodeErrorZ 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); /** - * The main Rapid Gossip Sync object. - * - * See [crate-level documentation] for usage. - * - * [crate-level documentation]: crate + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKRapidGossipSync { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRapidGossipSync *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; -} LDKRapidGossipSync; +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); /** - * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. */ -typedef enum LDKGossipSync_Tag { - /** - * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. - */ - LDKGossipSync_P2P, - /** - * Rapid gossip sync from a trusted server. - */ - LDKGossipSync_Rapid, - /** - * No gossip sync. - */ - LDKGossipSync_None, - /** - * Must be last for serialization purposes - */ - LDKGossipSync_Sentinel, -} LDKGossipSync_Tag; +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct MUST_USE_STRUCT LDKGossipSync { - LDKGossipSync_Tag tag; - union { - struct { - /** - * Note that this field is expected to be a reference. - */ - struct LDKP2PGossipSync p2p; - }; - struct { - /** - * Note that this field is expected to be a reference. - */ - struct LDKRapidGossipSync rapid; - }; - }; -} LDKGossipSync; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. + */ +void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Data of the `RawInvoice` that is encoded in the data part + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKRawDataPart { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRawDataPart *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; -} LDKRawDataPart; +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * SHA-256 hash + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKSha256 { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSha256 *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSha256; +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); /** - * Positive duration that defines when (relatively to the timestamp) in the future the invoice - * expires + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKExpiryTime { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeExpiryTime *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKExpiryTime; +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_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); +/** + * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. + */ +void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); /** - * `min_final_cltv_expiry` to use for the last HTLC in the route + * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMinFinalCltvExpiry *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKMinFinalCltvExpiry; +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); /** - * A 20-byte byte array. + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate */ -typedef struct LDKTwentyBytes { - /** - * The twenty bytes - */ - uint8_t data[20]; -} LDKTwentyBytes; +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); /** - * Fallback address in case no LN payment is possible + * Constructs a new COption_NetworkUpdateZ containing nothing */ -typedef enum LDKFallback_Tag { - LDKFallback_SegWitProgram, - LDKFallback_PubKeyHash, - LDKFallback_ScriptHash, - /** - * Must be last for serialization purposes - */ - LDKFallback_Sentinel, -} LDKFallback_Tag; +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); -typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKU5 version; - struct LDKCVec_u8Z program; -} LDKFallback_LDKSegWitProgram_Body; +/** + * 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); -typedef struct MUST_USE_STRUCT LDKFallback { - LDKFallback_Tag tag; - union { - LDKFallback_LDKSegWitProgram_Body seg_wit_program; - struct { - struct LDKTwentyBytes pub_key_hash; - }; - struct { - struct LDKTwentyBytes script_hash; - }; - }; -} LDKFallback; +/** + * Creates a new COption_NetworkUpdateZ 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); /** - * A trait defining behavior of an [`Invoice`] payer. - * - * While the behavior of [`InvoicePayer`] provides idempotency of duplicate `send_*payment` calls - * with the same [`PaymentHash`], it is up to the `Payer` to provide idempotency across restarts. - * - * [`ChannelManager`] provides idempotency for duplicate payments with the same [`PaymentId`]. - * - * In order to trivially ensure idempotency for payments, the default `Payer` implementation - * reuses the [`PaymentHash`] bytes as the [`PaymentId`]. Custom implementations wishing to - * provide payment idempotency with a different idempotency key (i.e. [`PaymentId`]) should map - * the [`Invoice`] or spontaneous payment target pubkey to their own idempotency key. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure */ -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_NonePaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); - /** - * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. - */ - struct LDKCResult_NonePaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); - /** - * 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); - /** - * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity - * across payments. - */ - struct LDKInFlightHtlcs (*inflight_htlcs)(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); -} LDKPayer; +struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); +/** + * Constructs a new COption_PathFailureZ containing nothing + */ +struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); +/** + * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state + */ +void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); /** - * A utility for paying [`Invoice`]s and sending spontaneous payments. - * - * See [module-level documentation] for details. - * - * [module-level documentation]: crate::payment + * Creates a new COption_PathFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -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; +struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); /** - * Strategies available to retry payment path failures for an [`Invoice`]. - * + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. */ -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; +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); -typedef struct MUST_USE_STRUCT LDKRetry { - LDKRetry_Tag tag; - union { - struct { - uintptr_t attempts; - }; - struct { - uint64_t timeout; - }; - }; -} LDKRetry; +/** + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t MAX_BUF_SIZE; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +/** + * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. + */ +void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); -extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; +/** + * 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_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +/** + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); -extern const uint32_t ANTI_REORG_DELAY; +/** + * Constructs a new COption_ClosureReasonZ containing nothing + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); -extern const uint16_t BREAKDOWN_TIMEOUT; +/** + * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state + */ +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); -extern const uint16_t MIN_CLTV_EXPIRY_DELTA; +/** + * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); -extern const uint32_t MIN_FINAL_CLTV_EXPIRY; +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); -extern const uint16_t MAX_HTLCS; +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); -extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; +/** + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + */ +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); -extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; +/** + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); -extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; +/** + * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination + */ +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); -extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; +/** + * Constructs a new COption_HTLCDestinationZ containing nothing + */ +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); -extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; +/** + * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state + */ +void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); -extern const uint8_t DEFAULT_MAX_PATH_COUNT; +/** + * Creates a new COption_HTLCDestinationZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); -extern const uint64_t MAX_TIMESTAMP; +/** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); -extern const uint64_t DEFAULT_EXPIRY_TIME; +/** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_PAYMENT_HASH; +/** + * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. + */ +void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); -extern const uint8_t TAG_DESCRIPTION; +/** + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); -extern const uint8_t TAG_PAYEE_PUB_KEY; +/** + * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state. + */ +struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o); -extern const uint8_t TAG_DESCRIPTION_HASH; +/** + * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state. + */ +struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint8_t TAG_EXPIRY_TIME; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; +/** + * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ. + */ +void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res); -extern const uint8_t TAG_FALLBACK; +/** + * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig); -extern const uint8_t TAG_PRIVATE_ROUTE; +/** + * Constructs a new COption_u128Z containing a crate::c_types::U128 + */ +struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); -extern const uint8_t TAG_PAYMENT_SECRET; +/** + * Constructs a new COption_u128Z containing nothing + */ +struct LDKCOption_u128Z COption_u128Z_none(void); -extern const uint8_t TAG_FEATURES; +/** + * Frees any resources associated with the crate::c_types::U128, if we are in the Some state + */ +void COption_u128Z_free(struct LDKCOption_u128Z _res); -struct LDKStr _ldk_get_compiled_version(void); +/** + * Creates a new COption_u128Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); -struct LDKStr _ldk_c_bindings_get_compiled_version(void); +/** + * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason + */ +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o); /** - * Gets the 128-bit integer, as 16 little-endian bytes + * Constructs a new COption_PaymentFailureReasonZ containing nothing */ -struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void); /** - * Constructs a new U128 from 16 little-endian bytes + * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state */ -struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); +void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res); /** - * Convenience function for constructing a new BigEndianScalar + * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig); /** - * Creates a new Bech32Error which has the same data as `orig` + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); /** - * Releases any memory held by the given `Bech32Error` (which is currently none) + * Constructs a new COption_EventZ containing a crate::lightning::events::Event */ -void Bech32Error_free(struct LDKBech32Error o); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Frees the data buffer, if data_is_owned is set and datalen > 0. + * Constructs a new COption_EventZ containing nothing */ -void Transaction_free(struct LDKTransaction _res); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Frees the data pointed to by data + * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state */ -void Witness_free(struct LDKWitness _res); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Convenience function for constructing a new TxOut + * Creates a new COption_EventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Frees the data pointed to by script_pubkey. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -void TxOut_free(struct LDKTxOut _res); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Checks if the given object is currently in the success state */ -void Str_free(struct LDKStr _res); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); /** - * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim + * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_HTLCClaimZ containing nothing + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); +void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res); /** - * Creates a new CResult_NoneNoneZ in the success state. + * Creates a new CResult_PublicKeyErrorZ in the success state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_NoneNoneZ in the error state. + * Creates a new CResult_PublicKeyErrorZ in the error state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneNoneZ. + * Frees any resources used by the CResult_PublicKeyErrorZ. */ -void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); /** - * Creates a new CResult_NoneNoneZ 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_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + * Creates a new CResult_NodeIdDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + * Creates a new CResult_NodeIdDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); +bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + * Frees any resources used by the CResult_NodeIdDecodeErrorZ. */ -void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); +void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. */ -void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + * Constructs a new COption_UtxoLookupZ containing nothing */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state */ -bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); +void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); /** - * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + * Creates a new CResult_boolLightningErrorZ in the success state. */ -void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_boolLightningErrorZ in the error state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); /** - * Constructs a new COption_u32Z containing a u32 + * Checks if the given object is currently in the success state */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_u32Z containing nothing + * Frees any resources used by the CResult_boolLightningErrorZ. */ -struct LDKCOption_u32Z COption_u32Z_none(void); +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); /** - * Frees any resources associated with the u32, if we are in the Some state + * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_u32Z 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 LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ */ -bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); /** - * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing */ -void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` + * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state + */ +void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); + +/** + * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); /** - * Constructs a new COption_NoneZ containing a + * Creates a new CResult_NoneLightningErrorZ in the success state. */ -enum LDKCOption_NoneZ COption_NoneZ_some(void); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); /** - * Constructs a new COption_NoneZ containing nothing + * Creates a new CResult_NoneLightningErrorZ in the error state. */ -enum LDKCOption_NoneZ COption_NoneZ_none(void); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); /** - * Frees any resources associated with the , if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_NoneZ_free(enum LDKCOption_NoneZ _res); +bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + * Frees any resources used by the CResult_NoneLightningErrorZ. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); + +/** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. */ -void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. */ -void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. */ -void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. */ -bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); /** - * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ 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_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. */ -void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); +bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. */ -bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. */ -bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_CVec_NetAddressZZ containing nothing */ -bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * Creates a new COption_CVec_NetAddressZZ 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 LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_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); +bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); +bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ 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); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedPathNoneZ in the success state. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. */ -struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); /** - * Creates a new CResult_BlindedPathNoneZ in the error state. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. */ -struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o); +bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedPathNoneZ. + * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. */ -void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); /** - * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ 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); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedPathDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res); /** - * Checks if the given object is currently 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. */ -bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_BlindedPathDecodeErrorZ. + * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. */ -void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res); +struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); /** - * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. */ -struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. */ -void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); +void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); /** - * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ 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); +struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + * Creates a new CResult_SignatureNoneZ in the success state. */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); /** - * Constructs a new COption_WriteableScoreZ containing nothing + * Creates a new CResult_SignatureNoneZ in the error state. */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); /** - * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); +bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Frees any resources used by the CResult_SignatureNoneZ. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Creates a new CResult_SignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_PublicKeyNoneZ in the success state. */ -bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Creates a new CResult_PublicKeyNoneZ in the error state. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); /** - * Creates a new CResult_NoneErrorZ 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_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PublicKeyNoneZ. */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_ScalarZ containing nothing */ -bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); +struct LDKCOption_ScalarZ COption_ScalarZ_none(void); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SharedSecretNoneZ in the success state. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_SharedSecretNoneZ in the error state. */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); /** - * Constructs a new COption_u64Z containing a u64 + * Checks if the given object is currently in the success state */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o); /** - * Constructs a new COption_u64Z containing nothing + * Frees any resources used by the CResult_SharedSecretNoneZ. */ -struct LDKCOption_u64Z COption_u64Z_none(void); +void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); /** - * Frees any resources associated with the u64, if we are in the Some state + * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); /** - * Creates a new COption_u64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +void CVec_U5Z_free(struct LDKCVec_U5Z _res); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** * 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_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_RouteHopDecodeErrorZ. - */ -void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHopDecodeErrorZ 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_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); +void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ in the success state. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); /** - * Creates a new CResult_RouteDecodeErrorZ in the error state. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteDecodeErrorZ. + * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. */ -void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); +void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. */ -void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); /** - * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_u64Z_free(struct LDKCVec_u64Z _res); +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + * Creates a new CResult_TransactionNoneZ in the success state. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + * Creates a new CResult_TransactionNoneZ in the error state. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. + * Frees any resources used by the CResult_TransactionNoneZ. */ -void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_TransactionNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. */ -void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); +struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); +void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. */ -bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); /** - * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. */ -void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); /** - * Creates a new CResult_RouteHintDecodeErrorZ 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_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); +bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); +void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + * Constructs a new COption_u16Z containing a u16 */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_u16Z containing nothing */ -bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_u16Z COption_u16Z_none(void); /** - * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + * Frees any resources associated with the u16, if we are in the Some state */ -void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); +void COption_u16Z_free(struct LDKCOption_u16Z _res); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` + * Creates a new COption_u16Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. + * Creates a new CResult__u832APIErrorZ in the success state. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. + * Creates a new CResult__u832APIErrorZ in the error state. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError 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__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. + * Frees any resources used by the CResult__u832APIErrorZ. */ -void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); +void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ 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_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); +void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); /** - * Constructs a new COption_ClosureReasonZ containing nothing + * Creates a new CResult_NonePaymentSendFailureZ in the success state. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); /** - * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state + * Creates a new CResult_NonePaymentSendFailureZ in the error state. */ -void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * Checks if the given object is currently in the success state + */ +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NonePaymentSendFailureZ. + */ +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 LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + * Creates a new CResult_NoneRetryableSendFailureZ in the success state. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + * Creates a new CResult_NoneRetryableSendFailureZ in the error state. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); +bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + * Frees any resources used by the CResult_NoneRetryableSendFailureZ. */ -void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); +void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ 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_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); /** - * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Constructs a new COption_HTLCDestinationZ containing nothing + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); +bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); /** - * Creates a new COption_HTLCDestinationZ which has the same data as `orig` + * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. + */ +void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); + +/** + * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the success state. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. + * Creates a new CResult_PaymentHashRetryableSendFailureZ in the error state. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentHashRetryableSendFailureZ_is_ok(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. + * Frees any resources used by the CResult_PaymentHashRetryableSendFailureZ. */ -void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); +void CResult_PaymentHashRetryableSendFailureZ_free(struct LDKCResult_PaymentHashRetryableSendFailureZ _res); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ 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_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentHashRetryableSendFailureZ CResult_PaymentHashRetryableSendFailureZ_clone(const struct LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR orig); /** - * Constructs a new COption_u128Z containing a crate::c_types::U128 + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); /** - * Constructs a new COption_u128Z containing nothing + * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. */ -struct LDKCOption_u128Z COption_u128Z_none(void); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Frees any resources associated with the crate::c_types::U128, if we are in the Some state + * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. */ -void COption_u128Z_free(struct LDKCOption_u128Z _res); +void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); /** - * Creates a new COption_u128Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. */ -struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); /** - * Creates a new COption_NetworkUpdateZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ 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 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); - -/** - * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event - */ -struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); /** - * Constructs a new COption_EventZ containing nothing + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_EventZ COption_EventZ_none(void); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state + * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. */ -void COption_EventZ_free(struct LDKCOption_EventZ _res); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Creates a new COption_EventZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. */ -struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); +void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. */ -void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); +void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); /** - * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxOutAccessErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_TxOutAccessErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxOutAccessErrorZ. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. */ -void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); +void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); /** - * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *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_PaymentSecretNoneZ in the success state. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new C2Tuple_usizeTransactionZ from the contained elements. + * Creates a new CResult_PaymentSecretNoneZ in the error state. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); /** - * Frees any resources used by the C2Tuple_usizeTransactionZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PaymentSecretNoneZ. */ -void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidBlockHashZ from the contained elements. + * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. */ -struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees any resources used by the C2Tuple_TxidBlockHashZ. + * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. */ -void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res); +bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. */ -void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. */ -struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. */ -void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res); +bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); +void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. */ -bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); /** - * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. */ -void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ 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_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); +bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *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_CounterpartyForwardingInfoDecodeErrorZ. */ -struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); /** - * Creates a new C2Tuple_u64u64Z from the contained elements. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_u64u64Z. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. */ -void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); +bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. */ -void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); /** - * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. */ -void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. */ -bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); /** - * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. */ -bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); +bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. */ -bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); /** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ 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_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError */ -bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); /** - * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + * Constructs a new COption_APIErrorZ containing nothing */ -void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); +struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * 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 LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` + * 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_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. */ -struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_ok(struct LDKOfferFeatures o); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o); /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. */ -struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OfferFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. */ -void CResult_OfferFeaturesDecodeErrorZ_free(struct LDKCResult_OfferFeaturesDecodeErrorZ _res); +void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res); /** - * Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_clone(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(struct LDKInvoiceRequestFeatures o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ -void CResult_InvoiceRequestFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_NodeIdDecodeErrorZ in the success state. - */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); - -/** - * Creates a new CResult_NodeIdDecodeErrorZ in the error state. - */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NodeIdDecodeErrorZ. + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ -void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); /** - * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_TypeZ containing nothing */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_TypeZ COption_TypeZ_none(void); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. */ -bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. */ -struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Constructs a new COption_AccessZ containing nothing + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. */ -struct LDKCOption_AccessZ COption_AccessZ_none(void); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); /** - * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_AccessZ_free(struct LDKCOption_AccessZ _res); +bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_boolLightningErrorZ in the success state. + * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); /** - * Creates a new CResult_boolLightningErrorZ in the error state. + * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NonePaymentErrorZ in the success state. */ -bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); /** - * Frees any resources used by the CResult_boolLightningErrorZ. + * Creates a new CResult_NonePaymentErrorZ in the error state. */ -void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); /** - * Creates a new CResult_boolLightningErrorZ 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_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); +bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *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_NonePaymentErrorZ. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); +void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); /** - * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. + * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + * Creates a new CResult_StringErrorZ in the success state. */ -void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); /** - * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + * Creates a new CResult_StringErrorZ in the error state. */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); /** - * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); +bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state + * Frees any resources used by the CResult_StringErrorZ. */ -void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); +void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); /** - * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` + * Creates a new CResult_StringErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneLightningErrorZ in the success state. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); /** - * Creates a new CResult_NoneLightningErrorZ in the error state. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneLightningErrorZ. + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. */ -void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); /** - * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError 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_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ 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_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError 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_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. */ -void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ 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_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ 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_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); - -/** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. - */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ 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_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_OutPointScriptZ from the contained elements. */ -bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + * Frees any resources used by the C2Tuple_OutPointScriptZ. */ -void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); +void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ 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_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. + * Creates a new C2Tuple_u32ScriptZ from the contained elements. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_u32ScriptZ. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); +void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _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_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); +void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); /** - * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); +void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError 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_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); +void CVec_EventZ_free(struct LDKCVec_EventZ _res); /** - * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ 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_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + * Creates a new C2Tuple_u32TxOutZ from the contained elements. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_u32TxOutZ. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError 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_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); /** - * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Constructs a new COption_CVec_NetAddressZZ containing nothing + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); /** - * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); /** - * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. */ -void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents */ -bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); /** - * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + * Constructs a new COption_CustomOnionMessageContentsZ containing nothing */ -void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. */ -void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); +void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_NetAddressZ containing nothing */ -void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res); +struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig); +void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); /** - * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements. + * Creates a new COption_NetAddressZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b); +struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res); +struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state. + * Creates a new C2Tuple_PublicKeyCOption_NetAddressZZ from the contained elements. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o); +struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ C2Tuple_PublicKeyCOption_NetAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_NetAddressZ b); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state. + * Frees any resources used by the C2Tuple_PublicKeyCOption_NetAddressZZ. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void); +void C2Tuple_PublicKeyCOption_NetAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_NetAddressZZ _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_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o); +void CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res); /** - * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. */ -void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); /** - * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. */ -struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Creates a new CResult_SignatureNoneZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o); +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_SignatureNoneZ in the error state. + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void); +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_SignatureNoneZ. + * Creates a new CResult_NonePeerHandleErrorZ in the success state. */ -void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); /** - * Creates a new CResult_SignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NonePeerHandleErrorZ in the error state. */ -struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError 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_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig); +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_SignatureSignatureZ from the contained elements. + * Frees any resources used by the CResult_NonePeerHandleErrorZ. */ -struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b); +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); /** - * Frees any resources used by the C2Tuple_SignatureSignatureZ. + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state. + * Creates a new CResult_boolPeerHandleErrorZ in the success state. */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state. + * Creates a new CResult_boolPeerHandleErrorZ in the error state. */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * 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); +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ. + * Frees any resources used by the CResult_boolPeerHandleErrorZ. */ -void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res); +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); /** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ 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_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SecretKeyNoneZ in the success state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); /** - * Creates a new CResult_SecretKeyNoneZ in the error state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o); +bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SecretKeyNoneZ. + * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. */ -void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res); +void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); /** - * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig` + * Creates a new CResult_TxOutUtxoLookupErrorZ 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); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyNoneZ in the success state. + * Creates a new CResult_NoneSendErrorZ in the success state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); /** - * Creates a new CResult_PublicKeyNoneZ in the error state. + * Creates a new CResult_NoneSendErrorZ in the error state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyNoneZ. + * Frees any resources used by the CResult_NoneSendErrorZ. */ -void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); /** - * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_BlindedPathNoneZ in the success state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o); /** - * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar + * Creates a new CResult_BlindedPathNoneZ in the error state. */ -struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void); /** - * Constructs a new COption_ScalarZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_ScalarZ COption_ScalarZ_none(void); +bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state + * Frees any resources used by the CResult_BlindedPathNoneZ. */ -void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); +void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); /** - * Creates a new CResult_SharedSecretNoneZ in the success state. + * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_SharedSecretNoneZ in the error state. + * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); +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_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o); +bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SharedSecretNoneZ. + * Frees any resources used by the CResult_BlindedPathDecodeErrorZ. */ -void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); +void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res); /** - * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` + * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignDecodeErrorZ in the success state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); /** - * Creates a new CResult_SignDecodeErrorZ in the error state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SignDecodeErrorZ. + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. */ -void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_BlindedHopDecodeErrorZ 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_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Creates a new CResult_SiPrefixParseErrorZ in the success state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new CResult_SiPrefixParseErrorZ in the error state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); +bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Frees any resources used by the CResult_SiPrefixParseErrorZ. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ 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 LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +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_u8Z_free(struct LDKCVec_u8Z _res); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. */ -void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); +bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. + * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); +void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. */ -void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); +bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. + * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); +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_TxOutZ_free(struct LDKCVec_TxOutZ _res); +void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); /** - * Creates a new CResult_TransactionNoneZ in the success state. + * Creates a new CResult_PayeePubKeyErrorZ in the success state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new CResult_TransactionNoneZ in the error state. + * Creates a new CResult_PayeePubKeyErrorZ in the error state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TransactionNoneZ. + * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ -void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); +void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); /** - * Creates a new CResult_TransactionNoneZ which has the same data as `orig` + * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); /** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. + * Creates a new CResult_NoneSemanticErrorZ in the success state. */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); /** - * Constructs a new COption_u16Z containing a u16 + * Creates a new CResult_NoneSemanticErrorZ in the error state. */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); /** - * Constructs a new COption_u16Z containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_u16Z COption_u16Z_none(void); +bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the u16, if we are in the Some state + * Frees any resources used by the CResult_NoneSemanticErrorZ. */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); /** - * Creates a new COption_u16Z 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 LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult_InvoiceSemanticErrorZ in the success state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Creates a new CResult_InvoiceSemanticErrorZ in the error state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError 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_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); /** - * Creates a new CResult_NoneAPIErrorZ 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_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *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); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); +void CVec_AddressZ_free(struct LDKCVec_AddressZ _res); /** - * Creates a new CResult__u832APIErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult__u832APIErrorZ in the error state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError 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_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult__u832APIErrorZ. + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Creates a new CResult__u832APIErrorZ 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__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError 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_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_PrivateRouteCreationErrorZ 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_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. + * Creates a new CResult_NetAddressDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. + * Creates a new CResult_NetAddressDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. - */ -void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); +bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NetAddressDecodeErrorZ. */ -struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); +void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); +struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. */ -bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. + * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. */ -void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ 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_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. */ -void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); +void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. - */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); - -/** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. - */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); +bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. */ -void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); +bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. + * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. */ -void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentSecretNoneZ in the success state. + * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); /** - * Creates a new CResult_PaymentSecretNoneZ in the error state. + * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); +bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentSecretNoneZ. + * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. */ -void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); /** - * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); +bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. + * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. */ -void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); +void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); /** - * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); +bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. + * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. */ -void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. + * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); +bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. */ -void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); +void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + * Creates a new CResult_InitDecodeErrorZ in the success state. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + * Creates a new CResult_InitDecodeErrorZ in the error state. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); +bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. + * Frees any resources used by the CResult_InitDecodeErrorZ. */ -void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); - -/** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. - */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. + * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. + * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. */ -bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. + * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); +bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. + * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. */ -void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. + * Creates a new CResult_ShutdownDecodeErrorZ in the success state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); /** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownDecodeErrorZ in the error state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); +bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Frees any resources used by the CResult_ShutdownDecodeErrorZ. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ShutdownDecodeErrorZ 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); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *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_UpdateFailHTLCDecodeErrorZ in the success state. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError 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_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ 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_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); +bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ 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_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentErrorZ in the success state. + * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); /** - * Creates a new CResult_NonePaymentErrorZ in the error state. + * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o); +bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentErrorZ. + * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. */ -void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); /** - * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` + * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_StringErrorZ in the success state. + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); /** - * Creates a new CResult_StringErrorZ in the error state. + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_StringErrorZ. + * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); /** - * Creates a new CResult_StringErrorZ which has the same data as `orig` + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyErrorZ in the success state. + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); /** - * Creates a new CResult_PublicKeyErrorZ in the error state. + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); +bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyErrorZ. + * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); /** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + * Creates a new CResult_PingDecodeErrorZ in the success state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); /** - * Constructs a new COption_MonitorEventZ containing nothing + * Creates a new CResult_PingDecodeErrorZ in the error state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); +bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_MonitorEventZ which has the same data as `orig` + * Frees any resources used by the CResult_PingDecodeErrorZ. + */ +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); + +/** + * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + * Creates a new CResult_PongDecodeErrorZ in the success state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + * Creates a new CResult_PongDecodeErrorZ in the error state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); +bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + * Frees any resources used by the CResult_PongDecodeErrorZ. */ -void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PongDecodeErrorZ 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_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ 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_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *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_ChannelAnnouncementDecodeErrorZ in the success state. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError 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_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *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_ChannelAnnouncementDecodeErrorZ. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ 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_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError 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_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. */ -void CVec_EventZ_free(struct LDKCVec_EventZ _res); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *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_ChannelUpdateDecodeErrorZ. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); /** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. + * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_u32TxOutZ. + * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError 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_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. */ -void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); /** - * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. */ -void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing nothing + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. */ -void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); +bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. */ -void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError 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_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *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_QueryShortChannelIdsDecodeErrorZ. */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ 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_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError 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_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ 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_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError 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_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_QueryChannelRangeDecodeErrorZ 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_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError 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_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ 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_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError 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_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ in the success state. + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ 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_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixParseErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); +void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); + +/** + * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state. + */ +struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o); + +/** + * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state. + */ +struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); +bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SiPrefixParseErrorZ. + * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ. */ -void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); +void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceSignOrCreationErrorZ 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 LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); +void CVec_FutureZ_free(struct LDKCVec_FutureZ _res); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_FilterZ containing nothing */ -bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); +struct LDKCOption_FilterZ COption_FilterZ_none(void); /** - * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. + * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state */ -void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); +void COption_FilterZ_free(struct LDKCOption_FilterZ _res); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); +bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. */ -bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); +void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); /** - * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); +void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ 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_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); +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 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig); /** - * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. + * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b); /** - * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. + * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. */ -void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); +void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new CResult_u32GraphSyncErrorZ in the success state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_u32GraphSyncErrorZ in the error state. */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_u32GraphSyncErrorZ. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the APIError */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +void APIError_free(struct LDKAPIError this_ptr); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Creates a copy of the APIError */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Utility method to constructs a new APIMisuseError-variant APIError */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new FeeRateTooHigh-variant APIError */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Utility method to constructs a new InvalidRoute-variant APIError */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +struct LDKAPIError APIError_invalid_route(struct LDKStr err); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new ChannelUnavailable-variant APIError */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); /** - * Creates a new CResult_NoneSemanticErrorZ in the success state. + * Utility method to constructs a new MonitorUpdateInProgress-variant APIError */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); +struct LDKAPIError APIError_monitor_update_in_progress(void); /** - * Creates a new CResult_NoneSemanticErrorZ in the error state. + * Utility method to constructs a new IncompatibleShutdownScript-variant APIError */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); /** - * Checks if the given object is currently in the success state + * Checks if two APIErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); +bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); /** - * Frees any resources used by the CResult_NoneSemanticErrorZ. + * Serialize the APIError object into a byte array which can be read by APIError_read */ -void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); +struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); /** - * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a APIError from a byte array, created by APIError_write */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the success state. + * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); +void BigSize_free(struct LDKBigSize this_obj); + +uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); + +void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the error state. + * Constructs a new BigSize given each field */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. */ -bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); +void Hostname_free(struct LDKHostname this_obj); /** - * Frees any resources used by the CResult_InvoiceSemanticErrorZ. + * Creates a copy of the Hostname */ -void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); +struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two Hostnames contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); +bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Returns the length of the hostname. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Creates a digital signature of a message given a SecretKey, like the node's secret. + * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. + * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); /** - * Checks if the given object is currently in the success state + * Recovers the PublicKey of the signer of the message given the message and the signature. */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, + * and the PublicKey. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Construct the invoice's HRP and signatureless data into a preimage to be hashed. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +void Persister_free(struct LDKPersister this_ptr); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +void UntrustedString_free(struct LDKUntrustedString this_obj); + +struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr); + +void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Checks if the given object is currently in the success state + * Constructs a new UntrustedString given each field */ -bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Creates a copy of the UntrustedString */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two UntrustedStrings contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); /** - * Creates a new CResult_u32GraphSyncErrorZ in the success state. + * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); +struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj); /** - * Creates a new CResult_u32GraphSyncErrorZ in the error state. + * Read a UntrustedString from a byte array, created by UntrustedString_write */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); +struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. */ -bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); +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); /** - * Frees any resources used by the CResult_u32GraphSyncErrorZ. + * Constructs a new PrintableString given each field */ -void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); +MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o); +void FutureCallback_free(struct LDKFutureCallback this_ptr); /** - * Creates a new CResult_NetAddressDecodeErrorZ in the error state. + * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e); +void Future_free(struct LDKFuture this_obj); /** - * Checks if the given object is currently in the success state + * Creates a copy of the Future */ -bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o); +struct LDKFuture Future_clone(const struct LDKFuture *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NetAddressDecodeErrorZ. + * Registers a callback to be called upon completion of this future. If the future has already + * completed, the callback will be called immediately. */ -void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res); +void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); /** - * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Waits until this [`Future`] completes. */ -struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig); +void Future_wait(struct LDKFuture this_arg); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Waits until this [`Future`] completes or the given amount of time has elapsed. + * + * Returns true if the [`Future`] completed, false if the time elapsed. */ -void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); +MUST_USE_RES bool Future_wait_timeout(struct LDKFuture this_arg, uint64_t max_wait); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL. */ -void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); +void Sleeper_free(struct LDKSleeper this_obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new sleeper from one future, allowing blocking on it. */ -void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); +MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(struct LDKFuture future); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new sleeper from two futures, allowing blocking on both at once. */ -void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); +MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(struct LDKFuture fut_a, struct LDKFuture fut_b); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. + * Constructs a new sleeper on many futures, allowing blocking on all at once. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); +MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. + * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); +void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the + * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time + * elapsed. */ -bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait); /** - * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. + * Creates a copy of the Level */ -void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); +enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Gossip-variant Level */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); +enum LDKLevel Level_gossip(void); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. + * Utility method to constructs a new Trace-variant Level */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); +enum LDKLevel Level_trace(void); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. + * Utility method to constructs a new Debug-variant Level */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKLevel Level_debug(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Info-variant Level */ -bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); +enum LDKLevel Level_info(void); /** - * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. + * Utility method to constructs a new Warn-variant Level */ -void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); +enum LDKLevel Level_warn(void); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Error-variant Level */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); +enum LDKLevel Level_error(void); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. + * Checks if two Levels contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); +bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the Level. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Returns the most verbose logging level. */ -bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES enum LDKLevel Level_max(void); /** - * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. + * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. */ -void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); +void Record_free(struct LDKRecord this_obj); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The verbosity level of the message. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); +enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. + * The verbosity level of the message. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); +void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. + * The message body. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The message body. */ -bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); +void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. + * The module path of the message. */ -void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); +struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The module path of the message. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); +void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. + * The source file containing the message. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); +struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. + * The source file containing the message. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); +void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Checks if the given object is currently in the success state + * The line containing the message. */ -bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); +uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. + * The line containing the message. */ -void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); +void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the Record */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); +void Logger_free(struct LDKLogger this_ptr); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. + * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); /** - * Checks if the given object is currently in the success state + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the + * equivalent limit applied to outbound channels). + * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * + * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ -bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the + * equivalent limit applied to outbound channels). + * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * + * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ -void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required + * by the protocol. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required + * by the protocol. */ -bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. */ -void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); +uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelHandshakeConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: false. This value is likely to change to true in the future. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); +bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelHandshakeConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: false. This value is likely to change to true in the future. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. */ -bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); +bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. */ -void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); +void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); +bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::SignerProvider::get_shutdown_scriptpubkey */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); +void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: 1% of channel value, i.e., configured as 10,000 millionths. + * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated + * as 1000 sats instead, which is a safe implementation-specific lower bound. + * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) + * instead, although channel negotiations will fail in that case. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); +uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: 1% of channel value, i.e., configured as 10,000 millionths. + * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated + * as 1000 sats instead, which is a safe implementation-specific lower bound. + * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) + * instead, although channel negotiations will fail in that case. */ -bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. + * + * Increasing the value can help improve liquidity and stability in + * routing at the cost of higher long term disk / DB usage. + * + * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration + * other than the default value. + * + * Default value: 50 + * Maximum value: 483, any values larger will be treated as 483. + * This is the BOLT #2 spec limit on `max_accepted_htlcs`. */ -void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); +uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. + * + * Increasing the value can help improve liquidity and stability in + * routing at the cost of higher long term disk / DB usage. + * + * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration + * other than the default value. + * + * Default value: 50 + * Maximum value: 483, any values larger will be treated as 483. + * This is the BOLT #2 spec limit on `max_accepted_htlcs`. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_InitDecodeErrorZ in the success state. + * Constructs a new ChannelHandshakeConfig given each field */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, uint16_t our_max_accepted_htlcs_arg); /** - * Creates a new CResult_InitDecodeErrorZ in the error state. + * Creates a copy of the ChannelHandshakeConfig */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. */ -bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); /** - * Frees any resources used by the CResult_InitDecodeErrorZ. + * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. */ -void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); +void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); /** - * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 0. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 0. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 2^24 - 1. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 2^24 - 1. */ -bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: u64::max_value. */ -void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: u64::max_value. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: 0. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: 0. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: u64::max_value. */ -bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); +uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: u64::max_value. */ -void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: 0. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the success state. + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: 0. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the error state. + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: 144, or roughly one day and only applies to outbound channels. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: 144, or roughly one day and only applies to outbound channels. */ -bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the CResult_ShutdownDecodeErrorZ. + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to 0, and we + * always trust our own funding transaction at 1 confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (0) and `false` (1). + * + * Default value: true */ -void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); +bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to 0, and we + * always trust our own funding transaction at 1 confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (0) and `false` (1). + * + * Default value: true */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announced_channel`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: true. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announced_channel`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: true. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: 2016, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) */ -bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: 2016, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) */ -void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new ChannelHandshakeLimits given each field */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. + * Creates a copy of the ChannelHandshakeLimits */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. + * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. */ -bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); +void ChannelConfig_free(struct LDKChannelConfig this_obj); /** - * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: 0. */ -void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); +uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: 0. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); +void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); +uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: 1000. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if the given object is currently in the success state + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA */ -bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); +uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: 72 (12 hours at an average of 6 blocks/hour). + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA */ -void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); +void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too + * small to claim on-chain. + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be sustantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a + * channel negotiated throughout the channel open process, along with the fees required to have + * a broadcastable HTLC spending transaction. When a channel supports anchor outputs + * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into + * account the HTLC transaction fee as it is zero. + * + * This limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. Setting this too low may prevent the + * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very + * important to prevent stealing of dust HTLCs by miners. + * + * Default value: 5_000_000 msat. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); +uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. + * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too + * small to claim on-chain. + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be sustantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a + * channel negotiated throughout the channel open process, along with the fees required to have + * a broadcastable HTLC spending transaction. When a channel supports anchor outputs + * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into + * account the HTLC transaction fee as it is zero. + * + * This limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. Setting this too low may prevent the + * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very + * important to prevent stealing of dust HTLCs by miners. + * + * Default value: 5_000_000 msat. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); +void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: 1000 satoshis. + * + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: 1000 satoshis. + * + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background */ -bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); +void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. + * Constructs a new ChannelConfig given each field */ -void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the ChannelConfig */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. + * Checks if two ChannelConfigs contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); +bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. + * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); /** - * Checks if the given object is currently in the success state + * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read */ -bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. + * Read a ChannelConfig from a byte array, created by ChannelConfig_write */ -void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); +void UserConfig_free(struct LDKUserConfig this_obj); /** - * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. + * Channel handshake config that we propose to our counterparty. */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); +struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. + * Channel handshake config that we propose to our counterparty. */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); +void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** - * Checks if the given object is currently in the success state + * Limits applied to our counterparty's proposed channel handshake config settings. */ -bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); +struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); +void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** - * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Channel config which affects behavior during channel lifetime. */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PingDecodeErrorZ in the success state. + * Channel config which affects behavior during channel lifetime. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); +void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Creates a new CResult_PingDecodeErrorZ in the error state. + * If this is set to false, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelHandshakeConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Default value: false. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); +bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * If this is set to false, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelHandshakeConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Default value: false. */ -bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); +void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the CResult_PingDecodeErrorZ. + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. */ -void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); +bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); +void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PongDecodeErrorZ in the success state. + * If this is set to true, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: false. + * + * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); +bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PongDecodeErrorZ in the error state. + * If this is set to true, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: false. + * + * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); +void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * 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::events::Event::HTLCIntercepted */ -bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); +bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PongDecodeErrorZ. + * 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::events::Event::HTLCIntercepted */ -void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); +void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new UserConfig given each field */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); +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 new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + * Creates a copy of the UserConfig */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKUserConfig UserConfig_default(void); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. */ -bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +void BestBlock_free(struct LDKBestBlock this_obj); /** - * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + * Creates a copy of the BestBlock */ -void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); +struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two BestBlocks contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. + * Constructs a `BestBlock` that represents the genesis block at height 0 of the given + * network. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); +MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + * Returns a `BestBlock` as identified by the given block hash and height. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); /** - * Checks if the given object is currently in the success state + * Returns the best block hash. */ -bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. + * Returns the best block height. */ -void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); +MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Calls the free function if one is set */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +void Listen_free(struct LDKListen this_ptr); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); +void Confirm_free(struct LDKConfirm this_ptr); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + * Creates a copy of the ChannelMonitorUpdateStatus */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus */ -bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); /** - * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. + * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus */ -void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. + * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); +bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +void Watch_free(struct LDKWatch this_ptr); /** - * Checks if the given object is currently in the success state + * Calls the free function if one is set */ -bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); +void Filter_free(struct LDKFilter this_ptr); /** - * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. + * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. */ -void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); +void WatchedOutput_free(struct LDKWatchedOutput this_obj); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * First block where the transaction output may have been spent. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + * First block where the transaction output may have been spent. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); +void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + * Outpoint identifying the transaction output. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Outpoint identifying the transaction output. */ -bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); +void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. + * Spending condition of the transaction output. */ -void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); +struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Spending condition of the transaction output. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); +void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. + * Constructs a new WatchedOutput given each field */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); +MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. + * Creates a copy of the WatchedOutput */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Checks if two WatchedOutputs 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 CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); +bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b); /** - * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. + * Generates a non-cryptographic 64-bit hash of the WatchedOutput. */ -void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); +uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); /** - * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Calls the free function if one is set */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); +void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + * Creates a copy of the ConfirmationTarget */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); +enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + * Utility method to constructs a new Background-variant ConfirmationTarget */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKConfirmationTarget ConfirmationTarget_background(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Normal-variant ConfirmationTarget */ -bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +enum LDKConfirmationTarget ConfirmationTarget_normal(void); /** - * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. + * Utility method to constructs a new HighPriority-variant ConfirmationTarget */ -void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); +enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + * Checks if two ConfirmationTargets contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); +bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +void FeeEstimator_free(struct LDKFeeEstimator this_ptr); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL. */ -bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj); /** - * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. + * Creates a copy of the MonitorUpdateId */ -void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); +struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + * Checks if two MonitorUpdateIds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); +bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); +void Persist_free(struct LDKPersist this_ptr); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL. */ -bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); +void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); /** - * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. + * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. */ -void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); +void ChainMonitor_free(struct LDKChainMonitor this_obj); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. + * + * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor + * will call back to it indicating transactions and outputs of interest. This allows clients to + * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may + * always need to fetch full blocks absent another means for determining which blocks contain + * transactions relevant to the watched channels. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. + * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or + * claims which are awaiting confirmation. + * + * Includes the balances from each [`ChannelMonitor`] *except* those included in + * `ignored_channels`, allowing you to filter out balances from channels which are still open + * (and whose balance should likely be pulled from the [`ChannelDetails`]). + * + * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for + * inclusion in the return value. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); +MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no + * such [`ChannelMonitor`] is currently being monitored for. + * + * Note that the result holds a mutex over our monitor set, and should not be held + * indefinitely. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); /** - * Checks if the given object is currently in the success state + * Lists the funding outpoint of each [`ChannelMonitor`] being monitored. + * + * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always + * monitoring for on-chain state resolutions. */ -bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. + * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). */ -void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Indicates the persistence of a [`ChannelMonitor`] has completed after + * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation. + * + * Thus, the anticipated use is, at a high level: + * 1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the + * update to disk and begins updating any remote (e.g. watchtower/backup) copies, + * returning [`ChannelMonitorUpdateStatus::InProgress`], + * 2) once all remote copies are updated, you call this function with the + * `completed_update_id` that completed, and once all pending updates have completed the + * channel will be re-enabled. + * + * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently + * registered [`ChannelMonitor`]s. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + * Gets a [`Future`] that completes when an event is available either via + * [`chain::Watch::release_pending_monitor_events`] or + * [`EventsProvider::process_pending_events`]. + * + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`ChainMonitor`] and should instead register actions to be taken later. + * + * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); +MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is + * crucial in preventing certain classes of pinning attacks, detecting substantial mempool + * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend + * invoking this every 30 seconds, or lower if running in an environment with spotty + * connections, like on mobile. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); +struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); +struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new Watch which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); +struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); /** - * Checks if the given object is currently in the success state + * The sequence number of this update. Updates *must* be replayed in-order according to this + * sequence number (and updates may panic if they are not). The update_id values are strictly + * increasing and increase by one for each new update, with two exceptions specified below. + * + * This sequence number is also used to track up to which points updates which returned + * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given + * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * + * The only instances we allow where update_id values are not strictly increasing have a + * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that + * will force close the channel by broadcasting the latest commitment transaction or + * special post-force-close updates, like providing preimages necessary to claim outputs on the + * broadcast commitment transaction. See its docs for more details. + * + * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ -bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); +uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. + * The sequence number of this update. Updates *must* be replayed in-order according to this + * sequence number (and updates may panic if they are not). The update_id values are strictly + * increasing and increase by one for each new update, with two exceptions specified below. + * + * This sequence number is also used to track up to which points updates which returned + * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given + * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * + * The only instances we allow where update_id values are not strictly increasing have a + * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that + * will force close the channel by broadcasting the latest commitment transaction or + * special post-force-close updates, like providing preimages necessary to claim outputs on the + * broadcast commitment transaction. See its docs for more details. + * + * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ -void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); +void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the ChannelMonitorUpdate */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + * Checks if two ChannelMonitorUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); +bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); /** - * Checks if the given object is currently in the success state + * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write */ -bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. + * Frees any resources used by the MonitorEvent */ -void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); +void MonitorEvent_free(struct LDKMonitorEvent this_ptr); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the MonitorEvent */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); +struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new HTLCEvent-variant MonitorEvent */ -void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); +struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state. + * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o); +struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state. + * Utility method to constructs a new Completed-variant MonitorEvent */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); +struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new UpdateFailed-variant MonitorEvent */ -bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o); +struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a); /** - * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ. + * Checks if two MonitorEvents contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res); +bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b); /** - * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read */ -struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj); /** - * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter + * Read a MonitorEvent from a byte array, created by MonitorEvent_write */ -struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser); /** - * Constructs a new COption_FilterZ containing nothing + * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_FilterZ COption_FilterZ_none(void); +void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); /** - * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state + * Creates a copy of the HTLCUpdate */ -void COption_FilterZ_free(struct LDKCOption_FilterZ _res); +struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. + * Checks if two HTLCUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); +bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. + * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); +struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); /** - * Checks if the given object is currently in the success state + * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write */ -bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); +struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. + * Frees any resources used by the Balance */ -void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); +void Balance_free(struct LDKBalance this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a copy of the Balance */ -void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); +struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new ClaimableOnChannelClose-variant Balance */ -void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res); +struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance */ -struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig); +struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height); /** - * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. + * Utility method to constructs a new ContentiousClaimable-variant Balance */ -struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b); +struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height); /** - * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. + * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance */ -void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res); +struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance */ -void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res); +struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height); /** - * Frees any resources used by the PaymentPurpose + * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance */ -void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); +struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis); /** - * Creates a copy of the PaymentPurpose + * Checks if two Balances contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); +bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b); /** - * Utility method to constructs a new InvoicePayment-variant PaymentPurpose + * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); +void ChannelMonitor_free(struct LDKChannelMonitor this_obj); /** - * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read */ -struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); /** - * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read + * Updates a ChannelMonitor on the basis of some new information provided by the Channel + * itself. + * + * panics if the given update is not the next update by update_id. */ -struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write + * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this + * ChannelMonitor. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the ClosureReason + * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -void ClosureReason_free(struct LDKClosureReason this_ptr); +MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a copy of the ClosureReason + * Gets a list of txids, with their output scripts (in the order they appear in the + * transaction), which we must learn about spends of via block_connected(). */ -struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason + * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly + * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs + * have been registered. */ -struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg); +void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter); /** - * Utility method to constructs a new HolderForceClosed-variant ClosureReason + * Get the list of HTLCs who's status has been updated on chain. This should be called by + * ChannelManager via [`chain::Watch::release_pending_monitor_events`]. */ -struct LDKClosureReason ClosureReason_holder_force_closed(void); +MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CooperativeClosure-variant ClosureReason + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. + * + * This is called by the [`EventsProvider::process_pending_events`] implementation for + * [`ChainMonitor`]. + * + * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -struct LDKClosureReason ClosureReason_cooperative_closure(void); +MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason + * Gets the `node_id` of the counterparty for this channel. + * + * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some` + * otherwise. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); +MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Utility method to constructs a new FundingTimedOut-variant ClosureReason + * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of + * the Channel was out-of-date. + * + * You may also use this to broadcast the latest local commitment transaction, either because + * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've + * fallen behind (i.e. we've received proof that our counterparty side knows a revocation + * secret we gave them that they shouldn't know). + * + * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty + * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't + * close channel with their commitment transaction after a substantial amount of time. Best + * may be to contact the other node operator out-of-band to coordinate other options available + * to you. In any-case, the choice is up to you. + * + * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure */ -struct LDKClosureReason ClosureReason_funding_timed_out(void); +MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); /** - * Utility method to constructs a new ProcessingError-variant ClosureReason + * Processes transactions in a newly connected block, which may result in any of the following: + * - update the monitor's state against resolved HTLCs + * - punish the counterparty in the case of seeing a revoked commitment transaction + * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration + * - detect settled outputs for later spending + * - schedule and bump any in-flight claims + * + * Returns any new outputs to watch from `txdata`; after called, these are also included in + * [`get_outputs_to_watch`]. + * + * [`get_outputs_to_watch`]: #method.get_outputs_to_watch */ -struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Utility method to constructs a new DisconnectedPeer-variant ClosureReason + * Determines if the disconnected block contained any transactions of interest and updates + * appropriately. */ -struct LDKClosureReason ClosureReason_disconnected_peer(void); +void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason + * Processes transactions confirmed in a block with the given header and height, returning new + * outputs to watch. See [`block_connected`] for details. + * + * Used instead of [`block_connected`] by clients that are notified of transactions rather than + * blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_connected`]: Self::block_connected */ -struct LDKClosureReason ClosureReason_outdated_channel_manager(void); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Checks if two ClosureReasons contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Processes a transaction that was reorganized out of the chain. + * + * Used instead of [`block_disconnected`] by clients that are notified of transactions rather + * than blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_disconnected`]: Self::block_disconnected */ -bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); +void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + * Updates the monitor with the current best chain tip, returning new outputs to watch. See + * [`block_connected`] for details. + * + * Used instead of [`block_connected`] by clients that are notified of transactions rather than + * blocks. See [`chain::Confirm`] for calling expectations. + * + * [`block_connected`]: Self::block_connected */ -struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Read a ClosureReason from a byte array, created by ClosureReason_write + * Returns the set of txids that should be monitored for re-organization out of the chain. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the HTLCDestination + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -void HTLCDestination_free(struct LDKHTLCDestination this_ptr); +MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCDestination + * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is + * crucial in preventing certain classes of pinning attacks, detecting substantial mempool + * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend + * invoking this every 30 seconds, or lower if running in an environment with spotty + * connections, like on mobile. */ -struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); +void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); /** - * Utility method to constructs a new NextHopChannel-variant HTLCDestination + * Gets the balances in this channel which are either claimable by us if we were to + * force-close the channel now or which are claimable on-chain (possibly awaiting + * confirmation). + * + * Any balances in the channel which are available on-chain (excluding on-chain fees) are + * included here until an [`Event::SpendableOutputs`] event has been generated for the + * balance, or until our counterparty has claimed the balance and accrued several + * confirmations on the claim transaction. + * + * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of + * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted + * a revoked state. + * + * See [`Balance`] for additional details on the types of claimable balances which + * may be returned here and their meanings. */ -struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id); +MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnknownNextHop-variant HTLCDestination + * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write */ -struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); /** - * Utility method to constructs a new InvalidForward-variant HTLCDestination + * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. */ -struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); +void OutPoint_free(struct LDKOutPoint this_obj); /** - * Utility method to constructs a new FailedPayment-variant HTLCDestination + * The referenced transaction's txid. */ -struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); +const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; /** - * Checks if two HTLCDestinations contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The referenced transaction's txid. */ -bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b); +void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read + * The index of the referenced output in its transaction's vout. */ -struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); +uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); /** - * Read a HTLCDestination from a byte array, created by HTLCDestination_write + * The index of the referenced output in its transaction's vout. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the Event + * Constructs a new OutPoint given each field */ -void Event_free(struct LDKEvent this_ptr); +MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); /** - * Creates a copy of the Event + * Creates a copy of the OutPoint */ -struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); +struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); /** - * Utility method to constructs a new FundingGenerationReady-variant Event + * Checks if two OutPoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -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); +bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); /** - * Utility method to constructs a new PaymentClaimable-variant Event + * Generates a non-cryptographic 64-bit hash of the OutPoint. */ -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); +uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); /** - * Utility method to constructs a new PaymentClaimed-variant Event + * Convert an `OutPoint` to a lightning channel id. */ -struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); +MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentSent-variant Event + * Serialize the OutPoint object into a byte array which can be read by OutPoint_read */ -struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); +struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); /** - * Utility method to constructs a new PaymentFailed-variant Event + * Read a OutPoint from a byte array, created by OutPoint_write */ -struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); +struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); /** - * Utility method to constructs a new PaymentPathSuccessful-variant Event + * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); /** - * Utility method to constructs a new PaymentPathFailed-variant Event + * The outpoint which is spendable. */ -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 LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ProbeSuccessful-variant Event + * The outpoint which is spendable. */ -struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Utility method to constructs a new ProbeFailed-variant Event + * Per commitment point to derive the delayed payment key by key holder. */ -struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PendingHTLCsForwardable-variant Event + * Per commitment point to derive the delayed payment key by key holder. */ -struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new HTLCIntercepted-variant Event + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -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); +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SpendableOutputs-variant Event + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); /** - * Utility method to constructs a new PaymentForwarded-variant Event + * The output which is referenced by the given outpoint. + * + * Returns a copy of the field. */ -struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx); +struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ChannelReady-variant Event + * The output which is referenced by the given outpoint. */ -struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Utility method to constructs a new ChannelClosed-variant Event + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DiscardFunding-variant Event + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new OpenChannelRequest-variant Event + * 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. */ -struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type); +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new HTLCHandlingFailed-variant Event + * 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. */ -struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the Event object into a byte array which can be read by Event_read + * The value of the channel which this output originated from, possibly indirectly. */ -struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Read a Event from a byte array, created by Event_write + * The value of the channel which this output originated from, possibly indirectly. */ -struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the MessageSendEvent + * Constructs a new DelayedPaymentOutputDescriptor given each field */ -void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); +MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); /** - * Creates a copy of the MessageSendEvent + * Creates a copy of the DelayedPaymentOutputDescriptor */ -struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); /** - * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent + * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); +bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); /** - * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent + * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); +struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); /** - * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent + * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent + * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); /** - * Utility method to constructs a new SendChannelReady-variant MessageSendEvent + * The outpoint which is spendable. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent + * The outpoint which is spendable. */ -struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent + * The output which is referenced by the given outpoint. + * + * Returns a copy of the field. */ -struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); +struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent + * The output which is referenced by the given outpoint. */ -struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent + * 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. */ -struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new SendShutdown-variant MessageSendEvent + * 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. */ -struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent + * The value of the channel which this transactions spends. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent + * The value of the channel which this transactions spends. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + * Constructs a new StaticPaymentOutputDescriptor given each field */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); /** - * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent + * Creates a copy of the StaticPaymentOutputDescriptor */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); /** - * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent + * Checks if two StaticPaymentOutputDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); +bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); /** - * Utility method to constructs a new HandleError-variant MessageSendEvent + * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read */ -struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); +struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); /** - * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent + * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent + * Frees any resources used by the SpendableOutputDescriptor */ -struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); +void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); /** - * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent + * Creates a copy of the SpendableOutputDescriptor */ -struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); /** - * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent + * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor */ -struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); /** - * Calls the free function if one is set + * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor */ -void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); /** - * Calls the free function if one is set + * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor */ -void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); /** - * Calls the free function if one is set + * Checks if two SpendableOutputDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void EventsProvider_free(struct LDKEventsProvider this_ptr); +bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); /** - * Calls the free function if one is set + * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read */ -void EventHandler_free(struct LDKEventHandler this_ptr); +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); /** - * Frees any resources used by the APIError + * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write */ -void APIError_free(struct LDKAPIError this_ptr); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); /** - * Creates a copy of the APIError + * Calls the free function if one is set */ -struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); +void ChannelSigner_free(struct LDKChannelSigner this_ptr); /** - * Utility method to constructs a new APIMisuseError-variant APIError + * Calls the free function if one is set */ -struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); +void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); /** - * Utility method to constructs a new FeeRateTooHigh-variant APIError + * Calls the free function if one is set */ -struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); +void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); /** - * Utility method to constructs a new InvalidRoute-variant APIError + * Creates a copy of the Recipient */ -struct LDKAPIError APIError_invalid_route(struct LDKStr err); +enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); /** - * Utility method to constructs a new ChannelUnavailable-variant APIError + * Utility method to constructs a new Node-variant Recipient */ -struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); +enum LDKRecipient Recipient_node(void); /** - * Utility method to constructs a new MonitorUpdateInProgress-variant APIError + * Utility method to constructs a new PhantomNode-variant Recipient */ -struct LDKAPIError APIError_monitor_update_in_progress(void); +enum LDKRecipient Recipient_phantom_node(void); /** - * Utility method to constructs a new IncompatibleShutdownScript-variant APIError + * Calls the free function if one is set */ -struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); +void EntropySource_free(struct LDKEntropySource this_ptr); /** - * Checks if two APIErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Calls the free function if one is set */ -bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); +void NodeSigner_free(struct LDKNodeSigner this_ptr); /** - * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void BigSize_free(struct LDKBigSize this_obj); - -uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); - -void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val); +void SignerProvider_free(struct LDKSignerProvider this_ptr); /** - * Constructs a new BigSize given each field + * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); +void InMemorySigner_free(struct LDKInMemorySigner this_obj); /** - * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. + * 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 Hostname_free(struct LDKHostname this_obj); +const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the Hostname + * 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. */ -struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); +void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Checks if two Hostnames 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. + * Holder secret key for blinded revocation pubkey. */ -bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Returns the length of the hostname. + * Holder secret key for blinded revocation pubkey. */ -MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Creates a digital signature of a message given a SecretKey, like the node's secret. - * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. - * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ -struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Recovers the PublicKey of the signer of the message given the message and the signature. + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ -struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, - * and the PublicKey. + * Holder secret key used in an HTLC transaction. */ -bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Construct the invoice's HRP and signatureless data into a preimage to be hashed. + * Holder secret key used in an HTLC transaction. */ -struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature); +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Calls the free function if one is set + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -void Persister_free(struct LDKPersister this_ptr); +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -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); +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Constructs a new PrintableString given each field + * Commitment seed. */ -MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Calls the free function if one is set + * Commitment seed. */ -void FutureCallback_free(struct LDKFutureCallback this_ptr); +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. + * Creates a copy of the InMemorySigner */ -void Future_free(struct LDKFuture this_obj); +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Registers a callback to be called upon completion of this future. If the future has already - * completed, the callback will be called immediately. + * Creates a new [`InMemorySigner`]. */ -void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); +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, struct LDKThirtyTwoBytes rand_bytes_unique_start); /** - * Creates a copy of the Level + * Returns the counterparty's pubkeys. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Gossip-variant Level + * 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 [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_gossip(void); +MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Trace-variant Level + * Returns the `contest_delay` value specified by us and applied on transactions broadcastable + * by our counterparty, i.e., the amount of time that they have to wait to recover their funds + * if they broadcast a transaction. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_trace(void); +MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Debug-variant Level + * Returns whether the holder is the initiator. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_debug(void); +MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Info-variant Level + * Funding outpoint + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_info(void); +MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Warn-variant Level + * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or + * building transactions. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_warn(void); +MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Error-variant Level + * Returns whether anchors should be used. + * + * Will panic if [`ChannelSigner::provide_channel_parameters`] has not been called before. */ -enum LDKLevel Level_error(void); +MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Checks if two Levels contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * 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. + * + * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint */ -bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); +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); /** - * Checks if two Levels contain equal inner contents. + * 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`], 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 */ -uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); +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); /** - * Returns the most verbose logging level. + * 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 */ -MUST_USE_RES enum LDKLevel Level_max(void); +struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. + * 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 */ -void Record_free(struct LDKRecord this_obj); +struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The verbosity level of the message. + * 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 */ -enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The verbosity level of the message. + * 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 */ -void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); +struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The message body. + * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read */ -struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); /** - * The message body. + * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ -void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg); /** - * The module path of the message. + * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. */ -struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); +void KeysManager_free(struct LDKKeysManager this_obj); /** - * The module path of the message. + * 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). + * + * 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`]: crate::chain::channelmonitor::ChannelMonitor */ -void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * The source file containing the message. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * The source file containing the message. + * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ -void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +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]); /** - * The line containing the message. + * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an + * output to the given change destination (if sufficient change value remains). The + * transaction will have a feerate, at least, of the given value. + * + * Returns `Err(())` if the output value is greater than the input value minus required fee, + * if a descriptor was duplicated, or if an output descriptor `script_pubkey` + * does not match the one we can spend. + * + * 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`]. */ -uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); /** - * The line containing the message. + * 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 */ -void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); +struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Creates a copy of the Record + * 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 LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); +struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * 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 */ -void Logger_free(struct LDKLogger this_ptr); +struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. */ -void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); +void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the - * equivalent limit applied to outbound channels). - * - * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment - * transaction before operation. If you wish to accept channels with zero confirmations, see - * [`UserConfig::manually_accept_inbound_channels`] and - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. - * - * Default value: 6. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf + * 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 */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the - * equivalent limit applied to outbound channels). - * - * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment - * transaction before operation. If you wish to accept channels with zero confirmations, see - * [`UserConfig::manually_accept_inbound_channels`] and - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. - * - * Default value: 6. - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf + * 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 */ -void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less. + * 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 */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). + * 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. * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). + * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and + * `starting_time_nanos`. * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. + * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the + * same across restarts, or else inbound payments may fail. * - * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less. + * [phantom node payments]: PhantomKeysManager */ -void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required - * by the protocol. + * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required - * by the protocol. + * See [`KeysManager::derive_channel_keys`] for documentation on this method. */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); +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]); /** - * Sets the percentage of the channel value we will cap the total value of outstanding inbound - * HTLCs to. - * - * This can be set to a value between 1-100, where the value corresponds to the percent of the - * channel value in whole percentages. - * - * Note that: - * * If configured to another value than the default value 10, any new channels created with - * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the - * `ChannelManager`. - * - * * This caps the total value for inbound HTLCs in-flight only, and there's currently - * no way to configure the cap for the total value of outbound HTLCs in-flight. - * - * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds - * are different from the non-HTLC-encumbered funds. This makes this an important knob to - * restrict exposure to loss due to being offline for too long. - * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] - * for more information. - * - * Default value: 10. - * Minimum value: 1, any values less than 1 will be treated as 1 instead. - * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Sets the percentage of the channel value we will cap the total value of outstanding inbound - * HTLCs to. - * - * This can be set to a value between 1-100, where the value corresponds to the percent of the - * channel value in whole percentages. - * - * Note that: - * * If configured to another value than the default value 10, any new channels created with - * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the - * `ChannelManager`. - * - * * This caps the total value for inbound HTLCs in-flight only, and there's currently - * no way to configure the cap for the total value of outbound HTLCs in-flight. - * - * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds - * are different from the non-HTLC-encumbered funds. This makes this an important knob to - * restrict exposure to loss due to being offline for too long. - * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] - * for more information. - * - * Default value: 10. - * Minimum value: 1, any values less than 1 will be treated as 1 instead. - * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. */ -void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the - * BOLTs) option for outbound private channels. This provides better privacy by not including - * our real on-chain channel UTXO in each invoice and requiring that our counterparty only - * relay HTLCs to us using the channel's SCID alias. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `scid_alias` option; we will simply fall back to a - * private channel without that option. - * - * Ignored if the channel is negotiated to be announced, see - * [`ChannelHandshakeConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. - * - * Default value: false. This value is likely to change to true in the future. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * Creates a copy of the FailureCode */ -bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +enum LDKFailureCode FailureCode_clone(const enum LDKFailureCode *NONNULL_PTR orig); /** - * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the - * BOLTs) option for outbound private channels. This provides better privacy by not including - * our real on-chain channel UTXO in each invoice and requiring that our counterparty only - * relay HTLCs to us using the channel's SCID alias. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `scid_alias` option; we will simply fall back to a - * private channel without that option. - * - * Ignored if the channel is negotiated to be announced, see - * [`ChannelHandshakeConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. - * - * Default value: false. This value is likely to change to true in the future. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode */ -void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +enum LDKFailureCode FailureCode_temporary_node_failure(void); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: false. + * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode */ -bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +enum LDKFailureCode FailureCode_required_node_feature_missing(void); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: false. + * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode */ -void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +enum LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. - * - * Default value: true. - * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ -bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +void ChannelManager_free(struct LDKChannelManager this_obj); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. - * - * Default value: true. - * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. */ -void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +void ChainParameters_free(struct LDKChainParameters this_obj); /** - * The Proportion of the channel value to configure as counterparty's channel reserve, - * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. - * - * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain - * on their side, at all times. - * This ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * Channel reserve values greater than 30% could be considered highly unreasonable, since that - * amount can never be used for payments. - * Also, if our selected channel reserve for counterparty and counterparty's selected - * channel reserve for us sum up to equal or greater than channel value, channel negotiations - * will fail. - * - * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve - * other than the default value. - * - * Default value: 1% of channel value, i.e., configured as 10,000 millionths. - * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated - * as 1000 sats instead, which is a safe implementation-specific lower bound. - * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) - * instead, although channel negotiations will fail in that case. + * The network for determining the `chain_hash` in Lightning messages. */ -uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * The Proportion of the channel value to configure as counterparty's channel reserve, - * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. - * - * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain - * on their side, at all times. - * This ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * Channel reserve values greater than 30% could be considered highly unreasonable, since that - * amount can never be used for payments. - * Also, if our selected channel reserve for counterparty and counterparty's selected - * channel reserve for us sum up to equal or greater than channel value, channel negotiations - * will fail. - * - * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve - * other than the default value. - * - * Default value: 1% of channel value, i.e., configured as 10,000 millionths. - * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated - * as 1000 sats instead, which is a safe implementation-specific lower bound. - * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) - * instead, although channel negotiations will fail in that case. + * The network for determining the `chain_hash` in Lightning messages. */ -void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); /** - * Constructs a new ChannelHandshakeConfig given each field + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg); +struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelHandshakeConfig + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); +void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); /** - * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. + * Constructs a new ChainParameters given each field */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); +MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); /** - * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChainParameters */ -void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); +struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); /** - * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 0. + * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); /** - * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 0. + * Base routing fee in millisatoshis. */ -void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 2^24 - 1. + * Base routing fee in millisatoshis. */ -uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 2^24 - 1. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. - * - * Default value: u64::max_value. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. - * - * Default value: u64::max_value. + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. - * - * Default value: 0. + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. - * - * Default value: 0. + * Constructs a new CounterpartyForwardingInfo given each field */ -void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). - * - * Default value: u64::max_value. + * Creates a copy of the CounterpartyForwardingInfo */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). - * - * Default value: u64::max_value. + * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. - * - * Default value: 0. + * The node_id of our counterparty */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. - * - * Default value: 0. + * The node_id of our counterparty */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: 144, or roughly one day and only applies to outbound channels. + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: 144, or roughly one day and only applies to outbound channels. + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); +void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Whether we implicitly trust funding transactions generated by us for our own outbound - * channels to not be double-spent. - * - * If this is set, we assume that our own funding transactions are *never* double-spent, and - * thus we can trust them without any confirmations. This is generally a reasonable - * assumption, given we're the only ones who could ever double-spend it (assuming we have sole - * control of the signing keys). - * - * You may wish to un-set this if you allow the user to (or do in an automated fashion) - * double-spend the funding transaction to RBF with an alternative channel open. + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. * - * This only applies if our counterparty set their confirmations-required value to 0, and we - * always trust our own funding transaction at 1 confirmation irrespective of this value. - * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being - * `true` (0) and `false` (1). + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. * - * Default value: true + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Whether we implicitly trust funding transactions generated by us for our own outbound - * channels to not be double-spent. - * - * If this is set, we assume that our own funding transactions are *never* double-spent, and - * thus we can trust them without any confirmations. This is generally a reasonable - * assumption, given we're the only ones who could ever double-spend it (assuming we have sole - * control of the signing keys). - * - * You may wish to un-set this if you allow the user to (or do in an automated fashion) - * double-spend the funding transaction to RBF with an alternative channel open. + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. * - * This only applies if our counterparty set their confirmations-required value to 0, and we - * always trust our own funding transaction at 1 confirmation irrespective of this value. - * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being - * `true` (0) and `false` (1). + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. * - * Default value: true + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelHandshakeConfig::announced_channel`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. * - * Default value: true. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelHandshakeConfig::announced_channel`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. * - * Default value: true. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: 2016, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: 2016, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new ChannelHandshakeLimits given each field + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelHandshakeLimits + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); +void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. + * Constructs a new ChannelCounterparty given each field */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); +MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); /** - * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelCounterparty */ -void ChannelConfig_free(struct LDKChannelConfig this_obj); +struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * Default value: 0. + * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. */ -uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +void ChannelDetails_free(struct LDKChannelDetails this_obj); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * Default value: 0. + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. + */ +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Parameters which apply to our counterparty. See individual fields for more information. + */ +struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * Parameters which apply to our counterparty. See individual fields for more information. + */ +void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); + +/** + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. * - * Default value: 1000. + * Note that, if this has been set, `channel_id` will be equivalent to + * `funding_txo.unwrap().to_channel_id()`. * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. * - * Default value: 1000. + * Note that, if this has been set, `channel_id` will be equivalent to + * `funding_txo.unwrap().to_channel_id()`. * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. + * The features which this channel operates with. See individual features for more info. * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. + * `None` until negotiation completes and the channel type is finalized. * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The features which this channel operates with. See individual features for more info. * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * `None` until negotiation completes and the channel type is finalized. * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ -void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too - * small to claim on-chain. + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be sustantial if there are many dust HTLCs present when the - * channel is force-closed. + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. * - * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a - * channel negotiated throughout the channel open process, along with the fees required to have - * a broadcastable HTLC spending transaction. When a channel supports anchor outputs - * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into - * account the HTLC transaction fee as it is zero. + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. * - * This limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. Setting this too low may prevent the - * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very - * important to prevent stealing of dust HTLCs by miners. + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required + */ +void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). * - * Default value: 5_000_000 msat. + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required */ -uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too - * small to claim on-chain. + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be sustantial if there are many dust HTLCs present when the - * channel is force-closed. + * This will be `None` as long as the channel is not available for routing outbound payments. * - * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a - * channel negotiated throughout the channel open process, along with the fees required to have - * a broadcastable HTLC spending transaction. When a channel supports anchor outputs - * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into - * account the HTLC transaction fee as it is zero. + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required + */ +void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. * - * This limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. Setting this too low may prevent the - * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very - * important to prevent stealing of dust HTLCs by miners. + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. * - * Default value: 5_000_000 msat. + * [`short_channel_id`]: Self::short_channel_id */ -void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. + * [`short_channel_id`]: Self::short_channel_id + */ +void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The value, in satoshis, of this channel as appears in the funding output + */ +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The value, in satoshis, of this channel as appears in the funding output + */ +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. * - * Default value: 1000 satoshis. + * This value will be `None` for outbound channels until the counterparty accepts the channel. * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. + * This value will be `None` for outbound channels until the counterparty accepts the channel. * - * Default value: 1000 satoshis. + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + */ +void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The `user_channel_id` passed in to create_channel, or a random value if the channel was + * inbound. This may be zero for inbound channels serialized with LDK versions prior to + * 0.0.113. + */ +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The `user_channel_id` passed in to create_channel, or a random value if the channel was + * inbound. This may be zero for inbound channels serialized with LDK versions prior to + * 0.0.113. + */ +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); + +/** + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelConfig given each field + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); +void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a copy of the ChannelConfig + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] */ -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); +uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two ChannelConfigs 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. + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] */ -bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); +void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. + * + * See also [`ChannelDetails::balance_msat`] + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. + * + * See also [`ChannelDetails::balance_msat`] + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. */ -struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a ChannelConfig from a byte array, created by ChannelConfig_write + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. */ -struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); +uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. */ -void UserConfig_free(struct LDKUserConfig this_obj); +void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Channel handshake config that we propose to our counterparty. + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Channel handshake config that we propose to our counterparty. + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Channel config which affects behavior during channel lifetime. + * 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 LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Channel config which affects behavior during channel lifetime. + * 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 UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * If this is set to false, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelHandshakeConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. * - * Default value: false. + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * If this is set to false, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelHandshakeConfig::announced_channel`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. * - * Default value: false. + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * If this is set to false, we do not accept inbound requests to open a new channel. - * Default value: true. + * True if the channel was initiated (and thus funded) by us. */ -bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * If this is set to false, we do not accept inbound requests to open a new channel. - * Default value: true. + * True if the channel was initiated (and thus funded) by us. */ -void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * If this is set to true, the user needs to manually accept inbound requests to open a new - * channel. - * - * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a - * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a - * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the - * user explicitly chooses to accept the request. - * - * Default value: false. + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. * - * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * If this is set to true, the user needs to manually accept inbound requests to open a new - * channel. - * - * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a - * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a - * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the - * user explicitly chooses to accept the request. - * - * Default value: false. + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. * - * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *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. + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + * This is a strict superset of `is_channel_ready`. */ -bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *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. + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + * This is a strict superset of `is_channel_ready`. */ -void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new UserConfig given each field + * True if this channel is (or will be) publicly-announced. */ -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); +bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the UserConfig + * True if this channel is (or will be) publicly-announced. */ -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); +void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -MUST_USE_RES struct LDKUserConfig UserConfig_default(void); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -void BestBlock_free(struct LDKBestBlock this_obj); +void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a copy of the BestBlock + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two BestBlocks 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. + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b); +void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a `BestBlock` that represents the genesis block at height 0 of the given - * network. + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network); +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Returns a `BestBlock` as identified by the given block hash and height. + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Returns the best block hash. + * Constructs a new ChannelDetails given each field */ -MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_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, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t 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); /** - * Returns the best block height. + * Creates a copy of the ChannelDetails */ -MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** - * Creates a copy of the AccessError + * Gets the current SCID which should be used to identify this channel for inbound payments. + * This should be used for providing invoice hints or in any other context where our + * counterparty will forward a payment to us. + * + * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the + * [`ChannelDetails::short_channel_id`]. See those for more information. */ -enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnknownChain-variant AccessError + * Gets the current SCID which should be used to identify this channel for outbound payments. + * This should be used in [`Route`]s to describe the first hop or in other contexts where + * we're sending or forwarding a payment outbound over this channel. + * + * This is either the [`ChannelDetails::short_channel_id`], if set, or the + * [`ChannelDetails::outbound_scid_alias`]. See those for more information. */ -enum LDKAccessError AccessError_unknown_chain(void); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnknownTx-variant AccessError + * Frees any resources used by the RecentPaymentDetails */ -enum LDKAccessError AccessError_unknown_tx(void); +void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); /** - * Calls the free function if one is set + * Creates a copy of the RecentPaymentDetails */ -void Access_free(struct LDKAccess this_ptr); +struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -void Listen_free(struct LDKListen this_ptr); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** - * Calls the free function if one is set + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -void Confirm_free(struct LDKConfirm this_ptr); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_hash); /** - * Creates a copy of the ChannelMonitorUpdateStatus + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_hash); /** - * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus + * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); +void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); /** - * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus + * The list of channels to be included in the invoice route hints. */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); +struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateStatus + * The list of channels to be included in the invoice route hints. */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_permanent_failure(void); +void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); /** - * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b); +uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -void Watch_free(struct LDKWatch this_ptr); +void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); /** - * Calls the free function if one is set + * The pubkey of the real backing node that would ultimately receive the payment. */ -void Filter_free(struct LDKFilter this_ptr); +struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. + * The pubkey of the real backing node that would ultimately receive the payment. */ -void WatchedOutput_free(struct LDKWatchedOutput this_obj); +void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * First block where the transaction output may have been spent. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new PhantomRouteHints given each field */ -struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); /** - * First block where the transaction output may have been spent. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the PhantomRouteHints */ -void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); /** - * Outpoint identifying the transaction output. + * Constructs a new `ChannelManager` to hold several channels and route between them. + * + * This is the main \"logic hub\" for all channel-related actions, and implements + * [`ChannelMessageHandler`]. + * + * Non-proportional fees are fixed according to our risk using the provided fee estimator. + * + * Users need to notify the new `ChannelManager` when a new block is connected or + * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting + * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for + * more details. + * + * [`block_connected`]: chain::Listen::block_connected + * [`block_disconnected`]: chain::Listen::block_disconnected + * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ -struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +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); /** - * Outpoint identifying the transaction output. + * Gets the current configuration applied to all new channels. */ -void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); +MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Spending condition of the transaction output. + * Creates a new outbound channel to the given remote node and with the given value. + * + * `user_channel_id` will be provided back as in + * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 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`. + * + * Note that we do not check if you are currently connected to the given peer. If no + * connection is available, the outbound `open_channel` message may fail to send, resulting in + * the channel eventually being silently forgotten (dropped on reload). + * + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for + * one derived from the funding transaction's TXID. If the counterparty rejects the channel + * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. + * + * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id + * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id + * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id + * + * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +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); /** - * Spending condition of the transaction output. + * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for + * more information. */ -void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new WatchedOutput given each field + * 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. */ -MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the WatchedOutput + * Gets the list of channels we have with a given counterparty, in random order. */ -struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); /** - * Checks if two WatchedOutputs 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. + * 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 */ -bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b); +MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two WatchedOutputs contain equal inner contents. + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * * If we are the channel initiator, we will pay between our [`Background`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee + * estimate. + * * If our counterparty is the channel initiator, we will require a channel closing + * transaction feerate of at least our [`Background`] feerate or the feerate which + * would appear on a force-closure transaction, whichever is lower. We will allow our + * counterparty to pay as much fee as they'd like, however. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ -uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** - * Calls the free function if one is set + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated + * the channel being closed or not: + * * If we are the channel initiator, we will pay at least this feerate on the closing + * transaction. The upper-bound is set by + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee + * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * * If our counterparty is the channel initiator, we will refuse to accept a channel closure + * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which + * will appear on a force-closure transaction, whichever is lower). + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ -void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight); /** - * Creates a copy of the ConfirmationTarget + * Force closes a channel, immediately broadcasting the latest local transaction(s) and + * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to + * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding + * channel. */ -enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** - * Utility method to constructs a new Background-variant ConfirmationTarget + * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting + * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the + * `counterparty_node_id` isn't the counterparty of the corresponding channel. + * + * You can always get the latest local transaction(s) to broadcast from + * [`ChannelMonitor::get_latest_holder_commitment_txn`]. */ -enum LDKConfirmationTarget ConfirmationTarget_background(void); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** - * Utility method to constructs a new Normal-variant ConfirmationTarget + * Force close all channels, immediately broadcasting the latest local commitment transaction + * for each to the chain and rejecting new HTLCs on each. */ -enum LDKConfirmationTarget ConfirmationTarget_normal(void); +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HighPriority-variant ConfirmationTarget + * Force close all channels rejecting new HTLCs on each but without broadcasting the latest + * local transaction(s). */ -enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); +void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two ConfirmationTargets contain equal inner contents. + * Sends a payment along a given route. + * + * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] + * fields for more info. + * + * May generate [`UpdateHTLCs`] 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. + * + * 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 [`PaymentSendFailure`] may return a `Vec` with + * each entry matching the corresponding-index entry in the route paths, see + * [`PaymentSendFailure`] for more info. + * + * In general, a path may raise: + * * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, + * node public key) is specified. + * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates + * (including due to previous monitor update failure or new permanent monitor update + * failure). + * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the + * relevant updates. + * + * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been + * irrevocably committed to on our end. In such a case, do NOT retry the payment with a + * different route unless you intend to pay twice! + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress */ -uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * Checks if two ConfirmationTargets contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Similar to [`ChannelManager::send_payment`], but will automatically find a route based on + * `route_params` and retry failed payment paths based on `retry_strategy`. */ -bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Calls the free function if one is set + * 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. + * + * 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. + * + * 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 */ -void FeeEstimator_free(struct LDKFeeEstimator this_ptr); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** - * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL. + * Send a spontaneous payment, which is a payment that does not require the recipient to have + * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify + * the preimage, it must be a cryptographically secure random value that no intermediate node + * would be able to guess -- otherwise, an intermediate node may claim the payment and it will + * never reach the recipient. + * + * See [`send_payment`] documentation for more details on the return value of this function + * 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. + * + * Note that `route` must have exactly one path. + * + * [`send_payment`]: Self::send_payment + * + * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj); +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 LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * Creates a copy of the MonitorUpdateId + * 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 */ -struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Checks if two MonitorUpdateIds contain equal inner contents. + * Send a payment that is probing the given route for liquidity. We calculate the + * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows + * us to easily discern them from real payments. */ -uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); /** - * Checks if two MonitorUpdateIds contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Call this upon creation of a funding transaction for the given channel. + * + * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs + * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. + * + * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation + * across the p2p network. + * + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. + * + * May panic if the output found in the funding transaction is duplicative with some other + * channel (note that this should be trivially prevented by using unique funding transaction + * keys per-channel). + * + * Do NOT broadcast the funding transaction yourself. When we have safely received our + * counterparty's signature the funding transaction will automatically be broadcast via the + * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. + * + * Note that this includes RBF or similar transaction replacement strategies - lightning does + * not currently support replacing a funding transaction on an existing channel. Instead, + * create a new channel with a conflicting funding transaction. + * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See + * for more details. + * + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed */ -bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); /** - * Calls the free function if one is set + * Atomically updates the [`ChannelConfig`] for the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -void Persist_free(struct LDKPersist this_ptr); +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); /** - * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL. + * 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 */ -void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); +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); /** - * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. + * 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 */ -void ChainMonitor_free(struct LDKChainMonitor this_obj); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); /** - * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels. + * Processes HTLCs which are pending waiting on random forward delay. * - * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor - * will call back to it indicating transactions and outputs of interest. This allows clients to - * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may - * always need to fetch full blocks absent another means for determining which blocks contain - * transactions relevant to the watched channels. + * Should only really ever be called in response to a PendingHTLCsForwardable event. + * Will likely generate further events. */ -MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or - * claims which are awaiting confirmation. + * Performs actions which should happen on startup and roughly once per minute thereafter. * - * Includes the balances from each [`ChannelMonitor`] *except* those included in - * `ignored_channels`, allowing you to filter out balances from channels which are still open - * (and whose balance should likely be pulled from the [`ChannelDetails`]). + * This currently includes: + * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, + * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more + * than a minute, informing the network that they should no longer attempt to route over + * the channel. + * * 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. * - * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for - * inclusion in the return value. - */ -MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels); - -/** - * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no - * such [`ChannelMonitor`] is currently being monitored for. + * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate + * estimate fetches. * - * Note that the result holds a mutex over our monitor set, and should not be held - * indefinitely. + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelConfig`]: crate::util::config::ChannelConfig */ -MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); +void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Lists the funding outpoint of each [`ChannelMonitor`] being monitored. + * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect + * 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 [`ChannelMonitor`]s are not removed when a channel is closed as they are always - * monitoring for on-chain state resolutions. + * 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::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 + * [`ChannelManager::claim_funds`]), you should still monitor for + * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on + * startup during which time claims that were in-progress at shutdown may be replayed. */ -MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + * 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. */ -MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], enum LDKFailureCode failure_code); /** - * Indicates the persistence of a [`ChannelMonitor`] has completed after - * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation. + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any + * [`MessageSendEvent`]s needed to claim the payment. * - * Thus, the anticipated use is, at a high level: - * 1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the - * update to disk and begins updating any remote (e.g. watchtower/backup) copies, - * returning [`ChannelMonitorUpdateStatus::InProgress`], - * 2) once all remote copies are updated, you call this function with the - * `completed_update_id` that completed, and once all pending updates have completed the - * channel will be re-enabled. + * This method is guaranteed to ensure the payment has been claimed but only if the current + * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race + * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment + * successful. It will generally be available in the next [`process_pending_events`] call. * - * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently - * registered [`ChannelMonitor`]s. + * 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 `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::PaymentClaimable`]: crate::events::Event::PaymentClaimable + * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline + * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed + * [`process_pending_events`]: EventsProvider::process_pending_events + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id); +void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * Gets the node_id held by this ChannelManager */ -struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. + * + * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, + * and the `counterparty_node_id` parameter is the id of the peer which has requested to open + * the channel. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Note that this method will return an error and reject the channel, if it requires support + * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be + * used to accept such channels. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); +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); /** - * Constructs a new Watch which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is + * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating + * it as confirmed immediately. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel + * and (if the counterparty agrees), enables forwarding of payments immediately. + * + * This fully trusts that the counterparty has honestly and correctly constructed the funding + * transaction and blindly assumes that it will eventually confirm. + * + * If it does not confirm before we decide to close the channel, or if the funding transaction + * does not pay to the correct script the correct amount, *you will lose funds*. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); +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); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * Gets a payment secret and payment hash for use in an invoice given to a third party wishing + * to pay us. + * + * This differs from [`create_inbound_payment_for_hash`] only in that it generates the + * [`PaymentHash`] and [`PaymentPreimage`] for you. + * + * The [`PaymentPreimage`] will ultimately be returned to you in the [`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. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * 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 + * [`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 */ -struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. + * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. + * + * May panic if `invoice_expiry_delta_secs` is greater than one year. + * + * # Note + * This method is deprecated and will be removed soon. + * + * [`create_inbound_payment`]: Self::create_inbound_payment */ -void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); +MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with one exception specified below. + * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is + * stored external to LDK. * - * This sequence number is also used to track up to which points updates which returned - * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given - * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * 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. + * + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. * - * The only instance where update_id values are not strictly increasing is the case where we - * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See - * its docs for more details. + * `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 [`PaymentClaimable`] event will be generated, ensuring that we do not provide the + * sender \"proof-of-payment\" unless they have paid the required amount. * - * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. This should roughly match the expiry time set in the invoice. + * After this many seconds, we will remove the inbound payment, resulting in any attempts to + * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for + * invoices when no timeout is set. + * + * Note that we use block header time to time-out pending inbound payments (with some margin + * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will + * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. + * If you need exact expiry semantics, you should enforce them upon receipt of + * [`PaymentClaimable`]. + * + * 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. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * 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 + * [`PaymentClaimable`]: events::Event::PaymentClaimable */ -uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); +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); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with one exception specified below. + * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. * - * This sequence number is also used to track up to which points updates which returned - * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given - * ChannelMonitor when ChannelManager::channel_monitor_updated is called. + * May panic if `invoice_expiry_delta_secs` is greater than one year. * - * The only instance where update_id values are not strictly increasing is the case where we - * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See - * its docs for more details. + * # Note + * This method is deprecated and will be removed soon. * - * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); /** - * Creates a copy of the ChannelMonitorUpdate + * Gets an LDK-generated payment preimage from a payment hash and payment secret that were + * previously returned from [`create_inbound_payment`]. + * + * [`create_inbound_payment`]: Self::create_inbound_payment */ -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** - * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read + * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids + * are used when constructing the phantom invoice's route hints. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager */ -struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); +MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write + * Gets route hints for use in receiving [phantom node payments]. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the MonitorEvent + * 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. */ -void MonitorEvent_free(struct LDKMonitorEvent this_ptr); +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the MonitorEvent + * 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. */ -struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HTLCEvent-variant MonitorEvent + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is */ -struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Completed-variant MonitorEvent + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UpdateFailed-variant MonitorEvent + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a); +struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two MonitorEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted. + * + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`ChannelManager`] and should instead register actions to be taken later. + * */ -bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b); +MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj); +MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Read a MonitorEvent from a byte array, created by MonitorEvent_write + * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. + * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); +MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCUpdate + * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two HTLCUpdates 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. + * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b); +MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read + * 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 LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write + * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * [`ChannelManager`]. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); +struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR _config); /** - * Frees any resources used by the Balance + * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read */ -void Balance_free(struct LDKBalance this_ptr); +struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); /** - * Creates a copy of the Balance + * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write */ -struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); /** - * Utility method to constructs a new ClaimableOnChannelClose-variant Balance + * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read */ -struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis); +struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); /** - * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance + * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write */ -struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); /** - * Utility method to constructs a new ContentiousClaimable-variant Balance + * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read */ -struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height); +struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); /** - * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance + * Read a ChannelDetails from a byte array, created by ChannelDetails_write */ -struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height); +struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); /** - * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance + * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read */ -struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height); +struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); /** - * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance + * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write */ -struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); /** - * Checks if two Balances contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ -bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); /** - * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. */ -void ChannelMonitor_free(struct LDKChannelMonitor this_obj); +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); /** - * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read + * A cryptographically secure source of entropy. */ -struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); +const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Updates a ChannelMonitor on the basis of some new information provided by the Channel - * itself. - * - * panics if the given update is not the next update by update_id. + * A cryptographically secure source of entropy. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); /** - * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this - * ChannelMonitor. + * A signer that is able to perform node-scoped cryptographic operations. */ -MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. + * A signer that is able to perform node-scoped cryptographic operations. */ -MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); /** - * Gets a list of txids, with their output scripts (in the order they appear in the - * transaction), which we must learn about spends of via block_connected(). + * 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. */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly - * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs - * have been registered. + * 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 ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter); +void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); /** - * Get the list of HTLCs who's status has been updated on chain. This should be called by - * ChannelManager via [`chain::Watch::release_pending_monitor_events`]. + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. - * - * This is called by the [`EventsProvider::process_pending_events`] implementation for - * [`ChainMonitor`]. + * The fee_estimator for use in the ChannelManager in the future. * - * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events - * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor + * No calls to the FeeEstimator will be made during deserialization. */ -MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** - * Gets the `node_id` of the counterparty for this channel. - * - * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some` - * otherwise. + * The chain::Watch for use in the ChannelManager in the future. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of - * the Channel was out-of-date. - * - * You may also use this to broadcast the latest local commitment transaction, either because - * a monitor update failed with [`ChannelMonitorUpdateStatus::PermanentFailure`] or because we've - * fallen behind (i.e. we've received proof that our counterparty side knows a revocation - * secret we gave them that they shouldn't know). - * - * Broadcasting these transactions in the second case is UNSAFE, as they allow counterparty - * side to punish you. Nevertheless you may want to broadcast them if counterparty doesn't - * close channel with their commitment transaction after a substantial amount of time. Best - * may be to contact the other node operator out-of-band to coordinate other options available - * to you. In any-case, the choice is up to you. + * The chain::Watch for use in the ChannelManager in the future. * - * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** - * Processes transactions in a newly connected block, which may result in any of the following: - * - update the monitor's state against resolved HTLCs - * - punish the counterparty in the case of seeing a revoked commitment transaction - * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration - * - detect settled outputs for later spending - * - schedule and bump any in-flight claims - * - * Returns any new outputs to watch from `txdata`; after called, these are also included in - * [`get_outputs_to_watch`]. - * - * [`get_outputs_to_watch`]: #method.get_outputs_to_watch + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Determines if the disconnected block contained any transactions of interest and updates - * appropriately. + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** - * Processes transactions confirmed in a block with the given header and height, returning new - * outputs to watch. See [`block_connected`] for details. - * - * Used instead of [`block_connected`] by clients that are notified of transactions rather than - * blocks. See [`chain::Confirm`] for calling expectations. + * 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. * - * [`block_connected`]: Self::block_connected + * No calls to the router will be made during deserialization. */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Processes a transaction that was reorganized out of the chain. - * - * Used instead of [`block_disconnected`] by clients that are notified of transactions rather - * than blocks. See [`chain::Confirm`] for calling expectations. + * 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. * - * [`block_disconnected`]: Self::block_disconnected + * No calls to the router will be made during deserialization. */ -void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); -/** - * Updates the monitor with the current best chain tip, returning new outputs to watch. See - * [`block_connected`] for details. - * - * Used instead of [`block_connected`] by clients that are notified of transactions rather than - * blocks. See [`chain::Confirm`] for calling expectations. - * - * [`block_connected`]: Self::block_connected +/** + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Returns the set of txids that should be monitored for re-organization out of the chain. + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Gets the balances in this channel which are either claimable by us if we were to - * force-close the channel now or which are claimable on-chain (possibly awaiting - * confirmation). - * - * Any balances in the channel which are available on-chain (excluding on-chain fees) are - * included here until an [`Event::SpendableOutputs`] event has been generated for the - * balance, or until our counterparty has claimed the balance and accrued several - * confirmations on the claim transaction. - * - * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of - * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted - * a revoked state. - * - * See [`Balance`] for additional details on the types of claimable balances which - * may be returned here and their meanings. + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** - * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write + * Simple utility function to create a ChannelManagerReadArgs which creates the monitor + * HashMap for you. This is primarily useful for C bindings where it is not practical to + * populate a HashMap directly from C. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); +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); /** - * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. + * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write */ -void OutPoint_free(struct LDKOutPoint this_obj); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** - * The referenced transaction's txid. + * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. */ -const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; +void ExpandedKey_free(struct LDKExpandedKey this_obj); /** - * The referenced transaction's txid. + * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. + * + * It is recommended to cache this value and not regenerate it for each new inbound payment. */ -void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); /** - * The index of the referenced output in its transaction's vout. + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no + * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without + * a `ChannelManager`. + * + * `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 */ -uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); +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); /** - * The index of the referenced output in its transaction's vout. + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], + * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments] + * without a `ChannelManager`. + * + * 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 */ -void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); +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); /** - * Constructs a new OutPoint given each field + * Frees any resources used by the DecodeError */ -MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); +void DecodeError_free(struct LDKDecodeError this_ptr); /** - * Creates a copy of the OutPoint + * Creates a copy of the DecodeError */ -struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); /** - * Checks if two OutPoints contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Utility method to constructs a new UnknownVersion-variant DecodeError */ -bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); +struct LDKDecodeError DecodeError_unknown_version(void); /** - * Checks if two OutPoints contain equal inner contents. + * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError */ -uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); +struct LDKDecodeError DecodeError_unknown_required_feature(void); /** - * Convert an `OutPoint` to a lightning channel id. + * Utility method to constructs a new InvalidValue-variant DecodeError */ -MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); +struct LDKDecodeError DecodeError_invalid_value(void); /** - * Serialize the OutPoint object into a byte array which can be read by OutPoint_read + * Utility method to constructs a new ShortRead-variant DecodeError */ -struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); +struct LDKDecodeError DecodeError_short_read(void); /** - * Read a OutPoint from a byte array, created by OutPoint_write + * Utility method to constructs a new BadLengthDescriptor-variant DecodeError */ -struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +struct LDKDecodeError DecodeError_bad_length_descriptor(void); /** - * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Io-variant DecodeError */ -void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); +struct LDKDecodeError DecodeError_io(enum LDKIOError a); /** - * The outpoint which is spendable. + * Utility method to constructs a new UnsupportedCompression-variant DecodeError */ -struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKDecodeError DecodeError_unsupported_compression(void); /** - * The outpoint which is spendable. + * Checks if two DecodeErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); /** - * Per commitment point to derive the delayed payment key by key holder. + * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void Init_free(struct LDKInit this_obj); /** - * Per commitment point to derive the delayed payment key by key holder. + * The relevant features which the sender supports. */ -void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * The relevant features which the sender supports. */ -uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * 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 DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); /** - * The output which is referenced by the given outpoint. + * The receipient's network address. * - * Returns a copy of the field. + * 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 LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val); /** - * The output which is referenced by the given outpoint. + * Constructs a new Init given each field */ -void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Creates a copy of the Init */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Checks if two Inits contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. */ -const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +void ErrorMessage_free(struct LDKErrorMessage this_obj); /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ -void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; /** - * The value of the channel which this output originated from, possibly indirectly. + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ -uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The value of the channel which this output originated from, possibly indirectly. + * A possibly human-readable error description. + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * Constructs a new DelayedPaymentOutputDescriptor given each field + * A possibly human-readable error description. + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a copy of the DelayedPaymentOutputDescriptor + * Constructs a new ErrorMessage given each field */ -struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); +MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); /** - * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents. + * Creates a copy of the ErrorMessage + */ +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); + +/** + * Checks if two ErrorMessages 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 DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); +bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); /** - * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read + * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); +void WarningMessage_free(struct LDKWarningMessage this_obj); /** - * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); +const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); +void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The outpoint which is spendable. + * 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. */ -struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable. + * 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. */ -void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * The output which is referenced by the given outpoint. - * - * Returns a copy of the field. + * Constructs a new WarningMessage given each field */ -struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); /** - * The output which is referenced by the given outpoint. + * Creates a copy of the WarningMessage */ -void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Checks if two WarningMessages 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. */ -const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b); /** - * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. */ -void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void Ping_free(struct LDKPing this_obj); /** - * The value of the channel which this transactions spends. + * The desired response length. */ -uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * The value of the channel which this transactions spends. + * The desired response length. */ -void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new StaticPaymentOutputDescriptor given each field + * The ping packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * Creates a copy of the StaticPaymentOutputDescriptor + * The ping packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Checks if two StaticPaymentOutputDescriptors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new Ping given each field */ -bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); +MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); /** - * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read + * Creates a copy of the Ping */ -struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); /** - * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write + * Checks if two Pings contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); +bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); /** - * Frees any resources used by the SpendableOutputDescriptor + * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. */ -void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); +void Pong_free(struct LDKPong this_obj); /** - * Creates a copy of the SpendableOutputDescriptor + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); /** - * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor + * Constructs a new Pong given each field */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); +MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); /** - * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor + * Creates a copy of the Pong */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); /** - * Checks if two SpendableOutputDescriptors contain equal inner contents. + * Checks if two Pongs 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 SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); +bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); /** - * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); +void OpenChannel_free(struct LDKOpenChannel this_obj); /** - * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); +const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** - * Calls the free function if one is set + * The genesis hash of the blockchain where the channel is to be opened */ -void BaseSign_free(struct LDKBaseSign this_ptr); +void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Calls the free function if one is set + * A temporary channel ID, until the funding outpoint is announced */ -void Sign_free(struct LDKSign this_ptr); +const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the Recipient + * A temporary channel ID, until the funding outpoint is announced */ -enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); +void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new Node-variant Recipient + * The channel value */ -enum LDKRecipient Recipient_node(void); +uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PhantomNode-variant Recipient + * The channel value */ -enum LDKRecipient Recipient_phantom_node(void); +void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Calls the free function if one is set + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -void KeysInterface_free(struct LDKKeysInterface this_ptr); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -void InMemorySigner_free(struct LDKInMemorySigner this_obj); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * 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. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Holder secret key for blinded revocation pubkey. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Holder secret key for blinded revocation pubkey. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Holder secret key used in an HTLC transaction. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Holder secret key used in an HTLC transaction. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ -const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * The feerate per 1000-weight of sender generated transactions, until updated by + * [`UpdateFee`] */ -void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); /** - * Commitment seed. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ -const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Commitment seed. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if + * they broadcast a commitment transaction */ -void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a copy of the InMemorySigner + * The maximum number of inbound HTLCs towards sender */ -struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); +uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Creates a new [`InMemorySigner`]. + * The maximum number of inbound HTLCs towards sender */ -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); +void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * Returns the counterparty's pubkeys. - * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * The sender's key controlling the funding transaction */ -MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * 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 [`BaseSign::provide_channel_parameters`] has not been called before. + * The sender's key controlling the funding transaction */ -MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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 [`BaseSign::provide_channel_parameters`] has not been called before. + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Returns whether the holder is the initiator. - * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Funding outpoint - * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * A payment key to sender for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or - * building transactions. - * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * A payment key to sender for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Returns whether anchors should be used. - * - * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. + * Used to derive a payment key to sender for transactions broadcast by sender */ -MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described - * by `descriptor`, returning the witness stack for the input. - * - * Returns an 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. - * - * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint + * Used to derive a payment key to sender for transactions broadcast by sender */ -MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); +void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Sign the single input of `spend_tx` at index `input_idx` which spends the output - * described by `descriptor`, returning the witness stack for the input. - * - * Returns an 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 + * Used to derive an HTLC payment key to sender */ -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); +struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Constructs a new BaseSign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is + * Used to derive an HTLC payment key to sender */ -struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new Sign which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is + * The first to-be-broadcast-by-sender transaction's per commitment point */ -struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read + * The first to-be-broadcast-by-sender transaction's per commitment point */ -struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); +void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a InMemorySigner from a byte array, created by InMemorySigner_write + * The channel flags to be used */ -struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg); +uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. + * The channel flags to be used */ -void KeysManager_free(struct LDKKeysManager this_obj); +void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); /** - * 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). - * - * 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). + * The channel type that this channel will represent * - * 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. + * 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. * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); +struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Derive an old [`Sign`] containing per-channel secrets based on a key derivation parameters. + * 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 */ -MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an - * output to the given change destination (if sufficient change value remains). The - * transaction will have a feerate, at least, of the given value. - * - * Returns `Err(())` if the output value is greater than the input value minus required fee, - * if a descriptor was duplicated, or if an output descriptor `script_pubkey` - * does not match the one we can spend. - * - * 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`]. + * Creates a copy of the OpenChannel */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); /** - * 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 + * Checks if two OpenChannels contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); +bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); /** - * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. + * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. */ -void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); +void AcceptChannel_free(struct LDKAcceptChannel 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 + * A temporary channel ID, until the funding outpoint is announced */ -struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; /** - * 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`. - * - * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the - * same across restarts, or else inbound payments may fail. - * - * [phantom node payments]: PhantomKeysManager + * A temporary channel ID, until the funding outpoint is announced */ -MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]); +void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); +uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * See [`KeysManager::derive_channel_keys`] for documentation on this method. + * The threshold below which outputs on transactions broadcast by sender will be omitted */ -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]); +void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void ChannelManager_free(struct LDKChannelManager this_obj); +uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -void ChainParameters_free(struct LDKChainParameters this_obj); +void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The network for determining the `chain_hash` in Lightning messages. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The network for determining the `chain_hash` in Lightning messages. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); +uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); +void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new ChainParameters given each field + * Minimum depth of the funding transaction before the channel is considered open */ -MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); +uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChainParameters + * Minimum depth of the funding transaction before the channel is considered open */ -struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); +void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); +uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Base routing fee in millisatoshis. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction */ -uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * Base routing fee in millisatoshis. + * The maximum number of inbound HTLCs towards sender */ -void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * The maximum number of inbound HTLCs towards sender */ -uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * The sender's key controlling the funding transaction */ -void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * The sender's key controlling the funding transaction */ -uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * Used to derive a revocation key for transactions broadcast by counterparty */ -void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Constructs a new CounterpartyForwardingInfo given each field + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); +void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the CounterpartyForwardingInfo + * A payment key to sender for transactions broadcast by counterparty */ -struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); +struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. + * A payment key to sender for transactions broadcast by counterparty */ -void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); +void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The node_id of our counterparty + * Used to derive a payment key to sender for transactions broadcast by sender */ -struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The node_id of our counterparty + * Used to derive a payment key to sender for transactions broadcast by sender */ -void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty */ -void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. - * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * The first to-be-broadcast-by-sender transaction's per commitment point */ -uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. - * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * The first to-be-broadcast-by-sender transaction's per commitment point */ -void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); +void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. + * 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 */ -struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. + * 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 */ -void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); +void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * Creates a copy of the AcceptChannel */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * Checks if two AcceptChannels contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void FundingCreated_free(struct LDKFundingCreated this_obj); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * A temporary channel ID, until the funding is established */ -void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * Constructs a new ChannelCounterparty given each field + * A temporary channel ID, until the funding is established */ -MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a copy of the ChannelCounterparty + * The funding transaction ID */ -struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. + * The funding transaction ID */ -void ChannelDetails_free(struct LDKChannelDetails this_obj); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * The specific output index funding this channel */ -const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * The specific output index funding this channel */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * The signature of the channel initiator (funder) on the initial commitment transaction */ -struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * The signature of the channel initiator (funder) on the initial commitment transaction */ -void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new FundingCreated given each field */ -struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that, if this has been set, `channel_id` will be equivalent to - * `funding_txo.unwrap().to_channel_id()`. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the FundingCreated */ -void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two FundingCreateds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +void FundingSigned_free(struct LDKFundingSigned this_obj); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. - * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. - * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * The channel ID */ -struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. - * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. - * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * The channel ID */ -void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. - * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. - * - * [`short_channel_id`]: Self::short_channel_id + * Constructs a new FundingSigned given each field */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. - * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. - * - * [`short_channel_id`]: Self::short_channel_id + * Creates a copy of the FundingSigned */ -void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** - * The value, in satoshis, of this channel as appears in the funding output + * Checks if two FundingSigneds 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. */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); /** - * The value, in satoshis, of this channel as appears in the funding output + * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelReady_free(struct LDKChannelReady this_obj); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * The channel ID */ -struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32]; /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * The channel ID */ -void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The per-commitment point of the second commitment transaction */ -struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * The `user_channel_id` passed in to create_channel, or a random value if the channel was - * inbound. This may be zero for inbound channels serialized with LDK versions prior to - * 0.0.113. + * The per-commitment point of the second commitment transaction */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); +void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Our total balance. This is the amount we would get if we close the channel. - * This value is not exact. Due to various in-flight changes and feerate changes, exactly this - * amount is not likely to be recoverable on close. - * - * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose - * balance is not available for inclusion in new outbound HTLCs). This further does not include - * any pending outgoing HTLCs which are awaiting some other resolution to be sent. - * This does not consider any on-chain fees. + * If set, provides a `short_channel_id` alias for this channel. * - * See also [`ChannelDetails::outbound_capacity_msat`] + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ -uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * Our total balance. This is the amount we would get if we close the channel. - * This value is not exact. Due to various in-flight changes and feerate changes, exactly this - * amount is not likely to be recoverable on close. - * - * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose - * balance is not available for inclusion in new outbound HTLCs). This further does not include - * any pending outgoing HTLCs which are awaiting some other resolution to be sent. - * This does not consider any on-chain fees. + * If set, provides a `short_channel_id` alias for this channel. * - * See also [`ChannelDetails::outbound_capacity_msat`] + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ -void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new outbound HTLCs). This further does not include any pending - * outgoing HTLCs which are awaiting some other resolution to be sent. - * - * See also [`ChannelDetails::balance_msat`] - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we - * should be able to spend nearly this amount. + * Constructs a new ChannelReady given each field */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); /** - * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new outbound HTLCs). This further does not include any pending - * outgoing HTLCs which are awaiting some other resolution to be sent. - * - * See also [`ChannelDetails::balance_msat`] - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we - * should be able to spend nearly this amount. + * Creates a copy of the ChannelReady */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + * Checks if two ChannelReadys 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. */ -uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void Shutdown_free(struct LDKShutdown this_obj); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * The channel ID */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * The channel ID */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The destination of this peer's funds on closing. * - * [`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 + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The destination of this peer's funds on closing. * - * [`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 + * 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); + +/** + * Constructs a new Shutdown given each field + */ +MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); + +/** + * Creates a copy of the Shutdown */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); /** - * 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. + * Checks if two Shutdowns contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * True if the channel was initiated (and thus funded) by us. + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * True if the channel was initiated (and thus funded) by us. + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * Constructs a new ClosingSignedFeeRange given each field */ -bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * Creates a copy of the ClosingSignedFeeRange */ -void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_channel_ready`. + * Checks if two ClosingSignedFeeRanges 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 ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_channel_ready`. + * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ClosingSigned_free(struct LDKClosingSigned this_obj); /** - * True if this channel is (or will be) publicly-announced. + * The channel ID */ -bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; /** - * True if this channel is (or will be) publicly-announced. + * The channel ID */ -void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * The proposed total fee for the closing transaction */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * The proposed total fee for the closing transaction */ -void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * A signature on the closing transaction */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * A signature on the closing transaction */ -void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); - -/** - * 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, 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 - */ -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); +void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); /** - * Gets the current SCID which should be used to identify this channel for inbound payments. - * This should be used for providing invoice hints or in any other context where our - * counterparty will forward a payment to us. - * - * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the - * [`ChannelDetails::short_channel_id`]. See those for more information. + * Constructs a new ClosingSigned given each field */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** - * Gets the current SCID which should be used to identify this channel for outbound payments. - * This should be used in [`Route`]s to describe the first hop or in other contexts where - * we're sending or forwarding a payment outbound over this channel. - * - * This is either the [`ChannelDetails::short_channel_id`], if set, or the - * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + * Creates a copy of the ClosingSigned */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); /** - * Frees any resources used by the PaymentSendFailure + * Checks if two ClosingSigneds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); +bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); /** - * Creates a copy of the PaymentSendFailure + * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); /** - * Utility method to constructs a new ParameterError-variant PaymentSendFailure + * The channel ID */ -struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); +const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new PathParameterError-variant PaymentSendFailure + * The channel ID */ -struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure + * The HTLC ID */ -struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure + * The HTLC ID */ -struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new PartialFailure-variant PaymentSendFailure + * The HTLC value in milli-satoshi */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. + * The HTLC value in milli-satoshi */ -void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); +void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * The list of channels to be included in the invoice route hints. + * The payment hash, the pre-image of which controls HTLC redemption */ -struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * The list of channels to be included in the invoice route hints. + * The payment hash, the pre-image of which controls HTLC redemption */ -void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); +void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * The expiry height of the HTLC */ -uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * The expiry height of the HTLC */ -void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); +void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Creates a copy of the UpdateAddHTLC */ -struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Checks if two UpdateAddHTLCs contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); /** - * Constructs a new PhantomRouteHints given each field + * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); +void OnionMessage_free(struct LDKOnionMessage this_obj); /** - * Creates a copy of the PhantomRouteHints + * Used in decrypting the onion packet's payload. */ -struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); +struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelManager to hold several channels and route between them. - * - * This is the main \"logic hub\" for all channel-related actions, and implements - * ChannelMessageHandler. - * - * Non-proportional fees are fixed according to our risk using the provided fee estimator. - * - * Users need to notify the new ChannelManager when a new block is connected or - * disconnected using its `block_connected` and `block_disconnected` methods, starting - * from after `params.latest_hash`. + * Used in decrypting the onion packet's payload. */ -MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); +void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Gets the current configuration applied to all new channels. + * Creates a copy of the OnionMessage */ -MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); /** - * Creates a new outbound channel to the given remote node and with the given value. - * - * `user_channel_id` will be provided back as in - * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events - * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 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`. - * - * Note that we do not check if you are currently connected to the given peer. If no - * connection is available, the outbound `open_channel` message may fail to send, resulting in - * the channel eventually being silently forgotten (dropped on reload). - * - * Returns the new Channel's temporary `channel_id`. This ID will appear as - * [`Event::FundingGenerationReady::temporary_channel_id`] and in - * [`ChannelDetails::channel_id`] until after - * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for - * one derived from the funding transaction's TXID. If the counterparty rejects the channel - * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. - * - * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id - * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id - * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id - * - * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two OnionMessages 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. */ -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); +bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); /** - * Gets the list of open channels, in random order. See ChannelDetail field documentation for - * more information. + * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); /** - * Gets the list of usable channels, in random order. Useful as an argument to [`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 + * The channel ID */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * * If we are the channel initiator, we will pay between our [`Background`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate. - * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`Background`] feerate or the feerate which - * would appear on a force-closure transaction, whichever is lower. We will allow our - * counterparty to pay as much fee as they'd like, however. - * - * May generate a SendShutdown message event on success, which should be relayed. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * The channel ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated - * the channel being closed or not: - * * If we are the channel initiator, we will pay at least this feerate on the closing - * transaction. The upper-bound is set by - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). - * * If our counterparty is the channel initiator, we will refuse to accept a channel closure - * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which - * will appear on a force-closure transaction, whichever is lower). - * - * May generate a SendShutdown message event on success, which should be relayed. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * The HTLC ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Force closes a channel, immediately broadcasting the latest local transaction(s) and - * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to - * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding - * channel. + * The HTLC ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting - * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the - * `counterparty_node_id` isn't the counterparty of the corresponding channel. - * - * You can always get the latest local transaction(s) to broadcast from - * [`ChannelMonitor::get_latest_holder_commitment_txn`]. + * The pre-image of the payment hash, allowing HTLC redemption */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * Force close all channels, immediately broadcasting the latest local commitment transaction - * for each to the chain and rejecting new HTLCs on each. + * The pre-image of the payment hash, allowing HTLC redemption */ -void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Force close all channels rejecting new HTLCs on each but without broadcasting the latest - * local transaction(s). + * Constructs a new UpdateFulfillHTLC given each field */ -void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); /** - * Sends a payment along a given route. - * - * Value parameters are provided via the last hop in route, see documentation for RouteHop - * fields for more info. - * - * 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`]) 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 (e.g. via - * [`PeerManager::process_events`]). - * - * Each path may have a different return value, and PaymentSendValue may return a Vec with - * each entry matching the corresponding-index entry in the route paths, see - * PaymentSendFailure for more info. - * - * In general, a path may raise: - * * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, - * node public key) is specified. - * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates - * (including due to previous monitor update failure or new permanent monitor update - * failure). - * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the - * relevant updates. - * - * Note that depending on the type of the PaymentSendFailure the HTLC may have been - * irrevocably committed to on our end. In such a case, do NOT retry the payment with a - * different route unless you intend to pay twice! - * - * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate - * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For - * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route - * must not contain multiple paths as multi-path payments require a recipient-provided - * payment_secret. - * - * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature - * bit set (either as required or as available). If multiple paths are present in the Route, - * we assume the invoice had the basic_mpp feature set. - * - * [`Event::PaymentSent`]: events::Event::PaymentSent - * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the UpdateFulfillHTLC */ -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); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); /** - * Retries a payment along the given [`Route`]. - * - * Errors returned are a superset of those returned from [`send_payment`], so see - * [`send_payment`] documentation for more details on errors. This method will also error if the - * retry amount puts the payment more than 10% over the payment's total amount, if the payment - * for the given `payment_id` cannot be found (likely due to timeout or success), or if - * further retries have been disabled with [`abandon_payment`]. - * - * [`send_payment`]: [`ChannelManager::send_payment`] - * [`abandon_payment`]: [`ChannelManager::abandon_payment`] + * Checks if two UpdateFulfillHTLCs 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. */ -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); +bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); /** - * Signals that no further retries for the given payment will occur. - * - * After this method returns, no future calls to [`retry_payment`] for the given `payment_id` - * are allowed. 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. - * - * If an [`Event::PaymentFailed`] event is generated and we restart without this - * [`ChannelManager`] having been persisted, the payment may still be in the pending state - * upon restart. This allows further calls to [`retry_payment`] (and requiring a second call - * to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to - * [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`]. - * - * [`abandon_payment`]: Self::abandon_payment - * [`retry_payment`]: Self::retry_payment - * [`Event::PaymentFailed`]: events::Event::PaymentFailed - * [`Event::PaymentSent`]: events::Event::PaymentSent + * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. */ -void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); /** - * Send a spontaneous payment, which is a payment that does not require the recipient to have - * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify - * the preimage, it must be a cryptographically secure random value that no intermediate node - * would be able to guess -- otherwise, an intermediate node may claim the payment and it will - * never reach the recipient. - * - * See [`send_payment`] documentation for more details on the return value of this function - * 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. - * - * Note that `route` must have exactly one path. - * - * [`send_payment`]: Self::send_payment - * - * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + * The channel ID */ -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); +const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; /** - * Send a payment that is probing the given route for liquidity. We calculate the - * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows - * us to easily discern them from real payments. + * The channel ID */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Call this upon creation of a funding transaction for the given channel. - * - * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs - * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. - * - * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation - * across the p2p network. - * - * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided - * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. - * - * May panic if the output found in the funding transaction is duplicative with some other - * channel (note that this should be trivially prevented by using unique funding transaction - * keys per-channel). - * - * Do NOT broadcast the funding transaction yourself. When we have safely received our - * counterparty's signature the funding transaction will automatically be broadcast via the - * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. - * - * Note that this includes RBF or similar transaction replacement strategies - lightning does - * not currently support replacing a funding transaction on an existing channel. Instead, - * create a new channel with a conflicting funding transaction. - * - * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend - * the wallet software generating the funding transaction to apply anti-fee sniping as - * implemented by Bitcoin Core wallet. See - * for more details. - * - * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady - * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed + * The HTLC ID */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Atomically updates the [`ChannelConfig`] for the given channels. - * - * Once the updates are applied, each eligible channel (advertised with a known short channel - * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], - * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated - * containing the new [`ChannelUpdate`] message which should be broadcast to the network. - * - * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect - * `counterparty_node_id` is provided. - * - * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value - * below [`MIN_CLTV_EXPIRY_DELTA`]. - * - * If an error is returned, none of the updates should be considered applied. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths - * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat - * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta - * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelUnavailable`]: APIError::ChannelUnavailable - * [`APIMisuseError`]: APIError::APIMisuseError + * The HTLC ID */ -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); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * 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 + * Creates a copy of the UpdateFailHTLC */ -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); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); /** - * 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 + * Checks if two UpdateFailHTLCs 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. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); +bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); /** - * Processes HTLCs which are pending waiting on random forward delay. - * - * Should only really ever be called in response to a PendingHTLCsForwardable event. - * Will likely generate further events. + * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); /** - * Performs actions which should happen on startup and roughly once per minute thereafter. - * - * This currently includes: - * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, - * * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more - * than a minute, informing the network that they should no longer attempt to route over - * the channel. - * * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs - * with the current `ChannelConfig`. - * - * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate - * estimate fetches. + * The channel ID */ -void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; /** - * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect - * 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::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 - * [`ChannelManager::claim_funds`]), you should still monitor for - * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on - * startup during which time claims that were in-progress at shutdown may be replayed. + * The channel ID */ -void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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 - * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be - * 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 `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::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 + * The HTLC ID */ -void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Gets the node_id held by this ChannelManager + * The HTLC ID */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. - * - * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, - * and the `counterparty_node_id` parameter is the id of the peer which has requested to open - * the channel. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Note that this method will return an error and reject the channel, if it requires support - * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be - * used to accept such channels. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * The failure code */ -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); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating - * it as confirmed immediately. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel - * and (if the counterparty agrees), enables forwarding of payments immediately. - * - * This fully trusts that the counterparty has honestly and correctly constructed the funding - * transaction and blindly assumes that it will eventually confirm. - * - * If it does not confirm before we decide to close the channel, or if the funding transaction - * does not pay to the correct script the correct amount, *you will lose funds*. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * The failure code */ -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); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); /** - * Gets a payment secret and payment hash for use in an invoice given to a third party wishing - * to pay us. - * - * This differs from [`create_inbound_payment_for_hash`] only in that it generates the - * [`PaymentHash`] and [`PaymentPreimage`] for you. - * - * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which - * will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be - * passed directly to [`claim_funds`]. - * - * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. - * - * Note that a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. - * - * # Note - * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. - * - * Errors if `min_value_msat` is greater than total bitcoin supply. - * - * [`claim_funds`]: Self::claim_funds - * [`PaymentClaimable`]: events::Event::PaymentClaimable - * [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * Creates a copy of the UpdateFailMalformedHTLC */ -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 LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); /** - * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share - * serialized state with LDK node(s) running 0.0.103 and earlier. - * - * May panic if `invoice_expiry_delta_secs` is greater than one year. - * - * # Note - * This method is deprecated and will be removed soon. - * - * [`create_inbound_payment`]: Self::create_inbound_payment + * Checks if two UpdateFailMalformedHTLCs 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. */ -MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); +bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); /** - * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is - * stored external to LDK. - * - * 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. - * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though - * note that LDK will not stop you from registering duplicate payment hashes for inbound - * payments. - * - * `min_value_msat` should be set if the invoice being generated contains a value. Any payment - * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`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 - * in excess of the current time. This should roughly match the expiry time set in the invoice. - * After this many seconds, we will remove the inbound payment, resulting in any attempts to - * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for - * invoices when no timeout is set. - * - * Note that we use block header time to time-out pending inbound payments (with some margin - * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. - * If you need exact expiry semantics, you should enforce them upon receipt of - * [`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 a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. - * - * # Note - * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. - * - * Errors if `min_value_msat` is greater than total bitcoin supply. - * - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentClaimable`]: events::Event::PaymentClaimable + * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. */ -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); +void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); /** - * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share - * serialized state with LDK node(s) running 0.0.103 and earlier. - * - * May panic if `invoice_expiry_delta_secs` is greater than one year. - * - * # Note - * This method is deprecated and will be removed soon. - * - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * The channel ID */ -MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); +const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; /** - * Gets an LDK-generated payment preimage from a payment hash and payment secret that were - * previously returned from [`create_inbound_payment`]. - * - * [`create_inbound_payment`]: Self::create_inbound_payment + * The channel ID */ -MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids - * are used when constructing the phantom invoice's route hints. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * A signature on the commitment transaction */ -MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * Gets route hints for use in receiving [phantom node payments]. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * A signature on the commitment transaction */ -MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * 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`]. + * Signatures on the HTLC transactions * - * 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. + * Returns a copy of the field. */ -MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * 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. + * Signatures on the HTLC transactions */ -MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); /** - * 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 + * Constructs a new CommitmentSigned given each field */ -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * Creates a copy of the CommitmentSigned */ -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * Checks if two CommitmentSigneds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); +bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. */ -struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); +void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); /** - * 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`], [`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 + * The channel ID */ -MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); +const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** - * Blocks until ChannelManager needs to be persisted. Only one listener on - * [`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 + * The channel ID */ -void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Gets a [`Future`] that completes when a persistable update is available. Note that - * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and - * should instead register actions to be taken later. + * The secret corresponding to the per-commitment point */ -MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * The secret corresponding to the per-commitment point */ -MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * The next sender-broadcast commitment transaction's per-commitment point */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * Fetches the set of [`NodeFeatures`] flags which are provided by or required by - * [`ChannelManager`]. + * The next sender-broadcast commitment transaction's per-commitment point */ -struct LDKNodeFeatures provided_node_features(void); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by - * [`ChannelManager`]. + * Constructs a new RevokeAndACK given each field */ -struct LDKChannelFeatures provided_channel_features(void); +MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); /** - * Fetches the set of [`InitFeatures`] flags which are provided by or required by - * [`ChannelManager`]. + * Creates a copy of the RevokeAndACK */ -struct LDKInitFeatures provided_init_features(void); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); /** - * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read + * Checks if two RevokeAndACKs contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); +bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); /** - * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write + * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); +void UpdateFee_free(struct LDKUpdateFee this_obj); /** - * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read + * The channel ID */ -struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); +const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; /** - * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write + * The channel ID */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read + * Fee rate per 1000-weight of the transaction */ -struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * Read a ChannelDetails from a byte array, created by ChannelDetails_write + * Fee rate per 1000-weight of the transaction */ -struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read + * Constructs a new UpdateFee given each field */ -struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); +MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); /** - * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write + * Creates a copy of the UpdateFee */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); /** - * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read + * Checks if two UpdateFees contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); /** - * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. + * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL. */ -void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +void DataLossProtect_free(struct LDKDataLossProtect this_obj); /** - * 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. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; /** - * 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. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val); +void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * The sender's per-commitment point for their current commitment transaction */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * The sender's per-commitment point for their current commitment transaction */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); +void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * Constructs a new DataLossProtect given each field */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * Creates a copy of the DataLossProtect */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); +struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Checks if two DataLossProtects 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. */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +void ChannelReestablish_free(struct LDKChannelReestablish this_obj); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The channel ID */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The channel ID */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The next commitment number for the sender */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The next commitment number for the sender */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * Simple utility function to create a ChannelManagerReadArgs which creates the monitor - * HashMap for you. This is primarily useful for C bindings where it is not practical to - * populate a HashMap directly from C. + * The next commitment number for the recipient */ -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); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write + * The next commitment number for the recipient */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelReestablish */ -void ExpandedKey_free(struct LDKExpandedKey this_obj); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); /** - * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. - * - * It is recommended to cache this value and not regenerate it for each new inbound payment. + * Checks if two ChannelReestablishs 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. */ -MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); +bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); /** - * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no - * `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 - * 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. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. */ -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); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); /** - * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], - * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments] - * without a `ChannelManager`. - * - * See [`create`] for information on the `keys` and `current_time` parameters. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * The channel ID */ -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); +const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the DecodeError + * The channel ID */ -void DecodeError_free(struct LDKDecodeError this_ptr); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a copy of the DecodeError + * The short channel ID */ -struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new UnknownVersion-variant DecodeError + * The short channel ID */ -struct LDKDecodeError DecodeError_unknown_version(void); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError + * A signature by the node key */ -struct LDKDecodeError DecodeError_unknown_required_feature(void); +struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new InvalidValue-variant DecodeError + * A signature by the node key */ -struct LDKDecodeError DecodeError_invalid_value(void); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Utility method to constructs a new ShortRead-variant DecodeError + * A signature by the funding key */ -struct LDKDecodeError DecodeError_short_read(void); +struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BadLengthDescriptor-variant DecodeError + * A signature by the funding key */ -struct LDKDecodeError DecodeError_bad_length_descriptor(void); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Utility method to constructs a new Io-variant DecodeError + * Constructs a new AnnouncementSignatures given each field */ -struct LDKDecodeError DecodeError_io(enum LDKIOError a); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); /** - * Utility method to constructs a new UnsupportedCompression-variant DecodeError + * Creates a copy of the AnnouncementSignatures */ -struct LDKDecodeError DecodeError_unsupported_compression(void); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); /** - * Checks if two DecodeErrors contain equal inner contents. + * Checks if two AnnouncementSignaturess 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 DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); +bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); /** - * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. + * Frees any resources used by the NetAddress */ -void Init_free(struct LDKInit this_obj); +void NetAddress_free(struct LDKNetAddress this_ptr); /** - * The relevant features which the sender supports + * Creates a copy of the NetAddress */ -struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); /** - * The relevant features which the sender supports + * Utility method to constructs a new IPv4-variant NetAddress */ -void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); /** - * 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. + * Utility method to constructs a new IPv6-variant NetAddress */ -struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); /** - * 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. + * Utility method to constructs a new OnionV2-variant NetAddress */ -void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val); +struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); /** - * Constructs a new Init given each field + * Utility method to constructs a new OnionV3-variant NetAddress */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg); +struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Creates a copy of the Init + * Utility method to constructs a new Hostname-variant NetAddress */ -struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); +struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); /** - * Checks if two Inits contain equal inner contents. + * Checks if two NetAddresss 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 Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); - -/** - * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. */ -void ErrorMessage_free(struct LDKErrorMessage this_obj); +bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b); /** - * The channel ID involved in the error. - * - * All-0s indicates a general error unrelated to a specific channel, after which all channels - * with the sending peer should be closed. + * Serialize the NetAddress object into a byte array which can be read by NetAddress_read */ -const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); /** - * The channel ID involved in the error. - * - * All-0s indicates a general error unrelated to a specific channel, after which all channels - * with the sending peer should be closed. + * Read a NetAddress from a byte array, created by NetAddress_write */ -void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); /** - * A possibly human-readable error description. - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in - * the terminal emulator or the logging subsystem. + * Frees any resources used by the UnsignedGossipMessage */ -struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); +void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage 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 terminal emulator or the logging subsystem. + * Creates a copy of the UnsignedGossipMessage */ -void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); /** - * Constructs a new ErrorMessage given each field + * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage */ -MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); /** - * Creates a copy of the ErrorMessage + * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage */ -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); /** - * Checks if two ErrorMessages 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. + * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage */ -bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); /** - * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. + * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read */ -void WarningMessage_free(struct LDKWarningMessage this_obj); +struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); /** - * The channel ID involved in the warning. - * - * All-0s indicates a warning unrelated to a specific channel. + * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. */ -const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32]; +void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); /** - * The channel ID involved in the warning. - * - * All-0s indicates a warning unrelated to a specific channel. + * The advertised features */ -void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * 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. + * The advertised features */ -struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * 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. + * A strictly monotonic announcement counter, with gaps allowed */ -void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Constructs a new WarningMessage given each field + * A strictly monotonic announcement counter, with gaps allowed */ -MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the WarningMessage + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); +struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Checks if two WarningMessages 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. + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. + * An RGB color for UI purposes */ -void Ping_free(struct LDKPing this_obj); +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** - * The desired response length + * An RGB color for UI purposes */ -uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * The desired response length + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ -void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The ping packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ -uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * The ping packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * List of addresses on which this node is reachable + * + * Returns a copy of the field. */ -void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Constructs a new Ping given each field + * List of addresses on which this node is reachable */ -MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); /** - * Creates a copy of the Ping + * Creates a copy of the UnsignedNodeAnnouncement */ -struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); /** - * Checks if two Pings contain equal inner contents. + * Checks if two UnsignedNodeAnnouncements 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 Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); +bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); /** - * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. + * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. */ -void Pong_free(struct LDKPong this_obj); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** - * The pong packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * The signature by the node key */ -uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); +struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The pong packet size. - * This field is not sent on the wire. byteslen zeros are sent. + * The signature by the node key */ -void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Constructs a new Pong given each field + * The actual content of the announcement */ -MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Creates a copy of the Pong + * The actual content of the announcement */ -struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); /** - * Checks if two Pongs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new NodeAnnouncement given each field */ -bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** - * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. + * Creates a copy of the NodeAnnouncement */ -void OpenChannel_free(struct LDKOpenChannel this_obj); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); /** - * The genesis hash of the blockchain where the channel is to be opened + * Checks if two NodeAnnouncements 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. */ -const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b); /** - * The genesis hash of the blockchain where the channel is to be opened + * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); /** - * A temporary channel ID, until the funding outpoint is announced + * The advertised channel features */ -const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * A temporary channel ID, until the funding outpoint is announced + * The advertised channel features */ -void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * The channel value + * The genesis hash of the blockchain where the channel is to be opened */ -uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * The channel value + * The genesis hash of the blockchain where the channel is to be opened */ -void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * The short channel ID */ -uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * The short channel ID */ -void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * One of the two `node_id`s which are endpoints of this channel */ -uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * One of the two `node_id`s which are endpoints of this channel */ -void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The other of the two `node_id`s which are endpoints of this channel */ -uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The other of the two `node_id`s which are endpoints of this channel */ -void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The funding key for the first node */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The funding key for the first node */ -void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The funding key for the second node */ -uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The funding key for the second node */ -void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * Creates a copy of the UnsignedChannelAnnouncement */ -uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); /** - * The feerate per 1000-weight of sender generated transactions, until updated by update_fee + * Checks if two UnsignedChannelAnnouncements contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); +bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Authentication of the announcement by the first public node */ -void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards sender + * Authentication of the announcement by the first public node */ -uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The maximum number of inbound HTLCs towards sender + * Authentication of the announcement by the second public node */ -void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The sender's key controlling the funding transaction + * Authentication of the announcement by the second public node */ -struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * The sender's key controlling the funding transaction + * Proof of funding UTXO ownership by the first public node */ -void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Proof of funding UTXO ownership by the first public node */ -struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Proof of funding UTXO ownership by the second public node */ -void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * A payment key to sender for transactions broadcast by counterparty + * Proof of funding UTXO ownership by the second public node */ -struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * A payment key to sender for transactions broadcast by counterparty + * The actual announcement */ -void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * The actual announcement */ -struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Constructs a new ChannelAnnouncement given each field */ -void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); /** - * Used to derive an HTLC payment key to sender + * Creates a copy of the ChannelAnnouncement */ -struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); /** - * Used to derive an HTLC payment key to sender + * Checks if two ChannelAnnouncements contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * The genesis hash of the blockchain where the channel is to be opened */ -void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** - * Channel flags + * The genesis hash of the blockchain where the channel is to be opened */ -uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Channel flags + * The short channel ID */ -void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The short channel ID */ -struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Creates a copy of the OpenChannel + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two OpenChannels 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. + * Channel flags */ -bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); +uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. + * Channel flags */ -void AcceptChannel_free(struct LDKAcceptChannel this_obj); +void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * A temporary channel ID, until the funding outpoint is announced + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * A temporary channel ID, until the funding outpoint is announced + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The minimum HTLC size incoming to sender, in milli-satoshi */ -uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The base HTLC fee charged by sender, in milli-satoshi */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The base HTLC fee charged by sender, in milli-satoshi */ -void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The amount to fee multiplier, in micro-satoshi */ -uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The amount to fee multiplier, in micro-satoshi */ -void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Minimum depth of the funding transaction before the channel is considered open + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * + * Returns a copy of the field. */ -uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Minimum depth of the funding transaction before the channel is considered open + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. + * + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. */ -void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); +void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Constructs a new UnsignedChannelUpdate given each field */ -uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Creates a copy of the UnsignedChannelUpdate */ -void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); /** - * The maximum number of inbound HTLCs towards sender + * Checks if two UnsignedChannelUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); /** - * The maximum number of inbound HTLCs towards sender + * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. */ -void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** - * The sender's key controlling the funding transaction + * A signature of the channel update */ -struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * The sender's key controlling the funding transaction + * A signature of the channel update */ -void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * The actual channel update */ -struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * The actual channel update */ -void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); /** - * A payment key to sender for transactions broadcast by counterparty + * Constructs a new ChannelUpdate given each field */ -struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** - * A payment key to sender for transactions broadcast by counterparty + * Creates a copy of the ChannelUpdate */ -void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Checks if two ChannelUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. */ -void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * The genesis hash of the blockchain being queried */ -struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * The genesis hash of the blockchain being queried */ -void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * The height of the first block for the channel UTXOs being queried */ -struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * The height of the first block for the channel UTXOs being queried */ -void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_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. - * - * 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 + * The number of blocks to include in the query results */ -struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *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. - * - * 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 + * The number of blocks to include in the query results */ -void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the AcceptChannel + * Constructs a new QueryChannelRange given each field */ -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); /** - * Checks if two AcceptChannels contain equal inner contents. + * Creates a copy of the QueryChannelRange + */ +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); + +/** + * Checks if two QueryChannelRanges 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 AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); +bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); /** - * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. */ -void FundingCreated_free(struct LDKFundingCreated this_obj); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); /** - * A temporary channel ID, until the funding is established + * The genesis hash of the blockchain being queried */ -const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** - * A temporary channel ID, until the funding is established + * The genesis hash of the blockchain being queried */ -void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The funding transaction ID + * The height of the first block in the range of the reply */ -const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The funding transaction ID + * The height of the first block in the range of the reply */ -void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * The specific output index funding this channel + * The number of blocks included in the range of the reply */ -uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The specific output index funding this channel + * The number of blocks included in the range of the reply */ -void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); +void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * True when this is the final reply for a query */ -struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * True when this is the final reply for a query */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val); +void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new FundingCreated given each field + * The `short_channel_id`s in the channel range + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg); +struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Creates a copy of the FundingCreated + * The `short_channel_id`s in the channel range */ -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Checks if two FundingCreateds contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new ReplyChannelRange given each field */ -bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); +MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. + * Creates a copy of the ReplyChannelRange */ -void FundingSigned_free(struct LDKFundingSigned this_obj); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); /** - * The channel ID + * Checks if two ReplyChannelRanges 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. */ -const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; +bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); /** - * The channel ID + * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. */ -void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * The genesis hash of the blockchain being queried */ -struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * The genesis hash of the blockchain being queried */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new FundingSigned given each field + * The short_channel_ids that are being queried + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg); +struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); /** - * Creates a copy of the FundingSigned + * The short_channel_ids that are being queried */ -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Checks if two FundingSigneds contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new QueryShortChannelIds given each field */ -bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); +MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. + * Creates a copy of the QueryShortChannelIds */ -void ChannelReady_free(struct LDKChannelReady this_obj); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); /** - * The channel ID + * Checks if two QueryShortChannelIdss 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. */ -const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32]; +bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); /** - * The channel ID + * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. */ -void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); /** - * The per-commitment point of the second commitment transaction + * The genesis hash of the blockchain that was queried */ -struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** - * The per-commitment point of the second commitment transaction + * The genesis hash of the blockchain that was queried */ -void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes 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. + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *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. + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new ChannelReady given each field + * Constructs a new ReplyShortChannelIdsEnd given each field */ -MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); +MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); /** - * Creates a copy of the ChannelReady + * Creates a copy of the ReplyShortChannelIdsEnd */ -struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); /** - * Checks if two ChannelReadys contain equal inner contents. + * Checks if two ReplyShortChannelIdsEnds 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 ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); +bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); /** - * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. + * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. */ -void Shutdown_free(struct LDKShutdown this_obj); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); /** - * The channel ID + * The genesis hash of the blockchain for channel and node information */ -const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** - * The channel ID + * The genesis hash of the blockchain for channel and node information */ -void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * The starting unix timestamp */ -struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * The destination of this peer's funds on closing. - * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh. + * The starting unix timestamp */ -void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * Constructs a new Shutdown given each field + * The range of information in seconds */ -MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * Creates a copy of the Shutdown + * The range of information in seconds */ -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two Shutdowns contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new GossipTimestampFilter given each field */ -bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); +MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); /** - * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. + * Creates a copy of the GossipTimestampFilter */ -void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Checks if two GossipTimestampFilters 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. */ -uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Frees any resources used by the ErrorAction */ -void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +void ErrorAction_free(struct LDKErrorAction this_ptr); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Creates a copy of the ErrorAction */ -uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Utility method to constructs a new DisconnectPeer-variant ErrorAction */ -void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); /** - * Constructs a new ClosingSignedFeeRange given each field + * Utility method to constructs a new IgnoreError-variant ErrorAction */ -MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); +struct LDKErrorAction ErrorAction_ignore_error(void); /** - * Creates a copy of the ClosingSignedFeeRange + * Utility method to constructs a new IgnoreAndLog-variant ErrorAction */ -struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); +struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); /** - * Checks if two ClosingSignedFeeRanges 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. + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction */ -bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); +struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); /** - * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendErrorMessage-variant ErrorAction */ -void ClosingSigned_free(struct LDKClosingSigned this_obj); +struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); /** - * The channel ID + * Utility method to constructs a new SendWarningMessage-variant ErrorAction */ -const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; +struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); /** - * The channel ID + * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. */ -void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void LightningError_free(struct LDKLightningError this_obj); /** - * The proposed total fee for the closing transaction + * A human-readable message describing the error */ -uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * The proposed total fee for the closing transaction + * A human-readable message describing the error */ -void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); /** - * A signature on the closing transaction + * The action which should be taken against the offending peer. */ -struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * A signature on the closing transaction + * The action which should be taken against the offending peer. */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new LightningError given each field */ -struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the LightningError */ -void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); /** - * Constructs a new ClosingSigned given each field + * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); /** - * Creates a copy of the ClosingSigned + * `update_add_htlc` messages which should be sent */ -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Checks if two ClosingSigneds 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. + * `update_add_htlc` messages which should be sent */ -bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** - * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. + * `update_fulfill_htlc` messages which should be sent */ -void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); +struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The channel ID + * `update_fulfill_htlc` messages which should be sent */ -const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** - * The channel ID + * `update_fail_htlc` messages which should be sent */ -void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The HTLC ID + * `update_fail_htlc` messages which should be sent */ -uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** - * The HTLC ID + * `update_fail_malformed_htlc` messages which should be sent */ -void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The HTLC value in milli-satoshi + * `update_fail_malformed_htlc` messages which should be sent */ -uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** - * The HTLC value in milli-satoshi + * 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 */ -void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The payment hash, the pre-image of which controls HTLC redemption + * 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 */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** - * The payment hash, the pre-image of which controls HTLC redemption + * A `commitment_signed` message which should be sent */ -void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The expiry height of the HTLC + * A `commitment_signed` message which should be sent */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); /** - * The expiry height of the HTLC + * Constructs a new CommitmentUpdate given each field */ -void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); /** - * Creates a copy of the UpdateAddHTLC + * Creates a copy of the CommitmentUpdate */ -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); /** - * Checks if two UpdateAddHTLCs contain equal inner contents. + * Checks if two CommitmentUpdates 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 UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); +bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); /** - * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void OnionMessage_free(struct LDKOnionMessage this_obj); +void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); /** - * Used in decrypting the onion packet's payload. + * Calls the free function if one is set */ -struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); +void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); /** - * Used in decrypting the onion packet's payload. + * Calls the free function if one is set */ -void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); /** - * Creates a copy of the OnionMessage + * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ -struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); /** - * Checks if two OnionMessages contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a AcceptChannel from a byte array, created by AcceptChannel_write */ -bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); /** - * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. + * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read */ -void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); /** - * The channel ID + * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write */ -const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read */ -void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); /** - * The HTLC ID + * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); /** - * The HTLC ID + * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read */ -void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); /** - * The pre-image of the payment hash, allowing HTLC redemption + * Read a ClosingSigned from a byte array, created by ClosingSigned_write */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); /** - * The pre-image of the payment hash, allowing HTLC redemption + * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read */ -void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); /** - * Constructs a new UpdateFulfillHTLC given each field + * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write */ -MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); /** - * Creates a copy of the UpdateFulfillHTLC + * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read */ -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); /** - * Checks if two UpdateFulfillHTLCs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write */ -bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); /** - * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. + * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read */ -void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); /** - * The channel ID + * Read a FundingCreated from a byte array, created by FundingCreated_write */ -const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read */ -void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); /** - * The HTLC ID + * Read a FundingSigned from a byte array, created by FundingSigned_write */ -uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); /** - * The HTLC ID + * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read */ -void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); /** - * Creates a copy of the UpdateFailHTLC + * Read a ChannelReady from a byte array, created by ChannelReady_write */ -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); /** - * Checks if two UpdateFailHTLCs 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. + * Serialize the Init object into a byte array which can be read by Init_read */ -bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); /** - * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. + * Read a Init from a byte array, created by Init_write */ -void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read */ -const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); /** - * The channel ID + * Read a OpenChannel from a byte array, created by OpenChannel_write */ -void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); /** - * The HTLC ID + * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); /** - * The HTLC ID + * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write */ -void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); /** - * The failure code + * Serialize the Shutdown object into a byte array which can be read by Shutdown_read */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); /** - * The failure code + * Read a Shutdown from a byte array, created by Shutdown_write */ -void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); /** - * Creates a copy of the UpdateFailMalformedHTLC + * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read */ -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); /** - * Checks if two UpdateFailMalformedHTLCs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write */ -bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); /** - * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. + * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read */ -void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); /** - * The channel ID + * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write */ -const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read */ -void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); /** - * A signature on the commitment transaction + * Read a UpdateFee from a byte array, created by UpdateFee_write */ -struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); /** - * A signature on the commitment transaction + * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); /** - * Signatures on the HTLC transactions - * - * Returns a copy of the field. + * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write */ -struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); /** - * Signatures on the HTLC transactions + * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); /** - * Constructs a new CommitmentSigned given each field + * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write */ -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); /** - * Creates a copy of the CommitmentSigned + * Read a OnionMessage from a byte array, created by OnionMessage_write */ -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); /** - * Checks if two CommitmentSigneds 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. + * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read */ -bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); +struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); /** - * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. + * Serialize the Ping object into a byte array which can be read by Ping_read */ -void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); /** - * The channel ID + * Read a Ping from a byte array, created by Ping_write */ -const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the Pong object into a byte array which can be read by Pong_read */ -void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); /** - * The secret corresponding to the per-commitment point + * Read a Pong from a byte array, created by Pong_write */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); /** - * The secret corresponding to the per-commitment point + * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read */ -void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write */ -struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read */ -void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); /** - * Constructs a new RevokeAndACK given each field + * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write */ -MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); /** - * Creates a copy of the RevokeAndACK + * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read */ -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); /** - * Checks if two RevokeAndACKs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write */ -bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); /** - * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. + * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read */ -void UpdateFee_free(struct LDKUpdateFee this_obj); +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); /** - * The channel ID + * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write */ -const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read */ -void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); /** - * Fee rate per 1000-weight of the transaction + * Read a ErrorMessage from a byte array, created by ErrorMessage_write */ -uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); /** - * Fee rate per 1000-weight of the transaction + * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read */ -void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); /** - * Constructs a new UpdateFee given each field + * Read a WarningMessage from a byte array, created by WarningMessage_write */ -MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); +struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); /** - * Creates a copy of the UpdateFee + * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read */ -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); /** - * Checks if two UpdateFees contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write */ -bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); /** - * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL. + * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read */ -void DataLossProtect_free(struct LDKDataLossProtect this_obj); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write */ -const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write */ -void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); + +/** + * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read + */ +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); /** - * The sender's per-commitment point for their current commitment transaction + * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read */ -struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); /** - * The sender's per-commitment point for their current commitment transaction + * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write */ -void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); /** - * Constructs a new DataLossProtect given each field + * Calculates the overflow safe ending block height for the query. + * + * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. */ -MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg); +MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); /** - * Creates a copy of the DataLossProtect + * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read */ -struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); /** - * Checks if two DataLossProtects contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write */ -bool DataLossProtect_eq(const struct LDKDataLossProtect *NONNULL_PTR a, const struct LDKDataLossProtect *NONNULL_PTR b); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); /** - * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. + * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write */ -void ChannelReestablish_free(struct LDKChannelReestablish this_obj); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read */ -const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); /** - * The channel ID + * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read */ -void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); /** - * The next commitment number for the sender + * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); /** - * The next commitment number for the sender + * Calls the free function if one is set */ -void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); /** - * The next commitment number for the recipient + * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); /** - * The next commitment number for the recipient + * Constructs a new IgnoringMessageHandler given each field */ -void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); /** - * Creates a copy of the ChannelReestablish + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Checks if two ChannelReestablishs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); +struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. + * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is */ -void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); +struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The channel ID + * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is */ -const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; +struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The channel ID + * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is */ -void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The short channel ID + * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is */ -uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The short channel ID + * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is */ -void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * A signature by the node key + * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. */ -struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); /** - * A signature by the node key + * Constructs a new ErroringMessageHandler */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); /** - * A signature by the funding key + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * A signature by the funding key + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * Constructs a new AnnouncementSignatures given each field + * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg); +void MessageHandler_free(struct LDKMessageHandler this_obj); /** - * Creates a copy of the AnnouncementSignatures + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Checks if two AnnouncementSignaturess 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. + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** - * Frees any resources used by the NetAddress + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. + * + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ -void NetAddress_free(struct LDKNetAddress this_ptr); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Creates a copy of the NetAddress + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. + * + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ -struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); /** - * Utility method to constructs a new IPv4-variant NetAddress + * A message handler which handles onion messages. For now, this can only be an + * [`IgnoringMessageHandler`]. */ -struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port); +const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new IPv6-variant NetAddress + * A message handler which handles onion messages. For now, this can only be an + * [`IgnoringMessageHandler`]. */ -struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); +void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); /** - * Utility method to constructs a new OnionV2-variant NetAddress + * Constructs a new MessageHandler given each field */ -struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg); /** - * Utility method to constructs a new OnionV3-variant NetAddress + * Creates a copy of a SocketDescriptor */ -struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** - * Utility method to constructs a new Hostname-variant NetAddress + * Calls the free function if one is set */ -struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); +void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); /** - * Checks if two NetAddresss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. */ -bool NetAddress_eq(const struct LDKNetAddress *NONNULL_PTR a, const struct LDKNetAddress *NONNULL_PTR b); +void PeerHandleError_free(struct LDKPeerHandleError this_obj); /** - * Serialize the NetAddress object into a byte array which can be read by NetAddress_read + * Constructs a new PeerHandleError given each field */ -struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); /** - * Read a NetAddress from a byte array, created by NetAddress_write + * Creates a copy of the PeerHandleError */ -struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); /** - * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. */ -void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); +void PeerManager_free(struct LDKPeerManager this_obj); /** - * The advertised features + * Constructs a new `PeerManager` with the given message handlers. + * + * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be + * cryptographically secure random bytes. + * + * `current_time` is used as an always-increasing counter that survives across restarts and is + * incremented irregularly internally. In general it is best to simply use the current UNIX + * timestamp, however if it is not available a persistent counter that increases once per + * minute should suffice. */ -struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +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); /** - * The advertised features + * Get a list of tuples mapping from node id to network addresses for peers which have + * completed the initial handshake. + * + * 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`]. */ -void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * A strictly monotonic announcement counter, with gaps allowed + * 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 + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. + * + * If an `Err` is returned here you must disconnect the connection immediately. + * + * Returns a small number of bytes to send to the remote node (currently always 50). + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected`]. + * + * [`socket_disconnected`]: PeerManager::socket_disconnected */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); /** - * A strictly monotonic announcement counter, with gaps allowed + * Indicates a new inbound connection has been established to a node with an optional remote + * network address. + * + * The remote network address adds the option to report a remote IP address back to a connecting + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. + * + * May refuse the connection by returning an Err, but will never write bytes to the remote end + * (outbound connector always speaks first). If an `Err` is returned here you must disconnect + * the connection immediately. + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected`]. + * + * [`socket_disconnected`]: PeerManager::socket_disconnected */ -void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back - * to this node). + * Indicates that there is room to write data to the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before + * returning. Thus, be very careful with reentrancy issues! The invariants around calling + * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be + * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't + * sufficient! + * + * [`send_data`]: SocketDescriptor::send_data + * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail */ -struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * The node_id this announcement originated from (don't rebroadcast the node_announcement back - * to this node). + * Indicates that data was read from the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. + * Thus, however, you should call [`process_events`] after any `read_event` to generate + * [`send_data`] calls to handle responses. + * + * If `Ok(true)` is returned, further read_events should not be triggered until a + * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the + * send buffer). + * + * 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 */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** - * An RGB color for UI purposes + * Checks for any events generated by our handlers and processes them. Includes sending most + * response messages as well as messages generated by calls to handler functions directly (eg + * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). + * + * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * You don't have to call this function explicitly if you are using [`lightning-net-tokio`] + * or one of the other clients provided in our language bindings. + * + * Note that if there are any other calls to this function waiting on lock(s) this may return + * without doing any work. All available events that need handling will be handled before the + * other calls return. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards + * [`send_data`]: SocketDescriptor::send_data */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * An RGB color for UI purposes + * Indicates that the given socket descriptor's connection is now closed. */ -void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * Disconnect a peer given its node id. + * + * 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 */ -const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32]; +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * An alias, for UI purposes. This should be sanitized before use. There is no guarantee - * of uniqueness. + * Disconnects all currently-connected peers. This is useful on platforms where there may be + * an indication that TCP sockets have stalled even if we weren't around to time them out + * using regular ping/pongs. */ -void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * List of addresses on which this node is reachable + * Send pings to each peer and disconnect those which did not respond to the last round of + * pings. * - * Returns a copy of the field. + * This may be called on any timescale you want, however, roughly once every ten seconds is + * preferred. The call rate determines both how often we send a ping to our peers and how much + * time they have to respond before we disconnect them. + * + * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * [`send_data`]: SocketDescriptor::send_data */ -struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * List of addresses on which this node is reachable + * Generates a signed node_announcement from the given arguments, sending it to all connected + * peers. Note that peers will likely ignore this message unless we have at least one public + * channel which has at least six confirmations on-chain. + * + * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this + * node to humans. They carry no in-protocol meaning. + * + * `addresses` represent the set (possibly empty) of socket addresses on which this node + * accepts incoming connections. These will be included in the node_announcement, publicly + * tying these addresses together and to this node. If you wish to preserve user privacy, + * addresses should likely contain only Tor Onion addresses. + * + * Panics if `addresses` is absurdly large (more than 100). + * + * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); /** - * Creates a copy of the UnsignedNodeAnnouncement + * Gets the weight for an HTLC-Success transaction. */ -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); +uint64_t htlc_success_tx_weight(bool opt_anchors); /** - * Checks if two UnsignedNodeAnnouncements 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. + * Gets the weight for an HTLC-Timeout transaction. */ -bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); +uint64_t htlc_timeout_tx_weight(bool opt_anchors); /** - * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. + * Creates a copy of the HTLCClaim */ -void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); +enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); /** - * The signature by the node key + * Utility method to constructs a new OfferedTimeout-variant HTLCClaim */ -struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_offered_timeout(void); /** - * The signature by the node key + * Utility method to constructs a new OfferedPreimage-variant HTLCClaim */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +enum LDKHTLCClaim HTLCClaim_offered_preimage(void); /** - * The actual content of the announcement + * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim */ -struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); /** - * The actual content of the announcement + * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim */ -void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); +enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); /** - * Constructs a new NodeAnnouncement given each field + * Utility method to constructs a new Revocation-variant HTLCClaim */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +enum LDKHTLCClaim HTLCClaim_revocation(void); /** - * Creates a copy of the NodeAnnouncement + * Checks if two HTLCClaims contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); /** - * Checks if two NodeAnnouncements 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. + * Check if a given input witness attempts to claim a HTLC. */ -bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b); +MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); /** - * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Build the commitment secret from the seed and the commitment number */ -void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); +struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); /** - * The advertised channel features + * Build a closing transaction */ -struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * The advertised channel features + * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. */ -void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); /** - * The genesis hash of the blockchain where the channel is to be opened + * Creates a copy of the CounterpartyCommitmentSecrets */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; +struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); /** - * The genesis hash of the blockchain where the channel is to be opened + * Creates a new empty `CounterpartyCommitmentSecrets` structure. */ -void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); /** - * The short channel ID + * Returns the minimum index of all stored secrets. Note that indexes start + * at 1 << 48 and get decremented by one for each new secret. */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); /** - * The short channel ID + * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret + * was generated in accordance with BOLT 3 and is consistent with previous secrets. */ -void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); /** - * One of the two node_ids which are endpoints of this channel + * Returns the secret at `idx`. + * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); /** - * One of the two node_ids which are endpoints of this channel + * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); /** - * The other of the two node_ids which are endpoints of this channel + * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); /** - * The other of the two node_ids which are endpoints of this channel + * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) + * from the base secret and the per_commitment_point. */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** - * The funding key for the first node + * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) + * from the base point and the per_commitment_key. This is the public equivalent of + * derive_private_key - using only public keys to derive a public key instead of private keys. */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); /** - * The funding key for the first node + * Derives a per-commitment-transaction revocation key from its constituent parts. + * + * Only the cheating participant owns a valid witness to propagate a revoked + * commitment transaction, thus per_commitment_secret always come from cheater + * and revocation_base_secret always come from punisher, which is the broadcaster + * of the transaction spending with this key knowledge. */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** - * The funding key for the second node + * Derives a per-commitment-transaction revocation public key from its constituent parts. This is + * the public equivalend of derive_private_revocation_key - using only public keys to derive a + * public key instead of private keys. + * + * Only the cheating participant owns a valid witness to propagate a revoked + * commitment transaction, thus per_commitment_point always come from cheater + * and revocation_base_point always come from punisher, which is the broadcaster + * of the transaction spending with this key knowledge. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). */ -struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); /** - * The funding key for the second node + * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); /** - * Creates a copy of the UnsignedChannelAnnouncement + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Checks if two UnsignedChannelAnnouncements 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. + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); +struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Authentication of the announcement by the first public node + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Authentication of the announcement by the first public node + * Broadcaster's HTLC Key */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Authentication of the announcement by the second public node + * Broadcaster's HTLC Key */ -struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Authentication of the announcement by the second public node + * Countersignatory's HTLC Key */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Proof of funding UTXO ownership by the first public node + * Countersignatory's HTLC Key */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Proof of funding UTXO ownership by the first public node + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Proof of funding UTXO ownership by the second public node + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Proof of funding UTXO ownership by the second public node + * Constructs a new TxCreationKeys given each field */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg); /** - * The actual announcement + * Checks if two TxCreationKeyss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); /** - * The actual announcement + * Creates a copy of the TxCreationKeys */ -void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); /** - * Constructs a new ChannelAnnouncement given each field + * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read */ -MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); /** - * Creates a copy of the ChannelAnnouncement + * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write */ -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); /** - * Checks if two ChannelAnnouncements 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. + * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. */ -bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); +void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); /** - * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. */ -void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The genesis hash of the blockchain where the channel is to be opened + * The base point which is used (with derive_public_revocation_key) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The short channel ID + * The base point which is used (with derive_public_revocation_key) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The short channel ID + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Channel flags + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Channel flags + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); +struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines - * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a - * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10, - * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * Constructs a new ChannelPublicKeys given each field */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Creates a copy of the ChannelPublicKeys */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Checks if two ChannelPublicKeyss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read */ -uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write */ -void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); /** - * The base HTLC fee charged by sender, in milli-satoshi + * 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. */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +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); /** - * The base HTLC fee charged by sender, in milli-satoshi + * 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. */ -void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +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); /** - * The amount to fee multiplier, in micro-satoshi + * A script either spendable by the revocation + * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. + * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); /** - * The amount to fee multiplier, in micro-satoshi + * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); /** - * 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 - * - * Returns a copy of the field. + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. This is stored to ensure forward-compatibility as new fields are added to the - * lightning gossip + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new UnsignedChannelUpdate given each field + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Creates a copy of the UnsignedChannelUpdate + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two UnsignedChannelUpdates 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. + * The CLTV lock-time at which this HTLC expires. */ -bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. + * The CLTV lock-time at which this HTLC expires. */ -void ChannelUpdate_free(struct LDKChannelUpdate this_obj); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** - * A signature of the channel update + * The hash of the preimage which unlocks this HTLC. */ -struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** - * A signature of the channel update + * The hash of the preimage which unlocks this HTLC. */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The actual channel update + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * The actual channel update + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); +void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Constructs a new ChannelUpdate given each field + * Constructs a new HTLCOutputInCommitment given each field */ -MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); /** - * Creates a copy of the ChannelUpdate + * Creates a copy of the HTLCOutputInCommitment */ -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); /** - * Checks if two ChannelUpdates contain equal inner contents. + * Checks if two HTLCOutputInCommitments 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 ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); +bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); /** - * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. + * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read */ -void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); /** - * The genesis hash of the blockchain being queried + * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write */ -const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); /** - * The genesis hash of the blockchain being queried + * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc + * does not need to have its previous_output_index filled. */ -void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** - * The height of the first block for the channel UTXOs being queried + * Gets the redeemscript for a funding output from the two funding public keys. + * Note that the order of funding public keys does not matter. */ -uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** - * The height of the first block for the channel UTXOs being queried + * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC + * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the + * transaction which needs signing, and can be used to construct an HTLC transaction which is + * broadcastable given a counterparty HTLC signature. + * + * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the + * commitment transaction). */ -void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +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); /** - * The number of blocks to include in the query results + * 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 */ -uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors); /** - * The number of blocks to include in the query results + * Gets the witnessScript for the to_remote output when anchors are enabled. */ -void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); /** - * Constructs a new QueryChannelRange given each field + * Gets the witnessScript for an anchor output from the funding public key. + * The witness in the spending input must be: + * + * After 16 blocks of confirmation, an alternative satisfying witness could be: + * <> + * (empty vector required to satisfy compliance with MINIMALIF-standard rule) */ -MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); +struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** - * Creates a copy of the QueryChannelRange + * Returns the witness required to satisfy and spend an anchor input. */ -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig); /** - * Checks if two QueryChannelRanges 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. + * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); +void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); /** - * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. + * Holder public keys */ -void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain being queried + * Holder public keys */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * The genesis hash of the blockchain being queried + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The height of the first block in the range of the reply + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * The height of the first block in the range of the reply + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The number of blocks included in the range of the reply + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); /** - * The number of blocks included in the range of the reply + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * True when this is the final reply for a query + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); /** - * True when this is the final reply for a query + * The late-bound funding outpoint + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The short_channel_ids in the channel range + * The late-bound funding outpoint * - * Returns a copy of the field. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The short_channel_ids in the channel range + * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is + * serialization backwards-compatible. */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Constructs a new ReplyChannelRange given each field + * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is + * serialization backwards-compatible. */ -MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); +void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Creates a copy of the ReplyChannelRange + * 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. */ -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Checks if two ReplyChannelRanges 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. + * 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. */ -bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); +void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. + * Constructs a new ChannelTransactionParameters given each field */ -void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg, enum LDKCOption_NoneZ opt_non_zero_fee_anchors_arg); /** - * The genesis hash of the blockchain being queried + * Creates a copy of the ChannelTransactionParameters */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); /** - * The genesis hash of the blockchain being queried + * Checks if two ChannelTransactionParameterss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b); /** - * The short_channel_ids that are being queried - * - * Returns a copy of the field. + * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); /** - * The short_channel_ids that are being queried + * Counter-party public keys */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Constructs a new QueryShortChannelIds given each field + * Counter-party public keys */ -MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Creates a copy of the QueryShortChannelIds + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Checks if two QueryShortChannelIdss 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. + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. + * Constructs a new CounterpartyChannelTransactionParameters given each field */ -void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); +MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); /** - * The genesis hash of the blockchain that was queried + * Creates a copy of the CounterpartyChannelTransactionParameters */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); /** - * The genesis hash of the blockchain that was queried + * Checks if two CounterpartyChannelTransactionParameterss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * Whether the late bound parameters are populated. */ -bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the chain_hash + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the holder is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Constructs a new ReplyShortChannelIdsEnd given each field + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the counterparty is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Creates a copy of the ReplyShortChannelIdsEnd + * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read */ -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); /** - * Checks if two ReplyShortChannelIdsEnds contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write */ -bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); /** - * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. + * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read */ -void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); /** - * The genesis hash of the blockchain for channel and node information + * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); /** - * The genesis hash of the blockchain for channel and node information + * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); /** - * The starting unix timestamp + * Get the channel pubkeys for the broadcaster */ -uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The starting unix timestamp + * Get the channel pubkeys for the countersignatory */ -void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The range of information in seconds + * Get the contest delay applicable to the transactions. + * Note that the contest delay was selected by the countersignatory. */ -uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The range of information in seconds + * Whether the channel is outbound from the broadcaster. + * + * The boolean representing the side that initiated the channel is + * an input to the commitment number obscure factor computation. */ -void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Constructs a new GossipTimestampFilter given each field + * The funding outpoint */ -MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Creates a copy of the GossipTimestampFilter + * Whether to use anchors for this channel */ -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Checks if two GossipTimestampFilters 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. + * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); +void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); /** - * Frees any resources used by the ErrorAction + * Our counterparty's signature for the transaction */ -void ErrorAction_free(struct LDKErrorAction this_ptr); +struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Creates a copy of the ErrorAction + * Our counterparty's signature for the transaction */ -struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); /** - * Utility method to constructs a new DisconnectPeer-variant ErrorAction + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * + * Returns a copy of the field. */ -struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); +struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new IgnoreError-variant ErrorAction + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -struct LDKErrorAction ErrorAction_ignore_error(void); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); /** - * Utility method to constructs a new IgnoreAndLog-variant ErrorAction + * Creates a copy of the HolderCommitmentTransaction */ -struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); /** - * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction + * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read */ -struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); /** - * Utility method to constructs a new SendErrorMessage-variant ErrorAction + * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write */ -struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SendWarningMessage-variant ErrorAction + * Create a new holder transaction with the given counterparty signatures. + * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ -struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); /** - * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. + * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void LightningError_free(struct LDKLightningError this_obj); +void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); /** - * A human-readable message describing the error + * The commitment transaction */ -struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** - * A human-readable message describing the error + * The commitment transaction */ -void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** - * The action which should be taken against the offending peer. + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; /** - * The action which should be taken against the offending peer. + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new LightningError given each field + * Constructs a new BuiltCommitmentTransaction given each field */ -MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); +MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); /** - * Creates a copy of the LightningError + * Creates a copy of the BuiltCommitmentTransaction */ -struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); /** - * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. + * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read */ -void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); /** - * update_add_htlc messages which should be sent + * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write */ -struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** - * update_add_htlc messages which should be sent + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * update_fulfill_htlc messages which should be sent + * Signs the counterparty's commitment transaction. */ -struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * update_fulfill_htlc messages which should be sent + * Signs the holder commitment transaction because we are about to broadcast it. */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); +MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); + +/** + * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. + */ +void ClosingTransaction_free(struct LDKClosingTransaction this_obj); /** - * update_fail_htlc messages which should be sent + * Creates a copy of the ClosingTransaction */ -struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); /** - * update_fail_htlc messages which should be sent + * Generates a non-cryptographic 64-bit hash of the ClosingTransaction. */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); +uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); /** - * update_fail_malformed_htlc messages which should be sent + * Checks if two ClosingTransactions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); /** - * update_fail_malformed_htlc messages which should be sent + * Construct an object of the class */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); +MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * An update_fee message which should be sent + * Trust our pre-built transaction. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Applies a wrapper which allows access to the transaction. + * + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * An update_fee message which should be sent + * Verify our pre-built transaction. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Applies a wrapper which allows access to the transaction. + * + * An external validating signer must call this method before signing + * or using the built transaction. */ -void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); +MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); /** - * Finally, the commitment_signed message which should be sent + * The value to be sent to the holder, or zero if the output will be omitted */ -struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Finally, the commitment_signed message which should be sent + * The value to be sent to the counterparty, or zero if the output will be omitted */ -void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); +MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Constructs a new CommitmentUpdate given each field + * The destination of the holder's output */ -MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Creates a copy of the CommitmentUpdate + * The destination of the counterparty's output */ -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Checks if two CommitmentUpdates 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. + * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. */ -bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); +void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); /** - * Calls the free function if one is set + * The pre-built Bitcoin commitment transaction */ -void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); +MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Calls the free function if one is set + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. */ -void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); +MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read + * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); +void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); /** - * Read a AcceptChannel from a byte array, created by AcceptChannel_write + * Creates a copy of the CommitmentTransaction */ -struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); /** - * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read + * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read */ -struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); /** - * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write + * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); /** - * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read + * The backwards-counting commitment number */ -struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write + * The value to be sent to the broadcaster */ -struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read + * The value to be sent to the counterparty */ -struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Read a ClosingSigned from a byte array, created by ClosingSigned_write + * The feerate paid per 1000-weight-unit in this commitment transaction. */ -struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); +MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read + * Trust our pre-built transaction and derived transaction creation public keys. + * + * Applies a wrapper which allows access to these fields. + * + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write + * Verify our pre-built transaction and derived transaction creation public keys. + * + * Applies a wrapper which allows access to these fields. + * + * An external validating signer must call this method before signing + * or using the built transaction. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** - * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read + * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); +void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); /** - * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write + * The transaction ID of the built Bitcoin transaction */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read + * The pre-built Bitcoin commitment transaction */ -struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Read a FundingCreated from a byte array, created by FundingCreated_write + * The pre-calculated transaction creation public keys. */ -struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read + * Should anchors be used. */ -struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); +MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Read a FundingSigned from a byte array, created by FundingSigned_write + * Get a signature for each HTLC which was included in the commitment transaction (ie for + * which HTLCOutputInCommitment::transaction_output_index.is_some()). + * + * The returned Vec has one entry for each HTLC, and in the same order. + * + * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ -struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read + * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a + * shared secret first. This prevents on-chain observers from discovering how many commitment + * transactions occurred in a channel before it was closed. + * + * This function gets the shared secret from relevant channel public keys and can be used to + * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. */ -struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); +uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); /** - * Read a ChannelReady from a byte array, created by ChannelReady_write + * Checks if two InitFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); +bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); /** - * Serialize the Init object into a byte array which can be read by Init_read + * Checks if two NodeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); +bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); /** - * Read a Init from a byte array, created by Init_write + * 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. */ -struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); +bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); /** - * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read + * Checks if two InvoiceFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); +bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); /** - * Read a OpenChannel from a byte array, created by OpenChannel_write + * 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. */ -struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); +bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); /** - * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read + * 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. */ -struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); +bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); /** - * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write + * 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. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); +bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); /** - * Serialize the Shutdown object into a byte array which can be read by Shutdown_read + * 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. */ -struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); +bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); /** - * Read a Shutdown from a byte array, created by Shutdown_write + * Checks if two ChannelTypeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); +bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); /** - * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read + * Creates a copy of the InitFeatures */ -struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); +struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); /** - * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write + * Creates a copy of the NodeFeatures */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); +struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); /** - * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read + * Creates a copy of the ChannelFeatures */ -struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); +struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); /** - * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write + * Creates a copy of the InvoiceFeatures */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); +struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); /** - * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read + * Creates a copy of the OfferFeatures */ -struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); +struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); /** - * Read a UpdateFee from a byte array, created by UpdateFee_write + * Creates a copy of the InvoiceRequestFeatures */ -struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); +struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); /** - * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read + * Creates a copy of the Bolt12InvoiceFeatures */ -struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); +struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); /** - * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write + * Creates a copy of the BlindedHopFeatures */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); +struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); /** - * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read + * Creates a copy of the ChannelTypeFeatures */ -struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); +struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); /** - * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write + * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); +void InitFeatures_free(struct LDKInitFeatures this_obj); /** - * Read a OnionMessage from a byte array, created by OnionMessage_write + * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); +void NodeFeatures_free(struct LDKNodeFeatures this_obj); /** - * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read + * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); +void ChannelFeatures_free(struct LDKChannelFeatures this_obj); /** - * Serialize the Ping object into a byte array which can be read by Ping_read + * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); +void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); /** - * Read a Ping from a byte array, created by Ping_write + * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); +void OfferFeatures_free(struct LDKOfferFeatures this_obj); /** - * Serialize the Pong object into a byte array which can be read by Pong_read + * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); +void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); /** - * Read a Pong from a byte array, created by Pong_write + * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); +void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); /** - * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read + * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); +void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); /** - * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write + * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); /** - * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); +MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); /** - * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); /** - * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); /** - * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); +MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); /** - * Read a ErrorMessage from a byte array, created by ErrorMessage_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); +MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); +MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); /** - * Read a WarningMessage from a byte array, created by WarningMessage_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); +MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); /** - * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); /** - * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write + * Create a blank Features with no features set */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); /** - * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read + * Create a blank Features with no features set */ -struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); /** - * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - *\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 + * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read */ -MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); /** - * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read + * Read a InitFeatures from a byte array, created by InitFeatures_write */ -struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); /** - * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write + * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); /** - * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); /** - * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read */ -struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); /** - * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + * Read a NodeFeatures from a byte array, created by NodeFeatures_write */ -struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); /** - * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write + * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); +struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); /** - * Calls the free function if one is set + * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write */ -void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); /** - * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read */ -void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); +struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); /** - * Constructs a new IgnoringMessageHandler given each field + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write */ -MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); /** - * 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 + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ -struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); /** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write */ -struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); /** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is + * Set this feature as optional. */ -struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is + * Set this feature as required. */ -struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is + * Checks if this feature is supported. */ -struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is + * Set this feature as optional. */ -struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is + * Set this feature as required. */ -struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); +MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ErroringMessageHandler + * Checks if this feature is required. */ -MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); +MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *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 + * Checks if this feature is required. */ -struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *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 + * Set this feature as optional. */ -struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void MessageHandler_free(struct LDKMessageHandler this_obj); +void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Checks if this feature is supported. */ -const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Set this feature as optional. */ -void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); +void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. - * - * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync + * Set this feature as required. */ -const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. - * - * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync + * Checks if this feature is supported. */ -void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); +MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles onion messages. For now, this can only be an - * [`IgnoringMessageHandler`]. + * Set this feature as optional. */ -const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * A message handler which handles onion messages. For now, this can only be an - * [`IgnoringMessageHandler`]. + * Set this feature as required. */ -void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); +void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new MessageHandler given each field + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg); +MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of a SocketDescriptor + * Checks if this feature is required. */ -struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Checks if this feature is required. */ -void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); +MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void PeerHandleError_free(struct LDKPeerHandleError this_obj); +void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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 + * Set this feature as required. */ -bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); +void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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 + * Checks if this feature is supported. */ -void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new PeerHandleError given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg); +void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PeerHandleError + * Set this feature as required. */ -struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); +void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void PeerManager_free(struct LDKPeerManager this_obj); - -/** - * Constructs a new PeerManager with the given message handlers and node_id secret key - * ephemeral_random_data is used to derive per-connection ephemeral keys and must be - * cryptographically secure random bytes. - * - * `current_time` is used as an always-increasing counter that survives across restarts and is - * incremented irregularly internally. In general it is best to simply use the current UNIX - * timestamp, however if it is not available a persistent counter that increases once per - * minute should suffice. +MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. */ -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 bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the list of node ids for peers which have completed the initial handshake. - * - * For outbound connections, this will be the same as the their_node_id parameter passed in to - * new_outbound_connection, however entries will only appear once the initial handshake has - * completed and we are sure the remote peer has the private key for the given node_id. + * Checks if this feature is required. */ -MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * 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 - * peer using the init message. - * The user should pass the remote network address of the host they are connected to. - * - * If an `Err` is returned here you must disconnect the connection immediately. - * - * Returns a small number of bytes to send to the remote node (currently always 50). - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected()`]. - * - * [`socket_disconnected()`]: PeerManager::socket_disconnected + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); +void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Indicates a new inbound connection has been established to a node with an optional remote - * network address. - * - * The remote network address adds the option to report a remote IP address back to a connecting - * peer using the init message. - * The user should pass the remote network address of the host they are connected to. - * - * May refuse the connection by returning an Err, but will never write bytes to the remote end - * (outbound connector always speaks first). If an `Err` is returned here you must disconnect - * the connection immediately. - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected()`]. - * - * [`socket_disconnected()`]: PeerManager::socket_disconnected + * Set this feature as required. */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); +void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Indicates that there is room to write data to the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. - * - * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before - * returning. Thus, be very careful with reentrancy issues! The invariants around calling - * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be - * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't - * sufficient! - * - * [`send_data`]: SocketDescriptor::send_data - * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Indicates that data was read from the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. - * - * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. - * Thus, however, you should call [`process_events`] after any `read_event` to generate - * [`send_data`] calls to handle responses. - * - * If `Ok(true)` is returned, further read_events should not be triggered until a - * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the - * send buffer). - * - * [`send_data`]: SocketDescriptor::send_data - * [`process_events`]: PeerManager::process_events + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); +void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks for any events generated by our handlers and processes them. Includes sending most - * response messages as well as messages generated by calls to handler functions directly (eg - * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). - * - * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! - * - * You don't have to call this function explicitly if you are using [`lightning-net-tokio`] - * or one of the other clients provided in our language bindings. - * - * Note that if there are any other calls to this function waiting on lock(s) this may return - * without doing any work. All available events that need handling will be handled before the - * other calls return. - * - * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - * [`send_data`]: SocketDescriptor::send_data + * Set this feature as required. */ -void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); +void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Indicates that the given socket descriptor's connection is now closed. + * Checks if this feature is supported. */ -void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Disconnect a peer given its node id. - * - * Set `no_connection_possible` to true to prevent any further connection with this peer, - * force-closing any channels we have with it. - * - * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the - * peer. Thus, be very careful about reentrancy issues. - * - * [`disconnect_socket`]: SocketDescriptor::disconnect_socket + * Set this feature as optional. */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible); +void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Disconnects all currently-connected peers. This is useful on platforms where there may be - * an indication that TCP sockets have stalled even if we weren't around to time them out - * using regular ping/pongs. + * Set this feature as required. */ -void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); +void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Send pings to each peer and disconnect those which did not respond to the last round of - * pings. - * - * This may be called on any timescale you want, however, roughly once every ten seconds is - * preferred. The call rate determines both how often we send a ping to our peers and how much - * time they have to respond before we disconnect them. - * - * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! - * - * [`send_data`]: SocketDescriptor::send_data + * Checks if this feature is supported. */ -void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a signed node_announcement from the given arguments, sending it to all connected - * peers. Note that peers will likely ignore this message unless we have at least one public - * channel which has at least six confirmations on-chain. - * - * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this - * node to humans. They carry no in-protocol meaning. - * - * `addresses` represent the set (possibly empty) of socket addresses on which this node - * accepts incoming connections. These will be included in the node_announcement, publicly - * tying these addresses together and to this node. If you wish to preserve user privacy, - * addresses should likely contain only Tor Onion addresses. - * - * Panics if `addresses` is absurdly large (more than 100). - * - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events + * Checks if this feature is required. */ -void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Gets the weight for an HTLC-Success transaction. + * Checks if this feature is required. */ -uint64_t htlc_success_tx_weight(bool opt_anchors); +MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Gets the weight for an HTLC-Timeout transaction. + * Checks if this feature is required. */ -uint64_t htlc_timeout_tx_weight(bool opt_anchors); +MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCClaim + * Set this feature as optional. */ -enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); +void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OfferedTimeout-variant HTLCClaim + * Set this feature as required. */ -enum LDKHTLCClaim HTLCClaim_offered_timeout(void); +void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OfferedPreimage-variant HTLCClaim + * Checks if this feature is supported. */ -enum LDKHTLCClaim HTLCClaim_offered_preimage(void); +MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim + * Set this feature as optional. */ -enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); +void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim + * Set this feature as required. */ -enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); +void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Revocation-variant HTLCClaim + * Checks if this feature is supported. */ -enum LDKHTLCClaim HTLCClaim_revocation(void); +MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two HTLCClaims contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); +void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Check if a given input witness attempts to claim a HTLC. + * Set this feature as required. */ -MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); +void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Build the commitment secret from the seed and the commitment number + * Checks if this feature is supported. */ -struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); +MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Build a closing transaction + * Checks if this feature is required. */ -struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); +MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); +MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the CounterpartyCommitmentSecrets + * Checks if this feature is required. */ -struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); +MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a new empty `CounterpartyCommitmentSecrets` structure. + * Set this feature as optional. */ -MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); +void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the minimum index of all stored secrets. Note that indexes start - * at 1 << 48 and get decremented by one for each new secret. + * Set this feature as required. */ -MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); +void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret - * was generated in accordance with BOLT 3 and is consistent with previous secrets. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); +MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the secret at `idx`. - * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as optional. */ -MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); +void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read + * Set this feature as required. */ -struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); +void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write + * Checks if this feature is supported. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) - * from the base secret and the per_commitment_point. + * Set this feature as optional. */ -struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * 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. + * Set this feature as required. */ -struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Derives a per-commitment-transaction revocation key from its constituent parts. - * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_secret always come from cheater - * and revocation_base_secret always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. + * Checks if this feature is supported. */ -struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Derives a per-commitment-transaction revocation public key from its constituent parts. This is - * the public equivalend of derive_private_revocation_key - using only public keys to derive a - * public key instead of private keys. - * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_point always come from cheater - * and revocation_base_point always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * Checks if this feature is required. */ -struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); +MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * Checks if this feature is required. */ -struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * Set this feature as optional. */ -void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Set this feature as required. */ -struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Checks if this feature is supported. */ -void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Broadcaster's HTLC Key + * Set this feature as optional. */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Broadcaster's HTLC Key + * Set this feature as required. */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Countersignatory's HTLC Key + * Checks if this feature is supported. */ -struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Countersignatory's HTLC Key + * Set this feature as optional. */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Set this feature as required. */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Checks if this feature is supported. */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new TxCreationKeys given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg); +void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two TxCreationKeyss 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. + * Set this feature as required. */ -bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); +void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the TxCreationKeys + * Checks if this feature is supported. */ -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); +MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write + * Checks if this feature is required. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); +MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * Checks if this feature is required. */ -struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * Set this feature as optional. */ -void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_revocation_key) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Set this feature as required. */ -struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_revocation_key) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Checks if this feature is supported. */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Set this feature as optional. */ -struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Set this feature as required. */ -void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Checks if this feature is supported. */ -struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Checks if this feature is required. */ -void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Checks if this feature is required. */ -struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Set this feature as optional. */ -void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ChannelPublicKeys given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); +void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelPublicKeys + * Checks if this feature is supported. */ -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two ChannelPublicKeyss 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. + * Set this feature as optional. */ -bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read + * Set this feature as required. */ -struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write + * Checks if this feature is supported. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * 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. + * Set this feature as optional. */ -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); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * 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. + * Set this feature as required. */ -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); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * A script either spendable by the revocation - * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. - * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. + * Checks if this feature is supported. */ -struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); +MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Checks if this feature is required. */ -bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Checks if this feature is required. */ -void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Set this feature as optional. */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Set this feature as required. */ -void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); +void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The CLTV lock-time at which this HTLC expires. + * Checks if this feature is supported. */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The CLTV lock-time at which this HTLC expires. + * Set this feature as optional. */ -void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); +void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The hash of the preimage which unlocks this HTLC. + * Set this feature as required. */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; +void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The hash of the preimage which unlocks this HTLC. + * Checks if this feature is supported. */ -void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * Checks if this feature is required. */ -struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * Checks if this feature is required. */ -void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new HTLCOutputInCommitment given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); +void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCOutputInCommitment + * Set this feature as required. */ -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); +void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two HTLCOutputInCommitments 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. + * Checks if this feature is supported. */ -bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); +MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read + * Set this feature as optional. */ -struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); +void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write + * Set this feature as required. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); +void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc - * does not need to have its previous_output_index filled. + * Checks if this feature is supported. */ -struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); +MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Gets the redeemscript for a funding output from the two funding public keys. - * Note that the order of funding public keys does not matter. + * Checks if this feature is required. */ -struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); +MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC - * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the - * transaction which needs signing, and can be used to construct an HTLC transaction which is - * broadcastable given a counterparty HTLC signature. - * - * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the - * commitment transaction). + * Checks if this feature is required. */ -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); +MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * 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 + * Set this feature as optional. */ -struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors); +void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Gets the witnessScript for the to_remote output when anchors are enabled. + * Set this feature as required. */ -struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); +void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Gets the witnessScript for an anchor output from the funding public key. - * The witness in the spending input must be: - * - * After 16 blocks of confirmation, an alternative satisfying witness could be: - * <> - * (empty vector required to satisfy compliance with MINIMALIF-standard rule) + * Checks if this feature is supported. */ -struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); +MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the witness required to satisfy and spend an anchor input. + * Set this feature as optional. */ -struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig); +void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); +void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Holder public keys + * Checks if this feature is supported. */ -struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Holder public keys + * Checks if this feature is required. */ -void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Checks if this feature is required. */ -uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Set this feature as optional. */ -void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Set this feature as required. */ -bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Checks if this feature is supported. */ -void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as optional. */ -struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as required. */ -void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); +void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The late-bound funding outpoint - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if this feature is supported. */ -struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The late-bound funding outpoint - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as optional. */ -void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is - * serialization backwards-compatible. + * Set this feature as required. */ -enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Are anchors (zero fee HTLC transaction variant) used for this channel. Boolean is - * serialization backwards-compatible. + * Checks if this feature is supported. */ -void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * 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. + * Checks if this feature is required. */ -enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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. + * Checks if this feature is required. */ -void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ChannelTransactionParameters given each field + * Checks if this feature is required. */ -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); +MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelTransactionParameters + * Set this feature as optional. */ -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +void InvoiceFeatures_set_payment_metadata_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); +void InvoiceFeatures_set_payment_metadata_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Counter-party public keys + * Checks if this feature is supported. */ -struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool InvoiceFeatures_supports_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * Counter-party public keys + * Checks if this feature is required. */ -void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +MUST_USE_RES bool InvoiceFeatures_requires_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Set this feature as optional. */ -uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Set this feature as required. */ -void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new CounterpartyChannelTransactionParameters given each field + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); +MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the CounterpartyChannelTransactionParameters + * Set this feature as optional. */ -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Whether the late bound parameters are populated. + * Set this feature as required. */ -MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the holder is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the counterparty is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * Set this feature as optional. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read + * Set this feature as required. */ -struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); +void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write + * Checks if this feature is supported. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); +MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); +MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write + * Checks if this feature is required. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); +MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Get the channel pubkeys for the broadcaster + * Set this feature as optional. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the channel pubkeys for the countersignatory + * Set this feature as required. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the contest delay applicable to the transactions. - * Note that the contest delay was selected by the countersignatory. + * Checks if this feature is supported. */ -MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Whether the channel is outbound from the broadcaster. - * - * The boolean representing the side that initiated the channel is - * an input to the commitment number obscure factor computation. + * Checks if this feature is required. */ -MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The funding outpoint + * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void ShutdownScript_free(struct LDKShutdownScript this_obj); /** - * Whether to use anchors for this channel + * Creates a copy of the ShutdownScript */ -MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); /** - * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Checks if two ShutdownScripts contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); +bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); /** - * Our counterparty's signature for the transaction + * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. */ -struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); /** - * Our counterparty's signature for the transaction + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); +struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * The script that did not meet the requirements from [BOLT #2]. * - * Returns a copy of the field. + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * Constructs a new InvalidShutdownScript given each field */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val); +MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); /** - * Creates a copy of the HolderCommitmentTransaction + * Creates a copy of the InvalidShutdownScript */ -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); +struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); /** - * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read + * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read */ -struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); +struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); /** - * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write + * Read a ShutdownScript from a byte array, created by ShutdownScript_write */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); /** - * Create a new holder transaction with the given counterparty signatures. - * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. + * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. */ -MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); /** - * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Generates a P2WSH script pubkey from the given [`WScriptHash`]. */ -void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); /** - * The commitment transaction + * Generates a witness script pubkey from the given segwit version and program. + * + * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or + * [`ShutdownScript::new_p2wsh`] instead. + * + * # Errors + * + * This function may return an error if `program` is invalid for the segwit `version`. */ -struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program); /** - * The commitment transaction + * Converts the shutdown script into the underlying [`Script`]. */ -void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); +MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); /** - * The txid for the commitment transaction. + * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); /** - * The txid for the commitment transaction. + * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. */ -void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); /** - * Constructs a new BuiltCommitmentTransaction given each field + * Frees any resources used by the Retry */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); +void Retry_free(struct LDKRetry this_ptr); /** - * Creates a copy of the BuiltCommitmentTransaction + * Creates a copy of the Retry */ -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); +struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** - * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read + * Utility method to constructs a new Attempts-variant Retry */ -struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); +struct LDKRetry Retry_attempts(uintptr_t a); /** - * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write + * Utility method to constructs a new Timeout-variant Retry */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKRetry Retry_timeout(uint64_t a); /** - * Get the SIGHASH_ALL sighash value of the transaction. - * - * This can be used to verify a signature. + * Checks if two Retrys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); /** - * Sign a transaction, either because we are counter-signing the counterparty's transaction or - * because we are about to broadcast a holder transaction. + * Generates a non-cryptographic 64-bit hash of the Retry. */ -MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); /** - * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. + * Creates a copy of the RetryableSendFailure */ -void ClosingTransaction_free(struct LDKClosingTransaction this_obj); +enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); /** - * Creates a copy of the ClosingTransaction + * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure */ -struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); +enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); /** - * Checks if two ClosingTransactions contain equal inner contents. + * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure */ -uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); +enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); /** - * Checks if two ClosingTransactions 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. + * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure */ -bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); +enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); /** - * Construct an object of the class + * Frees any resources used by the PaymentSendFailure */ -MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); +void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); /** - * Trust our pre-built transaction. - * - * Applies a wrapper which allows access to the transaction. - * - * This should only be used if you fully trust the builder of this object. It should not - * be used by an external signer - instead use the verify function. + * Creates a copy of the PaymentSendFailure */ -MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); /** - * Verify our pre-built transaction. - * - * Applies a wrapper which allows access to the transaction. - * - * An external validating signer must call this method before signing - * or using the built transaction. + * Utility method to constructs a new ParameterError-variant PaymentSendFailure */ -MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); +struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); /** - * The value to be sent to the holder, or zero if the output will be omitted + * Utility method to constructs a new PathParameterError-variant PaymentSendFailure */ -MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); /** - * The value to be sent to the counterparty, or zero if the output will be omitted + * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure */ -MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); /** - * The destination of the holder's output + * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); /** - * The destination of the counterparty's output + * Utility method to constructs a new PartialFailure-variant PaymentSendFailure */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); /** - * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. + * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. */ -void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); +void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); /** - * The pre-built Bitcoin commitment transaction + * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat + * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. + * + * If you do not have one, the [`Route`] you pay over must not contain multiple paths as + * multi-path payments require a recipient-provided secret. + * + * Note that for spontaneous payments most lightning nodes do not currently support MPP + * receives, thus you should generally never be providing a secret here for spontaneous + * payments. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); +struct LDKThirtyTwoBytes RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * Get the SIGHASH_ALL sighash value of the transaction. + * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat + * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. * - * This can be used to verify a signature. + * If you do not have one, the [`Route`] you pay over must not contain multiple paths as + * multi-path payments require a recipient-provided secret. + * + * Note that for spontaneous payments most lightning nodes do not currently support MPP + * receives, thus you should generally never be providing a secret here for spontaneous + * payments. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Sign a transaction, either because we are counter-signing the counterparty's transaction or - * because we are about to broadcast a holder transaction. + * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of + * arbitrary length. This gives recipients substantially more flexibility to receive + * additional data. + * + * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication + * scheme to authenticate received payments against expected payments and invoices, this field + * is not used in LDK for received payments, and can be used to store arbitrary data in + * invoices which will be received with the payment. + * + * Note that this field was added to the lightning specification more recently than + * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata + * may not be supported as universally. + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. + * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of + * arbitrary length. This gives recipients substantially more flexibility to receive + * additional data. + * + * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication + * scheme to authenticate received payments against expected payments and invoices, this field + * is not used in LDK for received payments, and can be used to store arbitrary data in + * invoices which will be received with the payment. + * + * Note that this field was added to the lightning specification more recently than + * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata + * may not be supported as universally. */ -void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); +void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Creates a copy of the CommitmentTransaction + * Constructs a new RecipientOnionFields given each field */ -struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg); /** - * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read + * Creates a copy of the RecipientOnionFields */ -struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); +struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig); /** - * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write + * Checks if two RecipientOnionFieldss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); +bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b); /** - * The backwards-counting commitment number + * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read */ -MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj); /** - * The value to be sent to the broadcaster + * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write */ -MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser); /** - * The value to be sent to the counterparty + * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common + * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`] + * but do not require or provide any further data. */ -MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. + * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create + * payable HTLCs except for spontaneous payments, i.e. this should generally only be used for + * calls to [`ChannelManager::send_spontaneous_payment`]. + * + * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment */ -MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); /** - * Trust our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. - * - * This should only be used if you fully trust the builder of this object. It should not - * be used by an external signer - instead use the verify function. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); /** - * Verify our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. - * - * An external validating signer must call this method before signing - * or using the built transaction. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +void Type_free(struct LDKType this_ptr); /** - * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Frees any resources used by the UnsignedInvoice, if is_owned is set and inner is non-NULL. */ -void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); +void UnsignedInvoice_free(struct LDKUnsignedInvoice this_obj); /** - * The transaction ID of the built Bitcoin transaction + * The public key corresponding to the key needed to sign the invoice. */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedInvoice_signing_pubkey(const struct LDKUnsignedInvoice *NONNULL_PTR this_arg); /** - * The pre-built Bitcoin commitment transaction + * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj); /** - * The pre-calculated transaction creation public keys. + * Base fee charged (in millisatoshi) for the entire blinded path. */ -MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Should anchors be used. + * Base fee charged (in millisatoshi) for the entire blinded path. */ -MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Get a signature for each HTLC which was included in the commitment transaction (ie for - * which HTLCOutputInCommitment::transaction_output_index.is_some()). - * - * The returned Vec has one entry for each HTLC, and in the same order. - * - * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); +uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a - * shared secret first. This prevents on-chain observers from discovering how many commitment - * transactions occurred in a channel before it was closed. - * - * This function gets the shared secret from relevant channel public keys and can be used to - * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); +void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two InitFeaturess contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); +uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * 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. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); +void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * 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. + * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); +uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * 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. + * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); +void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); +uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * 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. + * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); +void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two ChannelTypeFeaturess contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); +struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the InitFeatures + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); +void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * Creates a copy of the NodeFeatures + * Constructs a new BlindedPayInfo given each field */ -struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); +MUST_USE_RES struct LDKBlindedPayInfo BlindedPayInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKBlindedHopFeatures features_arg); /** - * Creates a copy of the ChannelFeatures + * Creates a copy of the BlindedPayInfo */ -struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); +struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig); /** - * Creates a copy of the InvoiceFeatures + * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. */ -struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); +uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o); /** - * Creates a copy of the OfferFeatures + * Checks if two BlindedPayInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); +bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b); /** - * Creates a copy of the InvoiceRequestFeatures + * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read */ -struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); +struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj); /** - * Creates a copy of the ChannelTypeFeatures + * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write */ -struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); +struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser); /** - * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. + * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. */ -void InitFeatures_free(struct LDKInitFeatures this_obj); +void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); /** - * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. + * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_free(struct LDKNodeFeatures this_obj); +void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); /** - * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. + * Creates a copy of the InvoiceRequest */ -void ChannelFeatures_free(struct LDKChannelFeatures this_obj); +struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); /** - * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); +MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. + * A chain from [`Offer::chains`] that the offer is valid for. */ -void OfferFeatures_free(struct LDKOfferFeatures this_obj); +MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. + * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which + * must be greater than or equal to [`Offer::amount`], converted if necessary. + * + * [`chain`]: Self::chain */ -void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. + * Features pertaining to requesting an invoice. */ -void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * A possibly transient pubkey used to sign the invoice request. */ -MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read */ -MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); /** - * Create a blank Features with no features set + * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); +void Offer_free(struct LDKOffer this_obj); + +/** + * Creates a copy of the Offer + */ +struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. */ -MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * Returns whether the given chain is supported by the offer. */ -MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); +MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. */ -MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * The minimum amount required for a successful payment of a single item. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); +MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * A complete description of the purpose of the payment. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. */ -MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * Features pertaining to the offer. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); +MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. */ -MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * Whether the offer has expired. */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); +MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Read a InitFeatures from a byte array, created by InitFeatures_write + * The quantity of items supported. */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read + * Returns whether the given quantity is valid for the offer. */ -struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); +MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); /** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); +MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + * The public key used by the recipient to sign invoices. */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Read a NodeFeatures from a byte array, created by NodeFeatures_write + * Serialize the Offer object into a byte array which can be read by Offer_read */ -struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); +struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); /** - * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read + * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); +void Amount_free(struct LDKAmount this_obj); /** - * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write + * Creates a copy of the Amount */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); /** - * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); +void Quantity_free(struct LDKQuantity this_obj); /** - * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + * Creates a copy of the Quantity */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); +struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); /** - * Serialize the OfferFeatures object into a byte array which can be read by OfferFeatures_read + * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z OfferFeatures_write(const struct LDKOfferFeatures *NONNULL_PTR obj); +void Refund_free(struct LDKRefund this_obj); /** - * Read a OfferFeatures from a byte array, created by OfferFeatures_write + * Creates a copy of the Refund */ -struct LDKCResult_OfferFeaturesDecodeErrorZ OfferFeatures_read(struct LDKu8slice ser); +struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig); /** - * Serialize the InvoiceRequestFeatures object into a byte array which can be read by InvoiceRequestFeatures_read + * A complete description of the purpose of the refund. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. */ -struct LDKCVec_u8Z InvoiceRequestFeatures_write(const struct LDKInvoiceRequestFeatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Read a InvoiceRequestFeatures from a byte array, created by InvoiceRequestFeatures_write + * Duration since the Unix epoch when an invoice should no longer be sent. + * + * If `None`, the refund does not expire. */ -struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ InvoiceRequestFeatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Whether the refund has expired. */ -void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as required. + * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be + * displayed to the user but with the caveat that it has not been verified in any way. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender + * privacy by obfuscating its node id. */ -MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as required. + * A chain that the refund is valid for. */ -void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]). + * + * [`chain`]: Self::chain */ -MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Features pertaining to requesting an invoice. */ -MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * The quantity of an item that refund is for. */ -MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly + * transient pubkey. + * + * [`paths`]: Self::paths */ -void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Payer provided note to include in the invoice. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Serialize the Refund object into a byte array which can be read by Refund_read */ -MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); /** - * Set this feature as optional. + * Creates a copy of the UtxoLookupError */ -void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); /** - * Set this feature as required. + * Utility method to constructs a new UnknownChain-variant UtxoLookupError */ -void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); /** - * Checks if this feature is supported. + * Utility method to constructs a new UnknownTx-variant UtxoLookupError */ -MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); /** - * Set this feature as optional. + * Frees any resources used by the UtxoResult */ -void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void UtxoResult_free(struct LDKUtxoResult this_ptr); /** - * Set this feature as required. + * Creates a copy of the UtxoResult */ -void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Utility method to constructs a new Sync-variant UtxoResult */ -MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); /** - * Checks if this feature is required. + * Utility method to constructs a new Async-variant UtxoResult */ -MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); /** - * Checks if this feature is required. + * Calls the free function if one is set */ -MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void UtxoLookup_free(struct LDKUtxoLookup this_ptr); /** - * Set this feature as optional. + * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void UtxoFuture_free(struct LDKUtxoFuture this_obj); /** - * Set this feature as required. + * Creates a copy of the UtxoFuture */ -void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Builds a new future for later resolution. */ -MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); /** - * Set this feature as optional. + * 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 NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** - * Set this feature as required. + * 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 NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is supported. + * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeId_free(struct LDKNodeId this_obj); /** - * Checks if this feature is required. + * Creates a copy of the NodeId */ -MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Create a new NodeId from a public key */ -MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); /** - * Set this feature as optional. + * Get the public key slice from this NodeId */ -void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Get the public key from this NodeId */ -void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Generates a non-cryptographic 64-bit hash of the NodeId. */ -MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); /** - * Set this feature as optional. + * Serialize the NodeId object into a byte array which can be read by NodeId_read */ -void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); /** - * Set this feature as required. + * Read a NodeId from a byte array, created by NodeId_write */ -void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); /** - * Checks if this feature is supported. + * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NetworkGraph_free(struct LDKNetworkGraph this_obj); /** - * Set this feature as optional. + * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. */ -void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); /** - * Set this feature as required. + * Frees any resources used by the NetworkUpdate */ -void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); /** - * Checks if this feature is supported. + * Creates a copy of the NetworkUpdate */ -MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate */ -MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); /** - * Checks if this feature is required. + * Utility method to constructs a new ChannelFailure-variant NetworkUpdate */ -MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); /** - * Checks if this feature is required. + * Utility method to constructs a new NodeFailure-variant NetworkUpdate */ -MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); /** - * Set this feature as optional. + * Checks if two NetworkUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); /** - * Set this feature as required. + * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read */ -void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); /** - * Checks if this feature is supported. + * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write */ -MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); /** - * Set this feature as optional. + * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); /** - * Set this feature as required. + * Creates a new tracker of the actual state of the network of channels and nodes, + * assuming an existing [`NetworkGraph`]. + * 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. */ -void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); /** - * Checks if this feature is supported. + * 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. */ -MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void P2PGossipSync_add_utxo_lookup(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * Set this feature as optional. + * Handles any network updates originating from [`Event`]s. + * + * [`Event`]: crate::events::Event */ -void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** - * Set this feature as required. + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * 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 */ -MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); /** - * Checks if this feature is required. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Set this feature as optional. + * Whether the channel can be currently used for payments (in this one direction). */ -void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Whether the channel can be currently used for payments (in this one direction). */ -void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); /** - * Checks if this feature is supported. + * The difference in CLTV values that you must have when routing through this channel. */ -MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The difference in CLTV values that you must have when routing through this channel. */ -void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Set this feature as required. + * The minimum value, which must be relayed to the next hop via the channel */ -void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The minimum value, which must be relayed to the next hop via the channel */ -MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Set this feature as optional. + * The maximum value which may be relayed to the next hop via the channel. */ -void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The maximum value which may be relayed to the next hop via the channel. */ -void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if this feature is supported. + * Fees charged when the channel is used for routing */ -MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Fees charged when the channel is used for routing */ -MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Checks if this feature is required. + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); /** - * Set this feature as optional. + * Constructs a new ChannelUpdateInfo given each field */ -void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); /** - * Set this feature as required. + * Creates a copy of the ChannelUpdateInfo */ -void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Checks if two ChannelUpdateInfos 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. */ -MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); /** - * Set this feature as optional. + * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read */ -void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); /** - * Set this feature as required. + * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write */ -void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); /** - * Checks if this feature is supported. + * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelInfo_free(struct LDKChannelInfo this_obj); /** - * Set this feature as optional. + * Protocol features of a channel communicated during its announcement */ -void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Protocol features of a channel communicated during its announcement */ -void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Checks if this feature is supported. + * Source node of the first direction of a channel */ -MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Source node of the first direction of a channel */ -MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Checks if this feature is required. + * Details about the first direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Details about the first direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Set this feature as optional. + * Source node of the second direction of a channel */ -void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Source node of the second direction of a channel */ -void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Checks if this feature is supported. + * Details about the second direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * Details about the second direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Set this feature as required. + * The channel capacity as seen on-chain, if chain lookup is available. */ -void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The channel capacity as seen on-chain, if chain lookup is available. */ -MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Checks if this feature is required. + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); /** - * Set this feature as optional. + * Creates a copy of the ChannelInfo */ -void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); /** - * Set this feature as required. + * Checks if two ChannelInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); /** - * Set this feature as optional. + * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ -void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); /** - * Set this feature as required. + * Read a ChannelInfo from a byte array, created by ChannelInfo_write */ -void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); /** - * Checks if this feature is supported. + * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); /** - * Checks if this feature is required. + * Creates a copy of the DirectedChannelInfo */ -MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Returns information for the channel. */ -MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns the maximum HTLC amount allowed over the channel in the direction. */ -void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns the [`EffectiveCapacity`] of the channel in the direction. + * + * This is either the total capacity from the funding transaction, if known, or the + * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, + * otherwise. */ -void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Frees any resources used by the EffectiveCapacity */ -MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); /** - * Set this feature as optional. + * Creates a copy of the EffectiveCapacity */ -void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); /** - * Set this feature as required. + * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity */ -void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); /** - * Checks if this feature is supported. + * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity */ -MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat); /** - * Checks if this feature is required. + * Utility method to constructs a new Total-variant EffectiveCapacity */ -MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); /** - * Checks if this feature is required. + * Utility method to constructs a new Infinite-variant EffectiveCapacity */ -MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); /** - * Set this feature as optional. + * Utility method to constructs a new Unknown-variant EffectiveCapacity */ -void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); /** - * Set this feature as required. + * Returns the effective capacity denominated in millisatoshi. */ -void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void RoutingFees_free(struct LDKRoutingFees this_obj); /** - * Set this feature as optional. + * Flat routing fee in millisatoshis. */ -void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Flat routing fee in millisatoshis. */ -void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is supported. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is required. + * Constructs a new RoutingFees given each field */ -MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); /** - * Set this feature as optional. + * Checks if two RoutingFeess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); /** - * Set this feature as required. + * Creates a copy of the RoutingFees */ -void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Generates a non-cryptographic 64-bit hash of the RoutingFees. */ -MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); /** - * Set this feature as optional. + * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read */ -void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); /** - * Set this feature as required. + * Read a RoutingFees from a byte array, created by RoutingFees_write */ -void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); /** - * Checks if this feature is supported. + * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); /** - * Set this feature as optional. + * Protocol features the node announced support for */ -void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Protocol features the node announced support for */ -void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Checks if this feature is supported. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is required. + * Color assigned to the node */ -MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; /** - * Checks if this feature is required. + * Color assigned to the node */ -MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * Set this feature as optional. + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * Checks if this feature is supported. + * An initial announcement of the node + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * An initial announcement of the node + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); /** - * Set this feature as required. + * Constructs a new NodeAnnouncementInfo given each field */ -void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKNodeAnnouncement announcement_message_arg); /** - * Checks if this feature is supported. + * Creates a copy of the NodeAnnouncementInfo */ -MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); /** - * Set this feature as optional. + * Checks if two NodeAnnouncementInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); /** - * Set this feature as required. + * Internet-level addresses via which one can connect to the node */ -void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read */ -MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); /** - * Checks if this feature is required. + * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write */ -MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); /** - * Checks if this feature is required. + * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeAlias_free(struct LDKNodeAlias this_obj); + +const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; + +void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Checks if this feature is required. + * Constructs a new NodeAlias given each field */ -MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); /** - * Set this feature as optional. + * Creates a copy of the NodeAlias */ -void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); /** - * Set this feature as required. + * Checks if two NodeAliass contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read */ -MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); /** - * Checks if this feature is required. + * Read a NodeAlias from a byte array, created by NodeAlias_write */ -MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); /** - * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. + * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ -void ShutdownScript_free(struct LDKShutdownScript this_obj); +void NodeInfo_free(struct LDKNodeInfo this_obj); /** - * Creates a copy of the ShutdownScript + * All valid channels a node has announced + * + * Returns a copy of the field. */ -struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); +struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Checks if two ShutdownScripts 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. + * All valid channels a node has announced */ -bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); +struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * The script that did not meet the requirements from [BOLT #2]. + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * Constructs a new NodeInfo given each field */ -void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); /** - * Constructs a new InvalidShutdownScript given each field + * Creates a copy of the NodeInfo */ -MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); /** - * Creates a copy of the InvalidShutdownScript + * Checks if two NodeInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); +bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); /** - * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read + * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read */ -struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); /** - * Read a ShutdownScript from a byte array, created by ShutdownScript_write + * Read a NodeInfo from a byte array, created by NodeInfo_write */ -struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); /** - * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. + * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); /** - * Generates a P2WSH script pubkey from the given [`WScriptHash`]. + * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); /** - * Generates a witness script pubkey from the given segwit version and program. - * - * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or - * [`ShutdownScript::new_p2wsh`] instead. - * - * # Errors - * - * This function may return an error if `program` is invalid for the segwit `version`. + * Creates a new, empty, network graph. */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); /** - * Converts the shutdown script into the underlying [`Script`]. + * Returns a read-only view of the network graph. */ -MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); +MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The unix timestamp provided by the most recent rapid gossip sync. + * It will be set by the rapid sync process after every sync completion. */ -MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. + * Update the unix timestamp provided by the most recent rapid gossip sync. + * This should be done automatically by the rapid sync process after every sync completion. + */ +void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); + +/** + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement. * - * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. + * You probably don't want to call this directly, instead relying on a P2PGossipSync's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. */ -MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Calls the free function if one is set + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement without verifying the associated signatures. Because we aren't + * given the associated signatures here we cannot relay the node announcement to any of our + * peers. */ -void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); /** - * Calls the free function if one is set + * Store or update channel info from a channel announcement. + * + * You probably don't want to call this directly, instead relying on a P2PGossipSync's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -void Type_free(struct LDKType this_ptr); +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); /** - * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. + * 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 [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -void NodeId_free(struct LDKNodeId this_obj); +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); /** - * Creates a copy of the NodeId + * Update channel from partial announcement data received via rapid gossip sync + * + * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the + * rapid gossip sync server) + * + * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. */ -struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2); /** - * Create a new NodeId from a public key + * Marks a channel in the graph as failed permanently. + * + * The channel and any node for which this was their last channel are removed from the graph. */ -MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); +void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * Get the public key slice from this NodeId + * Marks a node in the graph as permanently failed, effectively removing it and its channels + * from local storage. */ -MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); +void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * Checks if two NodeIds contain equal inner contents. + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. + * + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. + * + * Note that for users of the `lightning-background-processor` crate this method may be + * automatically called regularly for you. + * + * This method will also cause us to stop tracking removed nodes and channels if they have been + * in the map for a while so that these can be resynced from gossip in the future. + * + * This method is only available with the `std` feature. See + * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use. */ -uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); +void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Serialize the NodeId object into a byte array which can be read by NodeId_read + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. + * + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. + * + * This method will also cause us to stop tracking removed nodes and channels if they have been + * in the map for a while so that these can be resynced from gossip in the future. + * + * This function takes the current unix time as an argument. For users with the `std` feature + * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. */ -struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); +void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); /** - * Read a NodeId from a byte array, created by NodeId_write + * For an already known (from announcement) channel, update info about one of the directions + * of the channel. + * + * You probably don't want to call this directly, instead relying on a P2PGossipSync's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. + * For an already known (from announcement) channel, update info about one of the directions + * of the channel without verifying the associated signatures. Because we aren't given the + * associated signatures here we cannot relay the channel update to any of our peers. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -void NetworkGraph_free(struct LDKNetworkGraph this_obj); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); /** - * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. + * Returns information on a channel with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); +MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * Frees any resources used by the NetworkUpdate + * Returns the list of channels in the graph */ -void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); +MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * Creates a copy of the NetworkUpdate + * Returns information on a node with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate + * Returns the list of nodes in the graph */ -struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); +MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelFailure-variant NetworkUpdate + * Get network addresses by node id. + * Returns None if the requested node is completely unknown, + * or if node announcement for the node was never received. */ -struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); +MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** - * Utility method to constructs a new NodeFailure-variant NetworkUpdate + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. */ -struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); +void DefaultRouter_free(struct LDKDefaultRouter this_obj); /** - * Checks if two NetworkUpdates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Creates a new router. */ -bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); +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); /** - * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read + * 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 LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); /** - * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write + * Calls the free function if one is set */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); +void Router_free(struct LDKRouter this_ptr); /** - * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. */ -void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); +void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs 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. + * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ -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 LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); /** - * 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. + * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read */ -void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); +struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj); /** - * Handles any network updates originating from [`Event`]s. - * - * [`Event`]: crate::util::events::Event + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ -void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); +struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); /** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is + * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. */ -struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * Creates a copy of the InFlightHtlcs */ -struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. + * Constructs an empty `InFlightHtlcs`. */ -void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); +MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`. */ -uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Returns liquidity in msat given the public key of the HTLC source, target, and short channel + * id. */ -void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); +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); /** - * Whether the channel can be currently used for payments (in this one direction). + * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read */ -bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); /** - * Whether the channel can be currently used for payments (in this one direction). + * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write */ -void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); +struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); /** - * The difference in CLTV values that you must have when routing through this channel. + * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. */ -uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RouteHop_free(struct LDKRouteHop this_obj); /** - * The difference in CLTV values that you must have when routing through this channel. + * The node_id of the node at this hop. */ -void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * The minimum value, which must be relayed to the next hop via the channel + * The node_id of the node at this hop. */ -uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The minimum value, which must be relayed to the next hop via the channel + * The node_announcement features of the node at this hop. For the last hop, these may be + * amended to match the features present in the invoice this node generated. */ -void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * The maximum value which may be relayed to the next hop via the channel. + * The node_announcement features of the node at this hop. For the last hop, these may be + * amended to match the features present in the invoice this node generated. */ -uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * The maximum value which may be relayed to the next hop via the channel. + * The channel that should be used from the previous hop to reach this node. */ -void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Fees charged when the channel is used for routing + * The channel that should be used from the previous hop to reach this node. */ -struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Fees charged when the channel is used for routing + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. + * The fee taken on this hop (for paying for the use of the *next* channel in the path). + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path + * * otherwise, this is the full value of this [`Path`]'s part of the payment * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); +uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelUpdateInfo given each field + * The fee taken on this hop (for paying for the use of the *next* channel in the path). + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path + * * otherwise, this is the full value of this [`Path`]'s part of the payment + * + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); +void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the ChannelUpdateInfo + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path + * * otherwise, this is the CLTV delta expected at the destination + * + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); +uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Checks if two ChannelUpdateInfos 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. + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path + * * otherwise, this is the CLTV delta expected at the destination + * + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); +void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read + * Constructs a new RouteHop given each field */ -struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); +MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); /** - * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write + * Creates a copy of the RouteHop */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the RouteHop. */ -void ChannelInfo_free(struct LDKChannelInfo this_obj); +uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); /** - * Protocol features of a channel communicated during its announcement + * Checks if two RouteHops contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); /** - * Protocol features of a channel communicated during its announcement + * Serialize the RouteHop object into a byte array which can be read by RouteHop_read */ -void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); /** - * Source node of the first direction of a channel + * Read a RouteHop from a byte array, created by RouteHop_write */ -struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); /** - * Source node of the first direction of a channel + * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL. */ -void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +void BlindedTail_free(struct LDKBlindedTail this_obj); /** - * Details about the first direction of a channel + * The hops of the [`BlindedPath`] provided by the recipient. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Details about the first direction of a channel + * The hops of the [`BlindedPath`] provided by the recipient. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); /** - * Source node of the second direction of a channel + * The blinding point of the [`BlindedPath`] provided by the recipient. + * + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Source node of the second direction of a channel + * The blinding point of the [`BlindedPath`] provided by the recipient. + * + * [`BlindedPath`]: crate::blinded_path::BlindedPath */ -void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Details about the second direction of a channel - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Details about the second direction of a channel - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * The total amount paid on this [`Path`], excluding the fees. */ -struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * The total amount paid on this [`Path`], excluding the fees. */ -void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val); /** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new BlindedTail given each field */ -struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBlindedTail BlindedTail_new(struct LDKCVec_BlindedHopZ hops_arg, struct LDKPublicKey blinding_point_arg, uint32_t excess_final_cltv_expiry_delta_arg, uint64_t final_value_msat_arg); /** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the BlindedTail */ -void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig); /** - * Creates a copy of the ChannelInfo + * Generates a non-cryptographic 64-bit hash of the BlindedTail. */ -struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); +uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o); /** - * Checks if two ChannelInfos contain equal inner contents. + * Checks if two BlindedTails 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 ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); +bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b); /** - * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read */ -MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); +struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj); /** - * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read + * Read a BlindedTail from a byte array, created by BlindedTail_write */ -struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); +struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser); /** - * Read a ChannelInfo from a byte array, created by ChannelInfo_write + * Frees any resources used by the Path, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); +void Path_free(struct LDKPath this_obj); /** - * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); +struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Creates a copy of the DirectedChannelInfo + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); +void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val); /** - * Returns information for the channel. + * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Returns the maximum HTLC amount allowed over the channel in the direction. + * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val); /** - * Returns the [`EffectiveCapacity`] of the channel in the direction. - * - * This is either the total capacity from the funding transaction, if known, or the - * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, - * otherwise. + * Constructs a new Path given each field */ -MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); /** - * Frees any resources used by the EffectiveCapacity + * Creates a copy of the Path */ -void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); +struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig); /** - * Creates a copy of the EffectiveCapacity + * Generates a non-cryptographic 64-bit hash of the Path. */ -struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); +uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o); /** - * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity + * Checks if two Paths contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); +bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b); /** - * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity + * Gets the fees for a given path, excluding any excess paid to the recipient. */ -struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat); +MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Total-variant EffectiveCapacity + * Gets the total amount paid on this [`Path`], excluding the fees. */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); +MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Infinite-variant EffectiveCapacity + * Gets the final hop's CLTV expiry delta. */ -struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); +MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Unknown-variant EffectiveCapacity + * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. */ -struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); +void Route_free(struct LDKRoute this_obj); /** - * Returns the effective capacity denominated in millisatoshi. + * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no + * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be + * the same. */ -MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); +struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. + * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no + * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be + * the same. */ -void RoutingFees_free(struct LDKRoutingFees this_obj); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); /** - * Flat routing fee in satoshis + * The `payment_params` parameter passed to [`find_route`]. + * This is used by `ChannelManager` to track information which may be required for retries, + * provided back to you via [`Event::PaymentPathFailed`]. + * + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Flat routing fee in satoshis + * The `payment_params` parameter passed to [`find_route`]. + * This is used by `ChannelManager` to track information which may be required for retries, + * provided back to you via [`Event::PaymentPathFailed`]. + * + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Constructs a new Route given each field */ -uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Creates a copy of the Route */ -void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); /** - * Constructs a new RoutingFees given each field + * Generates a non-cryptographic 64-bit hash of the Route. */ -MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); +uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); /** - * Checks if two RoutingFeess contain equal inner contents. + * Checks if two Routes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); +bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); /** - * Creates a copy of the RoutingFees + * Returns the total amount of fees paid on this [`Route`]. + * + * This doesn't include any extra payment made to the recipient, which can happen in excess of + * the amount passed to [`find_route`]'s `params.final_value_msat`. */ -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); +MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Checks if two RoutingFeess contain equal inner contents. + * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than + * requested if we had to reach htlc_minimum_msat. */ -uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); +MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read + * Serialize the Route object into a byte array which can be read by Route_read */ -struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); /** - * Read a RoutingFees from a byte array, created by RoutingFees_write + * Read a Route from a byte array, created by Route_write */ -struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); /** - * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL. + * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. */ -void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); +void RouteParameters_free(struct LDKRouteParameters this_obj); /** - * Protocol features the node announced support for + * The parameters of the failed payment path. */ -struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Protocol features the node announced support for + * The parameters of the failed payment path. */ -void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * The amount in msats sent on the failed payment path. */ -uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * The amount in msats sent on the failed payment path. */ -void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); +void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Color assigned to the node + * Constructs a new RouteParameters given each field */ -const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg); /** - * Color assigned to the node + * Creates a copy of the RouteParameters */ -void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * 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. */ -struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val); +struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); /** - * Internet-level addresses via which one can connect to the node - * - * Returns a copy of the field. + * Read a RouteParameters from a byte array, created by RouteParameters_write */ -struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); /** - * Internet-level addresses via which one can connect to the node + * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. */ -void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); +void PaymentParameters_free(struct LDKPaymentParameters this_obj); /** - * An initial announcement of the node - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The node id of the payee. */ -struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * An initial announcement of the node - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The node id of the payee. */ -void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); +void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new NodeAnnouncementInfo given each field + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); +struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the NodeAnnouncementInfo + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: Self::for_keysend + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); +void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); /** - * Checks if two NodeAnnouncementInfos 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. + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); +struct LDKHints PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read + * Hints for routing to the payee, containing channels connecting the payee to public nodes. */ -struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); +void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKHints val); /** - * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -void NodeAlias_free(struct LDKNodeAlias this_obj); - -const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; - -void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new NodeAlias given each field + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); +uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the NodeAlias + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); +void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two NodeAliass 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. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); +uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); +void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Read a NodeAlias from a byte array, created by NodeAlias_write + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); +uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -void NodeInfo_free(struct LDKNodeInfo this_obj); +void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * All valid channels a node has announced + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. * * Returns a copy of the field. */ -struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * All valid channels a node has announced + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. */ -void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *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 + * The minimum CLTV delta at the end of the route. This value must not be zero. */ -struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +uint32_t PaymentParameters_get_final_cltv_expiry_delta(const struct LDKPaymentParameters *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 + * The minimum CLTV delta at the end of the route. This value must not be zero. */ -void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +void PaymentParameters_set_final_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new PaymentParameters given each field */ -struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKHints 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); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the PaymentParameters */ -void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); +struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); /** - * Constructs a new NodeInfo given each field + * Generates a non-cryptographic 64-bit hash of the PaymentParameters. */ -MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); +uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); /** - * Creates a copy of the NodeInfo + * Checks if two PaymentParameterss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); +bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); /** - * Checks if two NodeInfos 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. + * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read */ -bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); +struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); /** - * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read + * Read a PaymentParameters from a byte array, created by PaymentParameters_write */ -struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); +struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); /** - * Read a NodeInfo from a byte array, created by NodeInfo_write + * 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. */ -struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** - * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read + * 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. */ -struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** - * Read a NetworkGraph from a byte array, created by NetworkGraph_write + * Frees any resources used by the Hints */ -struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); +void Hints_free(struct LDKHints this_ptr); /** - * Creates a new, empty, network graph. + * Creates a copy of the Hints */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger); +struct LDKHints Hints_clone(const struct LDKHints *NONNULL_PTR orig); /** - * Returns a read-only view of the network graph. + * Utility method to constructs a new Blinded-variant Hints */ -MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKHints Hints_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a); /** - * The unix timestamp provided by the most recent rapid gossip sync. - * It will be set by the rapid sync process after every sync completion. + * Utility method to constructs a new Clear-variant Hints */ -MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKHints Hints_clear(struct LDKCVec_RouteHintZ a); /** - * Update the unix timestamp provided by the most recent rapid gossip sync. - * This should be done automatically by the rapid sync process after every sync completion. + * Generates a non-cryptographic 64-bit hash of the Hints. */ -void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); +uint64_t Hints_hash(const struct LDKHints *NONNULL_PTR o); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement. - * - * You probably don't want to call this directly, instead relying on a P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. + * Checks if two Hintss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); +bool Hints_eq(const struct LDKHints *NONNULL_PTR a, const struct LDKHints *NONNULL_PTR b); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement without verifying the associated signatures. Because we aren't - * given the associated signatures here we cannot relay the node announcement to any of our - * peers. + * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); +void RouteHint_free(struct LDKRouteHint this_obj); + +struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); + +void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); /** - * Store or update channel info from a channel announcement. - * - * You probably don't want to call this directly, instead relying on a P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. - * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. + * Constructs a new RouteHint given each field */ -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 LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); /** - * Store or update channel info from a channel announcement without verifying the associated - * signatures. Because we aren't given the associated signatures here we cannot relay the - * channel announcement to any of our peers. - * - * If a `chain::Access` object is provided via `chain_access`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. + * Creates a copy of the RouteHint */ -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); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); /** - * Update channel from partial announcement data received via rapid gossip sync - * - * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the - * rapid gossip sync server) - * - * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. + * Generates a non-cryptographic 64-bit hash of the RouteHint. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2); +uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); /** - * Marks a channel in the graph as failed if a corresponding HTLC fail was sent. - * If permanent, removes a channel from the local storage. - * May cause the removal of nodes too, if this was their last channel. - * If not permanent, makes channels unavailable for routing. + * Checks if two RouteHints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); +bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); /** - * Marks a node in the graph as permanently failed, effectively removing it and its channels - * from local storage. + * Serialize the RouteHint object into a byte array which can be read by RouteHint_read */ -void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); +struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); /** - * Removes information about channels that we haven't heard any updates about in some time. - * This can be used regularly to prune the network graph of channels that likely no longer - * exist. - * - * While there is no formal requirement that nodes regularly re-broadcast their channel - * updates every two weeks, the non-normative section of BOLT 7 currently suggests that - * pruning occur for updates which are at least two weeks old, which we implement here. - * - * Note that for users of the `lightning-background-processor` crate this method may be - * automatically called regularly for you. - * - * This method will also cause us to stop tracking removed nodes and channels if they have been - * in the map for a while so that these can be resynced from gossip in the future. - * - * This method is only available with the `std` feature. See - * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use. + * Read a RouteHint from a byte array, created by RouteHint_write */ -void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); /** - * Removes information about channels that we haven't heard any updates about in some time. - * This can be used regularly to prune the network graph of channels that likely no longer - * exist. - * - * While there is no formal requirement that nodes regularly re-broadcast their channel - * updates every two weeks, the non-normative section of BOLT 7 currently suggests that - * pruning occur for updates which are at least two weeks old, which we implement here. - * - * This method will also cause us to stop tracking removed nodes and channels if they have been - * in the map for a while so that these can be resynced from gossip in the future. - * - * This function takes the current unix time as an argument. For users with the `std` feature - * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. + * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. */ -void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); +void RouteHintHop_free(struct LDKRouteHintHop this_obj); /** - * For an already known (from announcement) channel, update info about one of the directions - * of the channel. - * - * You probably don't want to call this directly, instead relying on a P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. - * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * The node_id of the non-target end of the route */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * For an already known (from announcement) channel, update info about one of the directions - * of the channel without verifying the associated signatures. Because we aren't given the - * associated signatures here we cannot relay the channel update to any of our peers. - * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * The node_id of the non-target end of the route */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Returns information on a channel with the given id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The short_channel_id of this channel */ -MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); +uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Returns the list of channels in the graph + * The short_channel_id of this channel */ -MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns information on a node with the given id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The fees which must be paid to use this channel */ -MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Returns the list of nodes in the graph + * The fees which must be paid to use this channel */ -MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Get network addresses by node id. - * Returns None if the requested node is completely unknown, - * or if node announcement for the node was never received. + * The difference in CLTV values between this node and the next node. */ -MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + * The difference in CLTV values between this node and the next node. */ -void DefaultRouter_free(struct LDKDefaultRouter this_obj); +void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new router. + * The minimum value, in msat, which must be relayed to the next hop. */ -MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer); +struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * 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 + * The minimum value, in msat, which must be relayed to the next hop. */ -struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Calls the free function if one is set + * The maximum value in msat available for routing with a single HTLC. */ -void Router_free(struct LDKRouter this_ptr); +struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. + * The maximum value in msat available for routing with a single HTLC. */ -void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); +void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Initialize a new `ScorerAccountingForInFlightHtlcs`. + * Constructs a new RouteHintHop given each field */ -MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, struct LDKInFlightHtlcs inflight_htlcs); +MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); /** - * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read + * Creates a copy of the RouteHintHop */ -struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR obj); +struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); /** - * 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 + * Generates a non-cryptographic 64-bit hash of the RouteHintHop. */ -struct LDKScore ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); +uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); /** - * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. + * Checks if two RouteHintHops contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); +bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); /** - * Creates a copy of the InFlightHtlcs + * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read */ -struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); +struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); /** - * Constructs an empty `InFlightHtlcs`. + * Read a RouteHintHop from a byte array, created by RouteHintHop_write */ -MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); +struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); /** - * Returns liquidity in msat given the public key of the HTLC source, target, and short channel - * id. + * Finds a route from us (payer) to the given target node (payee). + * + * If the payee provided features in their invoice, they should be provided via `params.payee`. + * Without this, MPP will only be used if the payee's features are available in the network graph. + * + * Private routing paths between a public node and the target may be included in `params.payee`. + * + * If some channels aren't announced, it may be useful to fill in `first_hops` with the results + * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels + * from `network_graph` will be ignored, and only those in `first_hops` will be used. + * + * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. + * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / + * `htlc_maximum_msat` *are* checked as they may change based on the receiving node. + * + * # Note + * + * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any + * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this + * function. + * + * # Panics + * + * Panics if first_hops contains channels without short_channel_ids; + * [`ChannelManager::list_usable_channels`] will never include such channels. + * + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]); /** - * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read + * Construct a route from us (payer) to the target node (payee) via the given hops (which should + * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path. + * + * Re-uses logic from `find_route`, so the restrictions described there also apply here. */ -struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); +struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]); /** - * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write + * Calls the free function if one is set */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); +void Score_free(struct LDKScore this_ptr); /** - * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void RouteHop_free(struct LDKRouteHop this_obj); +void LockableScore_free(struct LDKLockableScore this_ptr); /** - * The node_id of the node at this hop. + * Calls the free function if one is set */ -struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); +void WriteableScore_free(struct LDKWriteableScore this_ptr); /** - * The node_id of the node at this hop. + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. */ -void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); /** - * The node_announcement features of the node at this hop. For the last hop, these may be - * amended to match the features present in the invoice this node generated. + * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. */ -struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj); /** - * The node_announcement features of the node at this hop. For the last hop, these may be - * amended to match the features present in the invoice this node generated. + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ -void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg); /** - * The channel that should be used from the previous hop to reach this node. + * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read */ -uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj); /** - * The channel that should be used from the previous hop to reach this node. + * Constructs a new LockableScore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is */ -void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read */ -struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Constructs a new WriteableScore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is */ -void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * The fee taken on this hop (for paying for the use of the *next* channel in the path). - * For the last hop, this should be the full value of the payment (might be more than - * requested if we had to match htlc_minimum_msat). + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ -uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * The fee taken on this hop (for paying for the use of the *next* channel in the path). - * For the last hop, this should be the full value of the payment (might be more than - * requested if we had to match htlc_minimum_msat). + * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. */ -void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +void ChannelUsage_free(struct LDKChannelUsage this_obj); /** - * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value - * expected at the destination, in excess of the current block height. + * The amount to send through the channel, denominated in millisatoshis. */ -uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); +uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value - * expected at the destination, in excess of the current block height. + * The amount to send through the channel, denominated in millisatoshis. */ -void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); +void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new RouteHop given each field + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); +uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Creates a copy of the RouteHop + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); +void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two RouteHops contain equal inner contents. + * The effective capacity of the channel. */ -uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); +struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Checks if two RouteHops contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * The effective capacity of the channel. */ -bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); +void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); /** - * Serialize the RouteHop object into a byte array which can be read by RouteHop_read + * Constructs a new ChannelUsage given each field */ -struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); /** - * Read a RouteHop from a byte array, created by RouteHop_write + * Creates a copy of the ChannelUsage */ -struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); +struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); /** - * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. + * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. */ -void Route_free(struct LDKRoute this_obj); +void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); /** - * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the - * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT - * INCLUDING our own, where the last hop is the destination. Thus, this must always be at - * least length one. While the maximum length of any given path is variable, keeping the length - * of any path less or equal to 19 should currently ensure it is viable. + * Creates a copy of the FixedPenaltyScorer */ -struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); /** - * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the - * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT - * INCLUDING our own, where the last hop is the destination. Thus, this must always be at - * least length one. While the maximum length of any given path is variable, keeping the length - * of any path less or equal to 19 should currently ensure it is viable. + * Creates a new scorer using `penalty_msat`. */ -void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); +MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** - * The `payment_params` parameter passed to [`find_route`]. - * This is used by `ChannelManager` to track information which may be required for retries, - * provided back to you via [`Event::PaymentPathFailed`]. - * - * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * The `payment_params` parameter passed to [`find_route`]. - * This is used by `ChannelManager` to track information which may be required for retries, - * provided back to you via [`Event::PaymentPathFailed`]. - * - * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read */ -void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); /** - * Constructs a new Route given each field + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); /** - * Creates a copy of the Route + * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. */ -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); +void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); /** - * Checks if two Routes contain equal inner contents. + * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL. */ -uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); +void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj); /** - * Checks if two Routes contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat */ -bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); +uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Returns the total amount of fees paid on this [`Route`]. + * A fixed penalty in msats to apply to each channel. * - * This doesn't include any extra payment made to the recipient, which can happen in excess of - * the amount passed to [`find_route`]'s `params.final_value_msat`. + * Default value: 500 msat */ -MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); +void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns the total amount paid on this [`Route`], excluding the fees. + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat */ -MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); +uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Serialize the Route object into a byte array which can be read by Route_read + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat */ -struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); +void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a Route from a byte array, created by Route_write + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment, as determined by our latest estimates of the channel's + * liquidity, to determine the liquidity penalty. + * + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. + * + * `-log10(success_probability) * liquidity_penalty_multiplier_msat` + * + * Default value: 30,000 msat + * + * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life */ -struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); +uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment, as determined by our latest estimates of the channel's + * liquidity, to determine the liquidity penalty. + * + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. + * + * `-log10(success_probability) * liquidity_penalty_multiplier_msat` + * + * Default value: 30,000 msat + * + * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life */ -void RouteParameters_free(struct LDKRouteParameters this_obj); +void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The parameters of the failed payment path. + * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, + * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on + * the available liquidity is halved and the upper-bound moves half-way to the channel's total + * capacity. + * + * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, + * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] + * struct documentation for more info on the way the liquidity bounds are used. + * + * For example, if the channel's capacity is 1 million sats, and the current upper and lower + * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper + * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. + * + * Default value: 6 hours + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. */ -struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * The parameters of the failed payment path. + * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, + * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on + * the available liquidity is halved and the upper-bound moves half-way to the channel's total + * capacity. + * + * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, + * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] + * struct documentation for more info on the way the liquidity bounds are used. + * + * For example, if the channel's capacity is 1 million sats, and the current upper and lower + * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper + * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. + * + * Default value: 6 hours + * + * # Note + * + * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. */ -void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The amount in msats sent on the failed payment path. + * A multiplier used in conjunction with a payment amount and the negative `log10` of the + * channel's success probability for the payment, as determined by our latest estimates of the + * channel's liquidity, to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * Default value: 192 msat */ -uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * The amount in msats sent on the failed payment path. + * A multiplier used in conjunction with a payment amount and the negative `log10` of the + * channel's success probability for the payment, as determined by our latest estimates of the + * channel's liquidity, to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * Default value: 192 msat */ -void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); +void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The CLTV on the final hop of the failed payment path. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for the payment, as determined based on the history of our estimates of the + * channel's available liquidity, to determine a penalty. + * + * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using + * only our latest estimate for the current liquidity available in the channel, it estimates + * success probability based on the estimated liquidity available in the channel through + * history. Specifically, every time we update our liquidity bounds on a given channel, we + * track which of several buckets those bounds fall into, exponentially decaying the + * probability of each bucket as new samples are added. + * + * Default value: 10,000 msat + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ -uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * The CLTV on the final hop of the failed payment path. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for the payment, as determined based on the history of our estimates of the + * channel's available liquidity, to determine a penalty. + * + * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using + * only our latest estimate for the current liquidity available in the channel, it estimates + * success probability based on the estimated liquidity available in the channel through + * history. Specifically, every time we update our liquidity bounds on a given channel, we + * track which of several buckets those bounds fall into, exponentially decaying the + * probability of each bucket as new samples are added. + * + * Default value: 10,000 msat + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ -void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val); +void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new RouteParameters given each field + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the payment, as determined based on the history of our + * estimates of the channel's available liquidity, to determine a penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost for + * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths + * of the payment amount, weighted by the negative `log10` of the success probability. + * + * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead + * of using only our latest estimate for the current liquidity available in the channel, it + * estimates success probability based on the estimated liquidity available in the channel + * through history. Specifically, every time we update our liquidity bounds on a given + * channel, we track which of several buckets those bounds fall into, exponentially decaying + * the probability of each bucket as new samples are added. + * + * Default value: 64 msat + * + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ -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); +uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the RouteParameters + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the payment, as determined based on the history of our + * estimates of the channel's available liquidity, to determine a penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost for + * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths + * of the payment amount, weighted by the negative `log10` of the success probability. + * + * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead + * of using only our latest estimate for the current liquidity available in the channel, it + * estimates success probability based on the estimated liquidity available in the channel + * through history. Specifically, every time we update our liquidity bounds on a given + * channel, we track which of several buckets those bounds fall into, exponentially decaying + * the probability of each bucket as new samples are added. + * + * Default value: 64 msat + * + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ -struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read + * If we aren't learning any new datapoints for a channel, the historical liquidity bounds + * tracking can simply live on with increasingly stale data. Instead, when a channel has not + * seen a liquidity estimate update for this amount of time, the historical datapoints are + * decayed by half. + * + * Note that after 16 or more half lives all historical data will be completely gone. + * + * Default value: 14 days */ -struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); +uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Read a RouteParameters from a byte array, created by RouteParameters_write + * If we aren't learning any new datapoints for a channel, the historical liquidity bounds + * tracking can simply live on with increasingly stale data. Instead, when a channel has not + * seen a liquidity estimate update for this amount of time, the historical datapoints are + * decayed by half. + * + * Note that after 16 or more half lives all historical data will be completely gone. + * + * Default value: 14 days */ -struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); +void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat */ -void PaymentParameters_free(struct LDKPaymentParameters this_obj); +uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * The node id of the payee. + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat */ -struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The node id of the payee. + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. + * + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat */ -void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Features supported by the payee. + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. * - * [`for_keysend`]: Self::for_keysend + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + */ +void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Creates a copy of the ProbabilisticScoringParameters + */ +struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig); + +/** + * Creates a new scorer using the given scoring parameters for sending payments from a node + * through a network graph. */ -struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); /** - * Features supported by the payee. - * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. - * - * [`for_keysend`]: Self::for_keysend + * Dump the contents of this scorer into the configured logger. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that this writes roughly one line per channel for which we have a liquidity estimate, + * which may be a substantial amount of log output. */ -void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val); +void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. + * Query the estimated minimum and maximum liquidity available for sending a payment over the + * channel with `scid` towards the given `target` node. */ -struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +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); /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. + * 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]))`. */ -void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val); +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); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * Marks the node with the given `node_id` as banned, i.e., + * it will be avoided during path finding. */ -struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * Removes the node with the given `node_id` from the list of nodes to avoid. */ -void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * Sets a manual penalty for the given node. */ -uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * Removes the node with the given `node_id` from the list of manual penalties. */ -void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); +void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Clears the list of manual penalties that are applied during path finding. */ -uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Marks all nodes in the given list as banned, i.e., + * they will be avoided during path finding. */ -void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); /** - * Selects the maximum share of a channel's total capacity which will be sent over a channel, - * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas - * a lower value prefers to send larger MPP parts, potentially saturating channels and - * increasing failure probability for those paths. - * - * Note that this restriction will be relaxed during pathfinding after paths which meet this - * restriction have been found. While paths which meet this criteria will be searched for, it - * is ultimately up to the scorer to select them over other paths. - * - * A value of 0 will allow payments up to and including a channel's total announced usable - * capacity, a value of one will only use up to half its capacity, two 1/4, etc. - * - * Default value: 2 + * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. */ -uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); /** - * Selects the maximum share of a channel's total capacity which will be sent over a channel, - * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas - * a lower value prefers to send larger MPP parts, potentially saturating channels and - * increasing failure probability for those paths. - * - * Note that this restriction will be relaxed during pathfinding after paths which meet this - * restriction have been found. While paths which meet this criteria will be searched for, it - * is ultimately up to the scorer to select them over other paths. - * - * A value of 0 will allow payments up to and including a channel's total announced usable - * capacity, a value of one will only use up to half its capacity, two 1/4, etc. - * - * Default value: 2 + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ -void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * A list of SCIDs which this payment was previously attempted over and which caused the - * payment to fail. Future attempts for the same payment shouldn't be relayed through any of - * these SCIDs. - * - * Returns a copy of the field. + * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read */ -struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); /** - * A list of SCIDs which this payment was previously attempted over and which caused the - * payment to fail. Future attempts for the same payment shouldn't be relayed through any of - * these SCIDs. + * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ -void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); /** - * Constructs a new PaymentParameters given each field + * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. */ -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); +void OnionMessenger_free(struct LDKOnionMessenger this_obj); /** - * Creates a copy of the PaymentParameters + * Frees any resources used by the Destination */ -struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); +void Destination_free(struct LDKDestination this_ptr); /** - * Checks if two PaymentParameterss contain equal inner contents. + * Creates a copy of the Destination */ -uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); +struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); /** - * Checks if two PaymentParameterss 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. + * Utility method to constructs a new Node-variant Destination */ -bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); +struct LDKDestination Destination_node(struct LDKPublicKey a); /** - * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read + * Utility method to constructs a new BlindedPath-variant Destination */ -struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); +struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); /** - * Read a PaymentParameters from a byte array, created by PaymentParameters_write + * Frees any resources used by the SendError */ -struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser); +void SendError_free(struct LDKSendError this_ptr); /** - * Creates a payee with the node id of the given `pubkey`. + * Creates a copy of the SendError */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey); +struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig); /** - * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + * Utility method to constructs a new Secp256k1-variant SendError */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey); +struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a); /** - * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new TooBigPacket-variant SendError */ -void RouteHint_free(struct LDKRouteHint this_obj); - -struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); - -void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); +struct LDKSendError SendError_too_big_packet(void); /** - * Constructs a new RouteHint given each field + * Utility method to constructs a new TooFewBlindedHops-variant SendError */ -MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); +struct LDKSendError SendError_too_few_blinded_hops(void); /** - * Creates a copy of the RouteHint + * Utility method to constructs a new InvalidFirstHop-variant SendError */ -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); +struct LDKSendError SendError_invalid_first_hop(void); /** - * Checks if two RouteHints contain equal inner contents. + * Utility method to constructs a new InvalidMessage-variant SendError */ -uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); +struct LDKSendError SendError_invalid_message(void); /** - * Checks if two RouteHints contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Utility method to constructs a new BufferFull-variant SendError */ -bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); +struct LDKSendError SendError_buffer_full(void); /** - * Serialize the RouteHint object into a byte array which can be read by RouteHint_read + * Utility method to constructs a new GetNodeIdFailed-variant SendError */ -struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); +struct LDKSendError SendError_get_node_id_failed(void); /** - * Read a RouteHint from a byte array, created by RouteHint_write + * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError */ -struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); +struct LDKSendError SendError_blinded_path_advance_failed(void); /** - * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. + * Checks if two SendErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void RouteHintHop_free(struct LDKRouteHintHop this_obj); +bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b); /** - * The node_id of the non-target end of the route + * Calls the free function if one is set */ -struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); /** - * The node_id of the non-target end of the route + * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to + * their respective handlers. */ -void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); /** - * The short_channel_id of this channel + * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`. + * See [`OnionMessenger`] for example usage. + * + * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +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); /** - * The short_channel_id of this channel + * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is */ -void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); +struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); /** - * The fees which must be paid to use this channel + * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is */ -struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); /** - * The fees which must be paid to use this channel + * Frees any resources used by the OnionMessageContents */ -void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); /** - * The difference in CLTV values between this node and the next node. + * Utility method to constructs a new Custom-variant OnionMessageContents */ -uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); /** - * The difference in CLTV values between this node and the next node. + * Calls the free function if one is set */ -void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); +void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr); /** - * The minimum value, in msat, which must be relayed to the next hop. + * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +void BlindedPath_free(struct LDKBlindedPath this_obj); /** - * The minimum value, in msat, which must be relayed to the next hop. + * Creates a copy of the BlindedPath */ -void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig); /** - * The maximum value in msat available for routing with a single HTLC. + * Generates a non-cryptographic 64-bit hash of the BlindedPath. */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o); /** - * The maximum value in msat available for routing with a single HTLC. + * Checks if two BlindedPaths contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b); /** - * Constructs a new RouteHintHop given each field + * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); +void BlindedHop_free(struct LDKBlindedHop this_obj); /** - * Creates a copy of the RouteHintHop + * Creates a copy of the BlindedHop */ -struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); +struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); /** - * Checks if two RouteHintHops contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the BlindedHop. */ -uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); +uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); /** - * Checks if two RouteHintHops contain equal inner contents. + * Checks if two BlindedHops contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); +bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); /** - * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read + * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node + * pubkey in `node_pks` will be the destination node. + * + * Errors if less than two hops are provided or if `node_pk`(s) are invalid. */ -struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Read a RouteHintHop from a byte array, created by RouteHintHop_write + * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read */ -struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); +struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); /** - * Finds a route from us (payer) to the given target node (payee). - * - * If the payee provided features in their invoice, they should be provided via `params.payee`. - * Without this, MPP will only be used if the payee's features are available in the network graph. - * - * Private routing paths between a public node and the target may be included in `params.payee`. - * - * If some channels aren't announced, it may be useful to fill in `first_hops` with the results - * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels - * from `network_graph` will be ignored, and only those in `first_hops` will be used. - * - * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. - * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / - * `htlc_maximum_msat` *are* checked as they may change based on the receiving node. - * - * # Note - * - * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any - * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this - * function. - * - * # Panics - * - * Panics if first_hops contains channels without short_channel_ids; - * [`ChannelManager::list_usable_channels`] will never include such channels. - * - * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels - * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a BlindedPath from a byte array, created by BlindedPath_write */ -struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]); +struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); /** - * Construct a route from us (payer) to the target node (payee) via the given hops (which should - * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path. - * - * Re-uses logic from `find_route`, so the restrictions described there also apply here. + * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read */ -struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]); +struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); /** - * Calls the free function if one is set + * Read a BlindedHop from a byte array, created by BlindedHop_write */ -void Score_free(struct LDKScore this_ptr); +struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); /** - * Calls the free function if one is set + * Frees any resources used by the PaymentPurpose */ -void LockableScore_free(struct LDKLockableScore this_ptr); +void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); /** - * Calls the free function if one is set + * Creates a copy of the PaymentPurpose */ -void WriteableScore_free(struct LDKWriteableScore this_ptr); +struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); /** - * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvoicePayment-variant PaymentPurpose */ -void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); +struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** - * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose */ -void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj); +struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); /** - * 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 + * Checks if two PaymentPurposes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg); +bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); /** - * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read + * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read */ -struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj); +struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); /** - * Constructs a new LockableScore which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is + * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write */ -struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); /** - * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read + * Frees any resources used by the PathFailure */ -struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); +void PathFailure_free(struct LDKPathFailure this_ptr); /** - * Constructs a new WriteableScore which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is + * Creates a copy of the PathFailure */ -struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); /** - * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + * Utility method to constructs a new InitialSend-variant PathFailure */ -MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); +struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); /** - * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new OnPath-variant PathFailure */ -void ChannelUsage_free(struct LDKChannelUsage this_obj); +struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); /** - * The amount to send through the channel, denominated in millisatoshis. + * Checks if two PathFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); /** - * The amount to send through the channel, denominated in millisatoshis. + * Serialize the PathFailure object into a byte array which can be read by PathFailure_read */ -void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); /** - * Total amount, denominated in millisatoshis, already allocated to send through the channel - * as part of a multi-path payment. + * Read a PathFailure from a byte array, created by PathFailure_write */ -uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); /** - * Total amount, denominated in millisatoshis, already allocated to send through the channel - * as part of a multi-path payment. + * Frees any resources used by the ClosureReason */ -void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +void ClosureReason_free(struct LDKClosureReason this_ptr); /** - * The effective capacity of the channel. + * Creates a copy of the ClosureReason */ -struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); /** - * The effective capacity of the channel. + * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason */ -void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); +struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg); /** - * Constructs a new ChannelUsage given each field + * Utility method to constructs a new HolderForceClosed-variant ClosureReason */ -MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); +struct LDKClosureReason ClosureReason_holder_force_closed(void); /** - * Creates a copy of the ChannelUsage + * Utility method to constructs a new CooperativeClosure-variant ClosureReason */ -struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); +struct LDKClosureReason ClosureReason_cooperative_closure(void); /** - * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason */ -void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); +struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); /** - * Creates a copy of the FixedPenaltyScorer + * Utility method to constructs a new FundingTimedOut-variant ClosureReason */ -struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); +struct LDKClosureReason ClosureReason_funding_timed_out(void); /** - * Creates a new scorer using `penalty_msat`. + * Utility method to constructs a new ProcessingError-variant ClosureReason */ -MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); +struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); /** - * 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 + * Utility method to constructs a new DisconnectedPeer-variant ClosureReason */ -struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +struct LDKClosureReason ClosureReason_disconnected_peer(void); /** - * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read + * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason */ -struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); +struct LDKClosureReason ClosureReason_outdated_channel_manager(void); /** - * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write + * Checks if two ClosureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); +bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); /** - * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. + * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read */ -void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); +struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); /** - * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL. + * Read a ClosureReason from a byte array, created by ClosureReason_write */ -void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); /** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat + * Frees any resources used by the HTLCDestination */ -uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +void HTLCDestination_free(struct LDKHTLCDestination this_ptr); /** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat + * Creates a copy of the HTLCDestination */ -void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * Default value: 8,192 msat - * - * [`base_penalty_msat`]: Self::base_penalty_msat + * Utility method to constructs a new NextHopChannel-variant HTLCDestination */ -uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id); /** - * A multiplier used with the payment amount to calculate a fixed penalty applied to each - * channel, in excess of the [`base_penalty_msat`]. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the payment amount. - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * Default value: 8,192 msat - * - * [`base_penalty_msat`]: Self::base_penalty_msat + * Utility method to constructs a new UnknownNextHop-variant HTLCDestination */ -void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for a payment, as determined by our latest estimates of the channel's - * liquidity, to determine the liquidity penalty. - * - * The penalty is based in part on the knowledge learned from prior successful and unsuccessful - * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The - * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to - * lower bounding the success probability to `0.01`) when the amount falls within the - * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will - * result in a `u64::max_value` penalty, however. - * - * `-log10(success_probability) * liquidity_penalty_multiplier_msat` - * - * Default value: 30,000 msat - * - * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life + * Utility method to constructs a new InvalidForward-variant HTLCDestination */ -uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for a payment, as determined by our latest estimates of the channel's - * liquidity, to determine the liquidity penalty. - * - * The penalty is based in part on the knowledge learned from prior successful and unsuccessful - * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The - * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to - * lower bounding the success probability to `0.01`) when the amount falls within the - * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will - * result in a `u64::max_value` penalty, however. - * - * `-log10(success_probability) * liquidity_penalty_multiplier_msat` - * - * Default value: 30,000 msat - * - * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life + * Utility method to constructs a new FailedPayment-variant HTLCDestination */ -void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); /** - * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, - * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on - * the available liquidity is halved and the upper-bound moves half-way to the channel's total - * capacity. - * - * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, - * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] - * struct documentation for more info on the way the liquidity bounds are used. - * - * For example, if the channel's capacity is 1 million sats, and the current upper and lower - * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper - * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. - * - * Default value: 6 hours - * - * # Note - * - * When built with the `no-std` feature, time will never elapse. Therefore, the channel - * liquidity knowledge will never decay except when the bounds cross. + * Checks if two HTLCDestinations contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b); /** - * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, - * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on - * the available liquidity is halved and the upper-bound moves half-way to the channel's total - * capacity. - * - * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, - * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] - * struct documentation for more info on the way the liquidity bounds are used. - * - * For example, if the channel's capacity is 1 million sats, and the current upper and lower - * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper - * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. - * - * Default value: 6 hours - * - * # Note - * - * When built with the `no-std` feature, time will never elapse. Therefore, the channel - * liquidity knowledge will never decay except when the bounds cross. + * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read + */ +struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); + +/** + * Read a HTLCDestination from a byte array, created by HTLCDestination_write */ -void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of - * the amount will result in a penalty of the multiplier. And, as the success probability - * decreases, the negative `log10` weighting will increase dramatically. For higher success - * probabilities, the multiplier will have a decreasing effect as the negative `log10` will - * fall below `1`. - * - * Default value: 192 msat + * Creates a copy of the PaymentFailureReason */ -uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig); /** - * A multiplier used in conjunction with a payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined by our latest estimates of the - * channel's liquidity, to determine the amount penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the - * success probability. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of - * the amount will result in a penalty of the multiplier. And, as the success probability - * decreases, the negative `log10` weighting will increase dramatically. For higher success - * probabilities, the multiplier will have a decreasing effect as the negative `log10` will - * fall below `1`. - * - * Default value: 192 msat + * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason */ -void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for the payment, as determined based on the history of our estimates of the - * channel's available liquidity, to determine a penalty. - * - * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using - * only our latest estimate for the current liquidity available in the channel, it estimates - * success probability based on the estimated liquidity available in the channel through - * history. Specifically, every time we update our liquidity bounds on a given channel, we - * track which of several buckets those bounds fall into, exponentially decaying the - * probability of each bucket as new samples are added. - * - * Default value: 10,000 msat - * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason */ -uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for the payment, as determined based on the history of our estimates of the - * channel's available liquidity, to determine a penalty. - * - * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using - * only our latest estimate for the current liquidity available in the channel, it estimates - * success probability based on the estimated liquidity available in the channel through - * history. Specifically, every time we update our liquidity bounds on a given channel, we - * track which of several buckets those bounds fall into, exponentially decaying the - * probability of each bucket as new samples are added. - * - * Default value: 10,000 msat - * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason */ -void ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. - * - * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead - * of using only our latest estimate for the current liquidity available in the channel, it - * estimates success probability based on the estimated liquidity available in the channel - * through history. Specifically, every time we update our liquidity bounds on a given - * channel, we track which of several buckets those bounds fall into, exponentially decaying - * the probability of each bucket as new samples are added. - * - * Default value: 64 msat - * - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason */ -uint64_t ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the payment, as determined based on the history of our - * estimates of the channel's available liquidity, to determine a penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and the `2^20`ths - * of the payment amount, weighted by the negative `log10` of the success probability. - * - * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead - * of using only our latest estimate for the current liquidity available in the channel, it - * estimates success probability based on the estimated liquidity available in the channel - * through history. Specifically, every time we update our liquidity bounds on a given - * channel, we track which of several buckets those bounds fall into, exponentially decaying - * the probability of each bucket as new samples are added. - * - * Default value: 64 msat - * - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason */ -void ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void); /** - * If we aren't learning any new datapoints for a channel, the historical liquidity bounds - * tracking can simply live on with increasingly stale data. Instead, when a channel has not - * seen a liquidity estimate update for this amount of time, the historical datapoints are - * decayed by half. - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days + * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason */ -uint64_t ProbabilisticScoringParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void); /** - * If we aren't learning any new datapoints for a channel, the historical liquidity bounds - * tracking can simply live on with increasingly stale data. Instead, when a channel has not - * seen a liquidity estimate update for this amount of time, the historical datapoints are - * decayed by half. - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days + * Checks if two PaymentFailureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ProbabilisticScoringParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b); /** - * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We - * treat such nodes preferentially as this makes balance discovery attacks harder to execute, - * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. - * - * Default value: 250 msat + * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read */ -uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj); /** - * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We - * treat such nodes preferentially as this makes balance discovery attacks harder to execute, - * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. - * - * Default value: 250 msat + * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write */ -void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. - * - * Note that in this case all other penalties, including the - * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based - * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if - * applicable, are still included in the overall penalty. - * - * If you wish to avoid creating paths with such channels entirely, setting this to a value of - * `u64::max_value()` will guarantee that. - * - * Default value: 1_0000_0000_000 msat (1 Bitcoin) - * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + * Frees any resources used by the Event */ -uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +void Event_free(struct LDKEvent this_ptr); /** - * This penalty is applied when the amount we're attempting to send over a channel exceeds our - * current estimate of the channel's available liquidity. - * - * Note that in this case all other penalties, including the - * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based - * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if - * applicable, are still included in the overall penalty. - * - * If you wish to avoid creating paths with such channels entirely, setting this to a value of - * `u64::max_value()` will guarantee that. - * - * Default value: 1_0000_0000_000 msat (1 Bitcoin) - * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + * Creates a copy of the Event */ -void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** - * Creates a copy of the ProbabilisticScoringParameters + * Utility method to constructs a new FundingGenerationReady-variant Event */ -struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig); +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); /** - * Creates a new scorer using the given scoring parameters for sending payments from a node - * through a network graph. + * Utility method to constructs a new PaymentClaimable-variant Event */ -MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); /** - * Dump the contents of this scorer into the configured logger. - * - * Note that this writes roughly one line per channel for which we have a liquidity estimate, - * which may be a substantial amount of log output. + * Utility method to constructs a new PaymentClaimed-variant Event */ -void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); /** - * Query the estimated minimum and maximum liquidity available for sending a payment over the - * channel with `scid` towards the given `target` node. + * Utility method to constructs a new PaymentSent-variant Event */ -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); +struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); /** - * Marks the node with the given `node_id` as banned, i.e., - * it will be avoided during path finding. + * Utility method to constructs a new PaymentFailed-variant Event */ -void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); /** - * Removes the node with the given `node_id` from the list of nodes to avoid. + * Utility method to constructs a new PaymentPathSuccessful-variant Event */ -void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); /** - * Sets a manual penalty for the given node. + * Utility method to constructs a new PaymentPathFailed-variant Event */ -void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); +struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** - * Removes the node with the given `node_id` from the list of manual penalties. + * Utility method to constructs a new ProbeSuccessful-variant Event */ -void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); /** - * Clears the list of manual penalties that are applied during path finding. + * Utility method to constructs a new ProbeFailed-variant Event */ -void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** - * Marks all nodes in the given list as banned, i.e., - * they will be avoided during path finding. + * Utility method to constructs a new PendingHTLCsForwardable-variant Event */ -void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); +struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); /** - * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. + * Utility method to constructs a new HTLCIntercepted-variant Event */ -MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); +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); /** - * 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 + * Utility method to constructs a new SpendableOutputs-variant Event */ -struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); /** - * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read + * Utility method to constructs a new PaymentForwarded-variant Event */ -struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); +struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** - * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write + * Utility method to constructs a new ChannelPending-variant Event */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); +struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKThirtyTwoBytes former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); /** - * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new ChannelReady-variant Event */ -void BlindedPath_free(struct LDKBlindedPath this_obj); +struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); /** - * Creates a copy of the BlindedPath + * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig); +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); /** - * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new DiscardFunding-variant Event */ -void BlindedHop_free(struct LDKBlindedHop this_obj); +struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); /** - * Creates a copy of the BlindedHop + * Utility method to constructs a new OpenChannelRequest-variant Event */ -struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); +struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type); /** - * 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. + * Utility method to constructs a new HTLCHandlingFailed-variant Event */ -MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager); +struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); /** - * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read + * Checks if two Events contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); +bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); /** - * Read a BlindedPath from a byte array, created by BlindedPath_write + * Serialize the Event object into a byte array which can be read by Event_read */ -struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); +struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); /** - * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read + * Read a Event from a byte array, created by Event_write */ -struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); +struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); /** - * Read a BlindedHop from a byte array, created by BlindedHop_write + * Frees any resources used by the MessageSendEvent */ -struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); +void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); /** - * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. + * Creates a copy of the MessageSendEvent */ -void OnionMessenger_free(struct LDKOnionMessenger this_obj); +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); /** - * Frees any resources used by the Destination + * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent */ -void Destination_free(struct LDKDestination this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); /** - * Creates a copy of the Destination + * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent */ -struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); /** - * Utility method to constructs a new Node-variant Destination + * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent */ -struct LDKDestination Destination_node(struct LDKPublicKey a); +struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); /** - * Utility method to constructs a new BlindedPath-variant Destination + * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent */ -struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); +struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); /** - * Frees any resources used by the SendError + * Utility method to constructs a new SendChannelReady-variant MessageSendEvent */ -void SendError_free(struct LDKSendError this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); /** - * Creates a copy of the SendError + * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent */ -struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); /** - * Utility method to constructs a new Secp256k1-variant SendError + * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent */ -struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a); +struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); /** - * Utility method to constructs a new TooBigPacket-variant SendError + * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent */ -struct LDKSendError SendError_too_big_packet(void); +struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); /** - * Utility method to constructs a new TooFewBlindedHops-variant SendError + * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent */ -struct LDKSendError SendError_too_few_blinded_hops(void); +struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); /** - * Utility method to constructs a new InvalidFirstHop-variant SendError + * Utility method to constructs a new SendShutdown-variant MessageSendEvent */ -struct LDKSendError SendError_invalid_first_hop(void); +struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); /** - * Utility method to constructs a new InvalidMessage-variant SendError + * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent */ -struct LDKSendError SendError_invalid_message(void); +struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); /** - * Utility method to constructs a new BufferFull-variant SendError + * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent */ -struct LDKSendError SendError_buffer_full(void); +struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * Utility method to constructs a new GetNodeIdFailed-variant SendError + * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent */ -struct LDKSendError SendError_get_node_id_failed(void); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError + * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent */ -struct LDKSendError SendError_blinded_path_advance_failed(void); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); /** - * Checks if two SendErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent */ -bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b); +struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); /** - * Calls the free function if one is set + * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent */ -void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); /** - * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to - * their respective handlers. + * Utility method to constructs a new HandleError-variant MessageSendEvent */ -MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); +struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); /** - * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`. - * See [`OnionMessenger`] for example usage. - * - * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent */ -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); +struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); /** - * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is + * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent */ -struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); /** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is + * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent */ -struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); /** - * Frees any resources used by the OnionMessageContents + * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent */ -void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); /** - * Utility method to constructs a new Custom-variant OnionMessageContents + * Calls the free function if one is set */ -struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); +void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); /** * Calls the free function if one is set */ -void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr); +void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr); + +/** + * Calls the free function if one is set + */ +void EventsProvider_free(struct LDKEventsProvider this_ptr); + +/** + * Calls the free function if one is set + */ +void EventHandler_free(struct LDKEventHandler this_ptr); /** * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL. @@ -31484,7 +34771,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. @@ -31735,7 +35022,7 @@ bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig); /** - * Checks if two Invoices contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the Invoice. */ uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o); @@ -31757,7 +35044,7 @@ bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig); /** - * Checks if two SignedRawInvoices contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the SignedRawInvoice. */ uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o); @@ -31789,7 +35076,7 @@ bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRa struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig); /** - * Checks if two RawInvoices contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the RawInvoice. */ uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o); @@ -31821,7 +35108,7 @@ bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDK struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig); /** - * Checks if two RawDataParts contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the RawDataPart. */ uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o); @@ -31843,7 +35130,7 @@ bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, cons struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig); /** - * Checks if two PositiveTimestamps contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp. */ uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o); @@ -31879,7 +35166,7 @@ enum LDKSiPrefix SiPrefix_pico(void); bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b); /** - * Checks if two SiPrefixs contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the SiPrefix. */ uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o); @@ -31920,7 +35207,7 @@ enum LDKCurrency Currency_simnet(void); enum LDKCurrency Currency_signet(void); /** - * Checks if two Currencys contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the Currency. */ uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o); @@ -31941,7 +35228,7 @@ void Sha256_free(struct LDKSha256 this_obj); struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig); /** - * Checks if two Sha256s contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the Sha256. */ uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o); @@ -31952,6 +35239,12 @@ uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o); */ bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b); +/** + * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a + * single sha256 hash. + */ +MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]); + /** * Frees any resources used by the Description, if is_owned is set and inner is non-NULL. */ @@ -31963,7 +35256,7 @@ void Description_free(struct LDKDescription this_obj); struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig); /** - * Checks if two Descriptions contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the Description. */ uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o); @@ -31994,7 +35287,7 @@ MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg); struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig); /** - * Checks if two PayeePubKeys contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the PayeePubKey. */ uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o); @@ -32016,7 +35309,7 @@ void ExpiryTime_free(struct LDKExpiryTime this_obj); struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig); /** - * Checks if two ExpiryTimes contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the ExpiryTime. */ uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o); @@ -32028,35 +35321,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. + * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta. */ -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 @@ -32071,7 +35364,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 LDKWitnessVersion version, struct LDKCVec_u8Z program); /** * Utility method to constructs a new PubKeyHash-variant Fallback @@ -32084,7 +35377,7 @@ struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a); struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a); /** - * Checks if two Fallbacks contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the Fallback. */ uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o); @@ -32105,7 +35398,7 @@ void InvoiceSignature_free(struct LDKInvoiceSignature this_obj); struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig); /** - * Checks if two InvoiceSignatures contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the InvoiceSignature. */ uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o); @@ -32127,7 +35420,7 @@ void PrivateRoute_free(struct LDKPrivateRoute this_obj); struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig); /** - * Checks if two PrivateRoutes contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the PrivateRoute. */ uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o); @@ -32147,17 +35440,17 @@ bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct L MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg); /** - * The `RawInvoice` which was signed. + * The [`RawInvoice`] which was signed. */ MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg); /** - * The hash of the `RawInvoice` that was signed. + * The hash of the [`RawInvoice`] that was signed. */ MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32]; /** - * InvoiceSignature for the invoice. + * Signature for the invoice. */ MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg); @@ -32211,7 +35504,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); /** * @@ -32219,6 +35512,8 @@ MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const */ MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawInvoice_payment_metadata(const struct LDKRawInvoice *NONNULL_PTR this_arg); + /** * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -32273,6 +35568,11 @@ MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDK */ MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); +/** + * The hash of the [`RawInvoice`] that was signed. + */ +MUST_USE_RES struct LDKThirtyTwoBytes Invoice_signable_hash(const struct LDKInvoice *NONNULL_PTR this_arg); + /** * Transform the `Invoice` into it's unchecked version */ @@ -32284,7 +35584,7 @@ MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoic MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg); /** - * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants. + * Constructs an `Invoice` from a [`SignedRawInvoice`] by checking all its invariants. * ``` * use lightning_invoice::*; * @@ -32334,6 +35634,11 @@ MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice * */ MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32]; +/** + * Get the payment metadata blob if one was included in the invoice + */ +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Invoice_payment_metadata(const struct LDKInvoice *NONNULL_PTR this_arg); + /** * Get the invoice features if they were included in the invoice * @@ -32346,6 +35651,12 @@ MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice */ MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg); +/** + * Returns the Duration since the Unix epoch at which the invoice expires. + * Returning None if overflow occurred. + */ +MUST_USE_RES struct LDKCOption_DurationZ Invoice_expires_at(const struct LDKInvoice *NONNULL_PTR this_arg); + /** * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. */ @@ -32356,6 +35667,17 @@ MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR t */ MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg); +/** + * Returns the Duration remaining until the invoice expires. + */ +MUST_USE_RES uint64_t Invoice_duration_until_expiry(const struct LDKInvoice *NONNULL_PTR this_arg); + +/** + * Returns the Duration remaining until the invoice expires given the current time. + * `time` is the timestamp as a duration since the Unix epoch. + */ +MUST_USE_RES uint64_t Invoice_expiration_remaining_from_epoch(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t time); + /** * Returns whether the expiry time would pass at the given point in time. * `at_time` is the timestamp as a duration since the Unix epoch. @@ -32363,10 +35685,15 @@ 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_delta(const struct LDKInvoice *NONNULL_PTR this_arg); + +/** + * Returns a list of all fallback addresses as [`Address`]es */ -MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_AddressZ Invoice_fallback_addresses(const struct LDKInvoice *NONNULL_PTR this_arg); /** * Returns a list of all routes included in the invoice @@ -32390,14 +35717,14 @@ MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct L /** * Creates a new `Description` if `description` is at most 1023 __bytes__ long, - * returns `CreationError::DescriptionTooLong` otherwise + * returns [`CreationError::DescriptionTooLong`] otherwise * * Please note that single characters may use more than one byte due to UTF8 encoding. */ MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description); /** - * Returns the underlying description `String` + * Returns the underlying description [`String`] */ MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg); @@ -32407,7 +35734,7 @@ MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds); /** - * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part. + * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part. */ MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration); @@ -32417,7 +35744,7 @@ MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration); MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg); /** - * Returns a reference to the underlying `Duration` (=expiry time) + * Returns a reference to the underlying [`Duration`] (=expiry time) */ MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg); @@ -32461,6 +35788,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. @@ -32570,94 +35902,18 @@ 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); - -/** - * 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); - -/** - * Frees any resources used by the PaymentError - */ -void PaymentError_free(struct LDKPaymentError this_ptr); - -/** - * Creates a copy of the PaymentError - */ -struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Invoice-variant PaymentError - */ -struct LDKPaymentError PaymentError_invoice(struct LDKStr a); - -/** - * Utility method to constructs a new Routing-variant PaymentError - */ -struct LDKPaymentError PaymentError_routing(struct LDKLightningError a); - -/** - * Utility method to constructs a new Sending-variant PaymentError - */ -struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); - -/** - * Creates an invoice payer that retries failed payment paths. - * - * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once - * `retry` 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. + * 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 - * [`Self::pay_invoice_with_id`]. + * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); +struct LDKCResult_PaymentIdPaymentErrorZ pay_invoice(const struct LDKInvoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); /** - * Pays the given [`Invoice`] with a custom idempotency key, caching the invoice for later use - * in case a retry is needed. + * 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. @@ -32665,27 +35921,26 @@ MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(c * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] * has never been paid before. * - * See [`Self::pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency - * token. + * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. */ -MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id); +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); /** - * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in - * case a retry is needed. + * 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 - * [`Self::pay_zero_value_invoice_with_id`]. + * [`pay_zero_value_invoice_with_id`]. */ -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); +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); /** * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key, - * caching the invoice for later use in case a retry is needed. + * , 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. @@ -32693,46 +35948,30 @@ MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_valu * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] * has never been paid before. * - * See [`Self::pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the + * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the * idempotency token. */ -MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_zero_value_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); +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); /** - * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in - * case a retry is needed. - * - * The hash of the [`PaymentPreimage`] 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 [`PaymentPreimage`] is never sent. + * Frees any resources used by the PaymentError */ -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); +void PaymentError_free(struct LDKPaymentError this_ptr); /** - * Pays `pubkey` an amount using the hash of the given preimage and a custom idempotency key, - * caching the invoice for later use in case a retry is needed. - * - * 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 [`PaymentPreimage`] is unique and the corresponding - * [`PaymentHash`] has never been paid before. + * Creates a copy of the PaymentError */ -MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_pubkey_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); +struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new Invoice-variant PaymentError */ -void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +struct LDKPaymentError PaymentError_invoice(struct LDKStr a); /** - * 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 + * Utility method to constructs a new Sending-variant PaymentError */ -struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); +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.\" @@ -32755,7 +35994,14 @@ struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer * `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). * @@ -32764,10 +36010,14 @@ struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer * [`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.\" @@ -32792,7 +36042,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). * @@ -32802,9 +36054,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 @@ -32815,8 +36070,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 @@ -32828,22 +36090,29 @@ 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); +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); /** * See [`create_invoice_from_channelmanager_and_duration_since_epoch`] @@ -32851,13 +36120,7 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager * 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 LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(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, struct LDKThirtyTwoBytes payment_hash); - -/** - * Constructs a new Payer which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is - */ -struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg); +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 @@ -32912,17 +36175,16 @@ 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 + * `current_time_unix`: `Option` optional current timestamp to verify data age */ -MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data); +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.