X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=e70de6ff9669467b576305884e32e168c07c7ded;hb=HEAD;hp=cc60687eb4030fe31af1566e135f190410347582;hpb=5502fccd64611f16f5ebba3759c68b1a4d69b537;p=ldk-c-bindings diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index cc60687..9076f1a 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -10,6 +10,54 @@ #include #include "ldk_rust_types.h" +/** + * Indicates whether the balance is derived from a cooperative close, a force-close + * (for holder or counterparty), or whether it is for an HTLC. + */ +typedef enum LDKBalanceSource { + /** + * The channel was force closed by the holder. + */ + LDKBalanceSource_HolderForceClosed, + /** + * The channel was force closed by the counterparty. + */ + LDKBalanceSource_CounterpartyForceClosed, + /** + * The channel was cooperatively closed. + */ + LDKBalanceSource_CoopClose, + /** + * This balance is the result of an HTLC. + */ + LDKBalanceSource_Htlc, + /** + * Must be last for serialization purposes + */ + LDKBalanceSource_Sentinel, +} LDKBalanceSource; + +/** + * Whether this blinded HTLC is being failed backwards by the introduction node or a blinded node, + * which determines the failure message that should be used. + */ +typedef enum LDKBlindedFailure { + /** + * This HTLC is being failed backwards by the introduction node, and thus should be failed with + * [`msgs::UpdateFailHTLC`] and error code `0x8000|0x4000|24`. + */ + LDKBlindedFailure_FromIntroductionNode, + /** + * This HTLC is being failed backwards by a blinded node within the path, and thus should be + * failed with [`msgs::UpdateFailMalformedHTLC`] and error code `0x8000|0x4000|24`. + */ + LDKBlindedFailure_FromBlindedNode, + /** + * Must be last for serialization purposes + */ + LDKBlindedFailure_Sentinel, +} LDKBlindedFailure; + /** * Errors that may occur when converting a [`RawBolt11Invoice`] to a [`Bolt11Invoice`]. They relate to * the requirements sections in BOLT #11 @@ -158,6 +206,10 @@ typedef enum LDKBolt12SemanticError { * Blinded paths were expected but were missing. */ LDKBolt12SemanticError_MissingPaths, + /** + * Blinded paths were provided but were not expected. + */ + LDKBolt12SemanticError_UnexpectedPaths, /** * The blinded payinfo given does not match the number of blinded path hops. */ @@ -170,6 +222,10 @@ typedef enum LDKBolt12SemanticError { * An invoice payment hash was expected but was missing. */ LDKBolt12SemanticError_MissingPaymentHash, + /** + * An invoice payment hash was provided but was not expected. + */ + LDKBolt12SemanticError_UnexpectedPaymentHash, /** * A signature was expected but was missing. */ @@ -320,31 +376,22 @@ typedef enum LDKChannelShutdownState { */ typedef enum LDKConfirmationTarget { /** - * We have some funds available on chain which we need to spend prior to some expiry time at - * which point our counterparty may be able to steal them. Generally we have in the high tens - * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a - * fee - this should be a relatively high priority feerate. + * The most aggressive (i.e. highest) feerate estimate available. + * + * This is used to sanity-check our counterparty's feerates and should be as conservative as + * possible to ensure that we don't confuse a peer using a very conservative estimator for one + * trying to burn channel balance to dust. */ - LDKConfirmationTarget_OnChainSweep, + LDKConfirmationTarget_MaximumFeeEstimate, /** - * The highest feerate we will allow our channel counterparty to have in a non-anchor channel. - * - * This is the feerate on the transaction which we (or our counterparty) will broadcast in - * order to close the channel unilaterally. Because our counterparty must ensure they can - * always broadcast the latest state, this value being too low will cause immediate - * force-closures. - * - * Allowing this value to be too high can allow our counterparty to burn our HTLC outputs to - * dust, which can result in HTLCs failing or force-closures (when the dust HTLCs exceed - * [`ChannelConfig::max_dust_htlc_exposure`]). - * - * Because most nodes use a feerate estimate which is based on a relatively high priority - * transaction entering the current mempool, setting this to a small multiple of your current - * high priority feerate estimate should suffice. + * We have some funds available on chain which we need to spend prior to some expiry time at + * which point our counterparty may be able to steal them. * - * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure + * Generally we have in the high tens to low hundreds of blocks to get our transaction + * on-chain (it doesn't have to happen in the next few blocks!), but we shouldn't risk too low + * a fee - this should be a relatively high priority feerate. */ - LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee, + LDKConfirmationTarget_UrgentOnChainSweep, /** * This is the lowest feerate we will allow our channel counterparty to have in an anchor * channel in order to close the channel if a channel party goes away. @@ -425,6 +472,23 @@ typedef enum LDKConfirmationTarget { * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script */ LDKConfirmationTarget_ChannelCloseMinimum, + /** + * The feerate used to claim on-chain funds when there is no particular urgency to do so. + * + * It is used to get commitment transactions without any HTLCs confirmed in [`ChannelMonitor`] + * and by [`OutputSweeper`] on transactions spending [`SpendableOutputDescriptor`]s after a + * channel closure. + * + * Generally spending these outputs is safe as long as they eventually confirm, so a value + * (slightly above) the mempool minimum should suffice. However, as this value will influence + * how long funds will be unavailable after channel closure, [`FeeEstimator`] implementors + * might want to choose a higher feerate to regain control over funds faster. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`OutputSweeper`]: crate::util::sweep::OutputSweeper + * [`SpendableOutputDescriptor`]: crate::sign::SpendableOutputDescriptor + */ + LDKConfirmationTarget_OutputSpendingFee, /** * Must be last for serialization purposes */ @@ -452,16 +516,11 @@ typedef enum LDKCreationError { */ LDKCreationError_InvalidAmount, /** - * Route hints were required for this invoice and were missing. Applies to - * [phantom invoices]. - * - * [phantom invoices]: crate::utils::create_phantom_invoice + * Route hints were required for this invoice and were missing. */ 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 + * The provided `min_final_cltv_expiry_delta` was less than rust-lightning's minimum. */ LDKCreationError_MinFinalCltvExpiryDeltaTooShort, /** @@ -500,6 +559,28 @@ typedef enum LDKCurrency { LDKCurrency_Sentinel, } LDKCurrency; +/** + * The side of a channel that is the [`IntroductionNode`] in a blinded path. [BOLT 7] defines which + * nodes is which in the [`ChannelAnnouncement`] message. + * + * [BOLT 7]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message + * [`ChannelAnnouncement`]: crate::ln::msgs::ChannelAnnouncement + */ +typedef enum LDKDirection { + /** + * The lesser node id when compared lexicographically in ascending order. + */ + LDKDirection_NodeOne, + /** + * The greater node id when compared lexicographically in ascending order. + */ + LDKDirection_NodeTwo, + /** + * Must be last for serialization purposes + */ + LDKDirection_Sentinel, +} LDKDirection; + /** * Describes the type of HTLC claim as determined by analyzing the witness. */ @@ -558,6 +639,58 @@ typedef enum LDKIOError { LDKIOError_Sentinel, } LDKIOError; +/** + * Exposes the state of pending inbound HTLCs. + * + * At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes + * through the following states in the state machine: + * - Announced for addition by the originating node through the update_add_htlc message. + * - Added to the commitment transaction of the receiving node and originating node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * - Announced for resolution (fulfillment or failure) by the receiving node through either one of + * the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. + * - Removed from the commitment transaction of the originating node and receiving node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * + * This can be used to inspect what next message an HTLC is waiting for to advance its state. + */ +typedef enum LDKInboundHTLCStateDetails { + /** + * We have added this HTLC in our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * before this HTLC is included on the remote commitment transaction. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd, + /** + * This HTLC has been included in the commitment_signed and revoke_and_ack messages on both sides + * and is included in both commitment transactions. + * + * This HTLC is now safe to either forward or be claimed as a payment by us. The HTLC will + * remain in this state until the forwarded upstream HTLC has been resolved and we resolve this + * HTLC correspondingly, or until we claim it as a payment. If it is part of a multipart + * payment, it will only be claimed together with other required parts. + */ + LDKInboundHTLCStateDetails_Committed, + /** + * We have received the preimage for this HTLC and it is being removed by fulfilling it with + * update_fulfill_htlc. This HTLC is still on both commitment transactions, but we are awaiting + * the appropriate revoke_and_ack's from the remote before this HTLC is removed from the remote + * commitment transaction after update_fulfill_htlc. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill, + /** + * The HTLC is being removed by failing it with update_fail_htlc or update_fail_malformed_htlc. + * This HTLC is still on both commitment transactions, but we are awaiting the appropriate + * revoke_and_ack's from the remote before this HTLC is removed from the remote commitment + * transaction. + */ + LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail, + /** + * Must be last for serialization purposes + */ + LDKInboundHTLCStateDetails_Sentinel, +} LDKInboundHTLCStateDetails; + /** * An enum representing the available verbosity levels of the logger. */ @@ -618,12 +751,67 @@ typedef enum LDKNetwork { LDKNetwork_Sentinel, } LDKNetwork; +/** + * Exposes the state of pending outbound HTLCs. + * + * At a high level, an HTLC being forwarded from one Lightning node to another Lightning node goes + * through the following states in the state machine: + * - Announced for addition by the originating node through the update_add_htlc message. + * - Added to the commitment transaction of the receiving node and originating node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * - Announced for resolution (fulfillment or failure) by the receiving node through either one of + * the update_fulfill_htlc, update_fail_htlc, and update_fail_malformed_htlc messages. + * - Removed from the commitment transaction of the originating node and receiving node in turn + * through the exchange of commitment_signed and revoke_and_ack messages. + * + * This can be used to inspect what next message an HTLC is waiting for to advance its state. + */ +typedef enum LDKOutboundHTLCStateDetails { + /** + * We are awaiting the appropriate revoke_and_ack's from the remote before the HTLC is added + * on the remote's commitment transaction after update_add_htlc. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd, + /** + * The HTLC has been added to the remote's commitment transaction by sending commitment_signed + * and receiving revoke_and_ack in return. + * + * The HTLC will remain in this state until the remote node resolves the HTLC, or until we + * unilaterally close the channel due to a timeout with an uncooperative remote node. + */ + LDKOutboundHTLCStateDetails_Committed, + /** + * The HTLC has been fulfilled successfully by the remote with a preimage in update_fulfill_htlc, + * and we removed the HTLC from our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * for the removal from its commitment transaction. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess, + /** + * The HTLC has been failed by the remote with update_fail_htlc or update_fail_malformed_htlc, + * and we removed the HTLC from our commitment transaction by receiving commitment_signed and + * returning revoke_and_ack. We are awaiting the appropriate revoke_and_ack's from the remote + * for the removal from its commitment transaction. + */ + LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure, + /** + * Must be last for serialization purposes + */ + LDKOutboundHTLCStateDetails_Sentinel, +} LDKOutboundHTLCStateDetails; + /** * The reason the payment failed. Used in [`Event::PaymentFailed`]. */ typedef enum LDKPaymentFailureReason { /** * The intended recipient rejected our payment. + * + * Also used for [`UnknownRequiredFeatures`] and [`InvoiceRequestRejected`] when downgrading to + * version prior to 0.0.124. + * + * [`UnknownRequiredFeatures`]: Self::UnknownRequiredFeatures + * [`InvoiceRequestRejected`]: Self::InvoiceRequestRejected */ LDKPaymentFailureReason_RecipientRejected, /** @@ -645,11 +833,18 @@ typedef enum LDKPaymentFailureReason { * The payment expired while retrying, based on the provided * [`PaymentParameters::expiry_time`]. * + * Also used for [`InvoiceRequestExpired`] when downgrading to version prior to 0.0.124. + * * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + * [`InvoiceRequestExpired`]: Self::InvoiceRequestExpired */ LDKPaymentFailureReason_PaymentExpired, /** * We failed to find a route while retrying the payment. + * + * Note that this generally indicates that we've exhausted the available set of possible + * routes - we tried the payment over a few routes but were not able to find any further + * candidate routes beyond those. */ LDKPaymentFailureReason_RouteNotFound, /** @@ -657,6 +852,20 @@ typedef enum LDKPaymentFailureReason { * your router. */ LDKPaymentFailureReason_UnexpectedError, + /** + * An invoice was received that required unknown features. + */ + LDKPaymentFailureReason_UnknownRequiredFeatures, + /** + * A [`Bolt12Invoice`] was not received in a reasonable amount of time. + */ + LDKPaymentFailureReason_InvoiceRequestExpired, + /** + * An [`InvoiceRequest`] for the payment was rejected by the recipient. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + LDKPaymentFailureReason_InvoiceRequestRejected, /** * Must be last for serialization purposes */ @@ -716,6 +925,14 @@ typedef enum LDKRetryableSendFailure { * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed */ LDKRetryableSendFailure_DuplicatePayment, + /** + * The [`RecipientOnionFields::payment_metadata`], [`RecipientOnionFields::custom_tlvs`], or + * [`BlindedPaymentPath`]s provided are too large and caused us to exceed the maximum onion + * packet size of 1300 bytes. + * + * [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath + */ + LDKRetryableSendFailure_OnionPacketSizeExceeded, /** * Must be last for serialization purposes */ @@ -770,12 +987,38 @@ typedef enum LDKSecp256k1Error { * The only valid parity values are 0 or 1. */ LDKSecp256k1Error_InvalidParityValue, + /** + * Invalid Elligator Swift Value + */ + LDKSecp256k1Error_InvalidEllSwift, /** * Must be last for serialization purposes */ LDKSecp256k1Error_Sentinel, } LDKSecp256k1Error; +/** + * A `short_channel_id` construction error + */ +typedef enum LDKShortChannelIdError { + /** + * Block height too high + */ + LDKShortChannelIdError_BlockOverflow, + /** + * Tx index too high + */ + LDKShortChannelIdError_TxIndexOverflow, + /** + * Vout index too high + */ + LDKShortChannelIdError_VoutIndexOverflow, + /** + * Must be last for serialization purposes + */ + LDKShortChannelIdError_Sentinel, +} LDKShortChannelIdError; + /** * SI prefixes for the human readable part */ @@ -888,6 +1131,52 @@ typedef struct LDKU128 { uint8_t le_bytes[16]; } LDKU128; +/** + * Integer in the range `0..=16` + */ +typedef struct LDKWitnessVersion { + uint8_t _0; +} LDKWitnessVersion; + +/** + * A dynamically-allocated array of u8s of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_u8Z { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + uint8_t *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_u8Z; + +/** + * A segregated witness version byte and script bytes + */ +typedef struct LDKWitnessProgram { + struct LDKWitnessVersion version; + struct LDKCVec_u8Z program; +} LDKWitnessProgram; + +/** + * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not + * own the memory pointed to by data. + */ +typedef struct LDKu8slice { + /** + * A pointer to the byte buffer + */ + const uint8_t *data; + /** + * The number of bytes pointed to by `data`. + */ + uintptr_t datalen; +} LDKu8slice; + /** * Represents a scalar value between zero and the secp256k1 curve order, in big endian. */ @@ -1011,22 +1300,6 @@ typedef struct LDKWitness { bool data_is_owned; } LDKWitness; -/** - * A dynamically-allocated array of u8s of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_u8Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - uint8_t *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_u8Z; - /** * An input to a transaction. * @@ -1072,6 +1345,123 @@ typedef struct LDKTxOut { uint64_t value; } LDKTxOut; + + +/** + * Builds a [`Refund`] for the \"offer for money\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKRefundMaybeWithDerivedMetadataBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRefundMaybeWithDerivedMetadataBuilder *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; +} LDKRefundMaybeWithDerivedMetadataBuilder; + +/** + * The contents of CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRefundMaybeWithDerivedMetadataBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ; + + + +/** + * A `Refund` is a request to send an [`Bolt12Invoice`] 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. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`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; + +/** + * The contents of CResult_RefundBolt12SemanticErrorZ + */ +typedef union LDKCResult_RefundBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRefund *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_RefundBolt12SemanticErrorZPtr; + +/** + * A CResult_RefundBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::refund::Refund on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RefundBolt12SemanticErrorZ { + /** + * The contents of this CResult_RefundBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RefundBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_RefundBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RefundBolt12SemanticErrorZ; + /** * An enum which can either contain a u64 or not */ @@ -1102,66 +1492,137 @@ typedef struct LDKCOption_u64Z { /** - * Onion messages and payments can be sent and received to blinded paths, which serve to hide the - * identity of the recipient. + * A blinded path to be used for sending or receiving a message, hiding the identity of the + * recipient. */ -typedef struct MUST_USE_STRUCT LDKBlindedPath { +typedef struct MUST_USE_STRUCT LDKBlindedMessagePath { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeBlindedMessagePath *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; +} LDKBlindedMessagePath; /** - * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size. + * A dynamically-allocated array of crate::lightning::blinded_path::message::BlindedMessagePaths of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_BlindedPathZ { +typedef struct LDKCVec_BlindedMessagePathZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKBlindedPath *data; + struct LDKBlindedMessagePath *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_BlindedPathZ; +} LDKCVec_BlindedMessagePathZ; +/** + * An error in decoding a message or struct. + */ +typedef enum LDKDecodeError_Tag { + /** + * A version byte specified something we don't know how to handle. + * + * Includes unknown realm byte in an onion hop data packet. + */ + LDKDecodeError_UnknownVersion, + /** + * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) + */ + LDKDecodeError_UnknownRequiredFeature, + /** + * Value was invalid. + * + * For example, a byte which was supposed to be a bool was something other than a 0 + * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was + * syntactically incorrect, etc. + */ + LDKDecodeError_InvalidValue, + /** + * The buffer to be read was too short. + */ + LDKDecodeError_ShortRead, + /** + * A length descriptor in the packet didn't describe the later data correctly. + */ + LDKDecodeError_BadLengthDescriptor, + /** + * Error from [`std::io`]. + */ + LDKDecodeError_Io, + /** + * The message included zlib-compressed values, which we don't support. + */ + LDKDecodeError_UnsupportedCompression, + /** + * Value is validly encoded but is dangerous to use. + * + * This is used for things like [`ChannelManager`] deserialization where we want to ensure + * that we don't use a [`ChannelManager`] which is in out of sync with the [`ChannelMonitor`]. + * This indicates that there is a critical implementation flaw in the storage implementation + * and it's unsafe to continue. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + LDKDecodeError_DangerousValue, + /** + * Must be last for serialization purposes + */ + LDKDecodeError_Sentinel, +} LDKDecodeError_Tag; +typedef struct MUST_USE_STRUCT LDKDecodeError { + LDKDecodeError_Tag tag; + union { + struct { + enum LDKIOError io; + }; + }; +} LDKDecodeError; /** - * A `Refund` is a request to send an [`Bolt12Invoice`] 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. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Offer`]: crate::offers::offer::Offer + * The contents of CResult_RefundDecodeErrorZ */ -typedef struct MUST_USE_STRUCT LDKRefund { +typedef union LDKCResult_RefundDecodeErrorZPtr { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKnativeRefund *inner; + struct LDKRefund *result; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool is_owned; -} LDKRefund; + struct LDKDecodeError *err; +} LDKCResult_RefundDecodeErrorZPtr; + +/** + * A CResult_RefundDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::refund::Refund 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_RefundDecodeErrorZ { + /** + * The contents of this CResult_RefundDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RefundDecodeErrorZPtr contents; + /** + * Whether this CResult_RefundDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RefundDecodeErrorZ; @@ -1253,59 +1714,6 @@ typedef struct MUST_USE_STRUCT LDKRetry { }; } LDKRetry; -/** - * An error in decoding a message or struct. - */ -typedef enum LDKDecodeError_Tag { - /** - * A version byte specified something we don't know how to handle. - * - * Includes unknown realm byte in an onion hop data packet. - */ - LDKDecodeError_UnknownVersion, - /** - * Unknown feature mandating we fail to parse message (e.g., TLV with an even, unknown type) - */ - LDKDecodeError_UnknownRequiredFeature, - /** - * Value was invalid. - * - * For example, a byte which was supposed to be a bool was something other than a 0 - * or 1, a public key/private key/signature was invalid, text wasn't UTF-8, TLV was - * syntactically incorrect, etc. - */ - LDKDecodeError_InvalidValue, - /** - * The buffer to be read was too short. - */ - LDKDecodeError_ShortRead, - /** - * A length descriptor in the packet didn't describe the later data correctly. - */ - LDKDecodeError_BadLengthDescriptor, - /** - * Error from [`std::io`]. - */ - LDKDecodeError_Io, - /** - * The message included zlib-compressed values, which we don't support. - */ - LDKDecodeError_UnsupportedCompression, - /** - * Must be last for serialization purposes - */ - LDKDecodeError_Sentinel, -} LDKDecodeError_Tag; - -typedef struct MUST_USE_STRUCT LDKDecodeError { - LDKDecodeError_Tag tag; - union { - struct { - enum LDKIOError io; - }; - }; -} LDKDecodeError; - /** * The contents of CResult_RetryDecodeErrorZ */ @@ -1702,6 +2110,182 @@ typedef struct LDKCResult_RecipientOnionFieldsNoneZ { bool result_ok; } LDKCResult_RecipientOnionFieldsNoneZ; + + +/** + * A semantically valid [`Bolt12Invoice`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedBolt12Invoice *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKUnsignedBolt12Invoice; + +/** + * The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ + */ +typedef union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKUnsignedBolt12Invoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr; + +/** + * A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + /** + * The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ; + + + +/** + * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. + * + * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent + * directly after scanning a refund. It includes all the information needed to pay a recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +typedef struct MUST_USE_STRUCT LDKBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12Invoice *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKBolt12Invoice; + +/** + * The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ + */ +typedef union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt12Invoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr; + +/** + * A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ { + /** + * The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ; + +/** + * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers + */ +typedef struct LDKSchnorrSignature { + /** + * The bytes of the signature as two 32-byte numbers + */ + uint8_t compact_form[64]; +} LDKSchnorrSignature; + +/** + * The contents of CResult_SchnorrSignatureNoneZ + */ +typedef union LDKCResult_SchnorrSignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSchnorrSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_SchnorrSignatureNoneZPtr; + +/** + * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::SchnorrSignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SchnorrSignatureNoneZ { + /** + * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SchnorrSignatureNoneZPtr contents; + /** + * Whether this CResult_SchnorrSignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_SchnorrSignatureNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_StrZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKStr *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_StrZ; + /** * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. * This corresponds to std::vector in C++ @@ -1745,6 +2329,150 @@ typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { }; } LDKCOption_CVec_ThirtyTwoBytesZZ; +/** + * A 3-byte byte array. + */ +typedef struct LDKThreeBytes { + /** + * The three bytes + */ + uint8_t data[3]; +} LDKThreeBytes; + +/** + * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or + * another currency. + */ +typedef enum LDKAmount_Tag { + /** + * An amount of bitcoin. + */ + LDKAmount_Bitcoin, + /** + * An amount of currency specified using ISO 4712. + */ + LDKAmount_Currency, + /** + * Must be last for serialization purposes + */ + LDKAmount_Sentinel, +} LDKAmount_Tag; + +typedef struct LDKAmount_LDKBitcoin_Body { + /** + * The amount in millisatoshi. + */ + uint64_t amount_msats; +} LDKAmount_LDKBitcoin_Body; + +typedef struct LDKAmount_LDKCurrency_Body { + /** + * The currency that the amount is denominated in. + */ + struct LDKThreeBytes iso4217_code; + /** + * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). + */ + uint64_t amount; +} LDKAmount_LDKCurrency_Body; + +typedef struct MUST_USE_STRUCT LDKAmount { + LDKAmount_Tag tag; + union { + LDKAmount_LDKBitcoin_Body bitcoin; + LDKAmount_LDKCurrency_Body currency; + }; +} LDKAmount; + +/** + * An enum which can either contain a crate::lightning::offers::offer::Amount or not + */ +typedef enum LDKCOption_AmountZ_Tag { + /** + * When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount + */ + LDKCOption_AmountZ_Some, + /** + * When we're in this state, this COption_AmountZ contains nothing + */ + LDKCOption_AmountZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_AmountZ_Sentinel, +} LDKCOption_AmountZ_Tag; + +typedef struct LDKCOption_AmountZ { + LDKCOption_AmountZ_Tag tag; + union { + struct { + struct LDKAmount some; + }; + }; +} LDKCOption_AmountZ; + +/** + * Quantity of items supported by an [`Offer`]. + */ +typedef enum LDKQuantity_Tag { + /** + * Up to a specific number of items (inclusive). Use when more than one item can be requested + * but is limited (e.g., because of per customer or inventory limits). + * + * May be used with `NonZeroU64::new(1)` but prefer to use [`Quantity::One`] if only one item + * is supported. + */ + LDKQuantity_Bounded, + /** + * One or more items. Use when more than one item can be requested without any limit. + */ + LDKQuantity_Unbounded, + /** + * Only one item. Use when only a single item can be requested. + */ + LDKQuantity_One, + /** + * Must be last for serialization purposes + */ + LDKQuantity_Sentinel, +} LDKQuantity_Tag; + +typedef struct MUST_USE_STRUCT LDKQuantity { + LDKQuantity_Tag tag; + union { + struct { + uint64_t bounded; + }; + }; +} LDKQuantity; + +/** + * An enum which can either contain a crate::lightning::offers::offer::Quantity or not + */ +typedef enum LDKCOption_QuantityZ_Tag { + /** + * When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity + */ + LDKCOption_QuantityZ_Some, + /** + * When we're in this state, this COption_QuantityZ contains nothing + */ + LDKCOption_QuantityZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_QuantityZ_Sentinel, +} LDKCOption_QuantityZ_Tag; + +typedef struct LDKCOption_QuantityZ { + LDKCOption_QuantityZ_Tag tag; + union { + struct { + struct LDKQuantity some; + }; + }; +} LDKCOption_QuantityZ; + /** * The contents of CResult_ThirtyTwoBytesNoneZ */ @@ -1777,58 +2505,38 @@ typedef struct LDKCResult_ThirtyTwoBytesNoneZ { bool result_ok; } LDKCResult_ThirtyTwoBytesNoneZ; - - -/** - * Information needed to route a payment across a [`BlindedPath`]. - */ -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. - */ - 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; -} LDKBlindedPayInfo; - /** - * The contents of CResult_BlindedPayInfoDecodeErrorZ + * The contents of CResult_Bolt12InvoiceDecodeErrorZ */ -typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr { +typedef union LDKCResult_Bolt12InvoiceDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedPayInfo *result; + struct LDKBolt12Invoice *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_BlindedPayInfoDecodeErrorZPtr; +} LDKCResult_Bolt12InvoiceDecodeErrorZPtr; /** - * 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. + * A CResult_Bolt12InvoiceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::Bolt12Invoice 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_BlindedPayInfoDecodeErrorZ { +typedef struct LDKCResult_Bolt12InvoiceDecodeErrorZ { /** - * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either + * The contents of this CResult_Bolt12InvoiceDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents; + union LDKCResult_Bolt12InvoiceDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + * Whether this CResult_Bolt12InvoiceDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedPayInfoDecodeErrorZ; +} LDKCResult_Bolt12InvoiceDecodeErrorZ; @@ -1945,7 +2653,7 @@ typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ { /** * A reference to a transaction output. * - * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32 + * Differs from bitcoin::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 { @@ -2009,8 +2717,8 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * To derive the delayed payment key which is used to sign this input, you must pass the * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided - * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be - * generated without the secret key using [`chan_utils::derive_public_key`] and only the + * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be + * generated without the secret key using [`DelayedPaymentKey::from_basepoint`] and only the * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. * * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is @@ -2018,7 +2726,7 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to * [`ChannelSigner::provide_channel_parameters`]) and the provided * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to - * [`chan_utils::derive_public_revocation_key`]. + * [`RevocationKey`]. * * The witness script which is hashed and included in the output `script_pubkey` may be * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived @@ -2062,6 +2770,19 @@ typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { * The output which is referenced by the given outpoint. */ struct LDKTxOut output; + /** + * The `channel_keys_id` for the channel which this output came from. + * + * For channels which were generated on LDK 0.0.119 or later, this is the value which was + * passed to the [`SignerProvider::get_destination_script`] call which provided this + * output script. + * + * For channels which were generated prior to LDK 0.0.119, no such argument existed, + * however this field may still be filled in if such data is available. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes channel_keys_id; } LDKSpendableOutputDescriptor_LDKStaticOutput_Body; typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor { @@ -2172,7 +2893,7 @@ typedef struct LDKCOption_u32Z { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_CVec_u8ZusizeZ { +typedef struct LDKC2Tuple_CVec_u8Zu64Z { /** * The element at position 0 */ @@ -2180,40 +2901,40 @@ typedef struct LDKC2Tuple_CVec_u8ZusizeZ { /** * The element at position 1 */ - uintptr_t b; -} LDKC2Tuple_CVec_u8ZusizeZ; + uint64_t b; +} LDKC2Tuple_CVec_u8Zu64Z; /** - * The contents of CResult_C2Tuple_CVec_u8ZusizeZNoneZ + * The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ */ -typedef union LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr { +typedef union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_CVec_u8ZusizeZ *result; + struct LDKC2Tuple_CVec_u8Zu64Z *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr; +} LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr; /** - * A CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_CVec_u8ZusizeZ on success and a () on failure. + * A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ { +typedef struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ { /** - * The contents of this CResult_C2Tuple_CVec_u8ZusizeZNoneZ, accessible via either + * The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZPtr contents; + union LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZPtr contents; /** - * Whether this CResult_C2Tuple_CVec_u8ZusizeZNoneZ represents a success state. + * Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ; +} LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ; @@ -2321,141 +3042,6 @@ typedef struct LDKCResult_HTLCDescriptorDecodeErrorZ { bool result_ok; } LDKCResult_HTLCDescriptorDecodeErrorZ; -/** - * 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; - -/** - * Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers - */ -typedef struct LDKECDSASignature { - /** - * The bytes of the signature in "compact" form - */ - uint8_t compact_form[64]; -} LDKECDSASignature; - -/** - * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ECDSASignatureZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKECDSASignature *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_ECDSASignatureZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { - /** - * The element at position 0 - */ - struct LDKECDSASignature a; - /** - * The element at position 1 - */ - struct LDKCVec_ECDSASignatureZ b; -} LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; - -/** - * The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ - */ -typedef union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr; - -/** - * A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - /** - * The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr contents; - /** - * Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; - -/** - * The contents of CResult_ECDSASignatureNoneZ - */ -typedef union LDKCResult_ECDSASignatureNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKECDSASignature *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_ECDSASignatureNoneZPtr; - -/** - * A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::ECDSASignature on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ECDSASignatureNoneZ { - /** - * The contents of this CResult_ECDSASignatureNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ECDSASignatureNoneZPtr contents; - /** - * Whether this CResult_ECDSASignatureNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_ECDSASignatureNoneZ; - /** * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. */ @@ -2498,6 +3084,69 @@ typedef struct LDKCResult_PublicKeyNoneZ { bool result_ok; } LDKCResult_PublicKeyNoneZ; +/** + * The contents of CResult__u832NoneZ + */ +typedef union LDKCResult__u832NoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKThirtyTwoBytes *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult__u832NoneZPtr; + +/** + * A CResult__u832NoneZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult__u832NoneZ { + /** + * The contents of this CResult__u832NoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult__u832NoneZPtr contents; + /** + * Whether this CResult__u832NoneZ represents a success state. + */ + bool result_ok; +} LDKCResult__u832NoneZ; + +/** + * 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; + /** * An enum which can either contain a crate::c_types::BigEndianScalar or not */ @@ -2525,29 +3174,6 @@ typedef struct LDKCOption_BigEndianScalarZ { }; } LDKCOption_BigEndianScalarZ; -/** - * 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. @@ -2593,46 +3219,140 @@ typedef struct LDKCResult_RecoverableSignatureNoneZ { } LDKCResult_RecoverableSignatureNoneZ; /** - * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers + * Represents a secp256k1 ECDSA signature serialized as two 32-byte numbers */ -typedef struct LDKSchnorrSignature { +typedef struct LDKECDSASignature { /** - * The bytes of the signature as two 32-byte numbers + * The bytes of the signature in "compact" form */ uint8_t compact_form[64]; -} LDKSchnorrSignature; +} LDKECDSASignature; /** - * The contents of CResult_SchnorrSignatureNoneZ + * The contents of CResult_ECDSASignatureNoneZ */ -typedef union LDKCResult_SchnorrSignatureNoneZPtr { +typedef union LDKCResult_ECDSASignatureNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSchnorrSignature *result; + struct LDKECDSASignature *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_SchnorrSignatureNoneZPtr; +} LDKCResult_ECDSASignatureNoneZPtr; /** - * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::SchnorrSignature on success and a () on failure. + * A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ECDSASignature on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SchnorrSignatureNoneZ { +typedef struct LDKCResult_ECDSASignatureNoneZ { /** - * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + * The contents of this CResult_ECDSASignatureNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SchnorrSignatureNoneZPtr contents; + union LDKCResult_ECDSASignatureNoneZPtr contents; /** - * Whether this CResult_SchnorrSignatureNoneZ represents a success state. + * Whether this CResult_ECDSASignatureNoneZ represents a success state. */ bool result_ok; -} LDKCResult_SchnorrSignatureNoneZ; +} LDKCResult_ECDSASignatureNoneZ; + +/** + * The contents of CResult_TransactionNoneZ + */ +typedef union LDKCResult_TransactionNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTransaction *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_TransactionNoneZPtr; + +/** + * A CResult_TransactionNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Transaction on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_TransactionNoneZ { + /** + * The contents of this CResult_TransactionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TransactionNoneZPtr contents; + /** + * Whether this CResult_TransactionNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_TransactionNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ECDSASignatureZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKECDSASignature *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ECDSASignatureZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + /** + * The element at position 0 + */ + struct LDKECDSASignature a; + /** + * The element at position 1 + */ + struct LDKCVec_ECDSASignatureZ b; +} LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; + +/** + * The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ + */ +typedef union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr; + +/** + * A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + /** + * The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; @@ -2794,6 +3514,10 @@ typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { /** * A trait to handle Lightning channel key material without concretizing the channel type or * the signature mechanism. + * + * Several methods allow error types to be returned to support async signing. This feature + * is not yet complete, and panics may occur in certain situations when returning errors + * for these methods. */ typedef struct LDKChannelSigner { /** @@ -2805,8 +3529,13 @@ typedef struct LDKChannelSigner { * Gets the per-commitment point for a specific commitment number * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + * + * If the signer returns `Err`, then the user is responsible for either force-closing the channel + * or calling `ChannelManager::signer_unblocked` (this method is only available when the + * `async_signing` cfg flag is enabled) once the signature is ready. + * */ - struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + struct LDKCResult_PublicKeyNoneZ (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** * Gets the commitment secret for a specific commitment number as part of the revocation process * @@ -2817,7 +3546,7 @@ typedef struct LDKChannelSigner { * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ - struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); + struct LDKCResult__u832NoneZ (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. * @@ -2826,14 +3555,21 @@ typedef struct LDKChannelSigner { * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * The preimages of outbound HTLCs that were fulfilled since the last commitment are provided. * A validating signer should ensure that an HTLC output is removed only when the matching * preimage is provided, or when the value to holder is restored. * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); + /** + * Validate the counterparty's revocation. + * + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. + */ + struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** * Returns the holder's channel public keys and basepoints. */ @@ -2892,21 +3628,15 @@ typedef struct LDKEcdsaChannelSigner { * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. + * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment + * are provided. A validating signer should ensure that an outbound HTLC output is removed + * only when the matching preimage is provided and after the corresponding inbound HTLC has + * been removed for forwarded payments. * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ - struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ preimages); - /** - * Validate the counterparty's revocation. - * - * This is required in order for the signer to make sure that the state has moved - * forward and it is safe to sign the next counterparty commitment. - */ - struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); + struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** * Creates a signature for a holder's commitment transaction. * @@ -2917,6 +3647,13 @@ typedef struct LDKEcdsaChannelSigner { * This may be called multiple times for the same transaction. * * An external signer implementation should check that the commitment has not been revoked. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** @@ -2934,6 +3671,13 @@ typedef struct LDKEcdsaChannelSigner { * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** @@ -2955,6 +3699,13 @@ typedef struct LDKEcdsaChannelSigner { * * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script * (which is committed to in the BIP 143 signatures). + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** @@ -2966,8 +3717,14 @@ typedef struct LDKEcdsaChannelSigner { * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) * broadcasts it before receiving the update for the latest commitment transaction. * - * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** @@ -2988,6 +3745,13 @@ typedef struct LDKEcdsaChannelSigner { * detected onchain. It has been generated by our counterparty and is used to derive * channel state keys, which are then included in the witness script and committed to in the * BIP 143 signature. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** @@ -3000,6 +3764,13 @@ typedef struct LDKEcdsaChannelSigner { /** * Computes the signature for a commitment transaction's anchor output used as an * input within `anchor_tx`, which spends the commitment transaction, at index `input`. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); /** @@ -3012,6 +3783,8 @@ typedef struct LDKEcdsaChannelSigner { * Note that if this fails or is rejected, the channel will not be publicly announced and * our counterparty may (though likely will not) close the channel on us for violating the * protocol. + * + * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message */ struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** @@ -3019,80 +3792,50 @@ typedef struct LDKEcdsaChannelSigner { */ 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); -} LDKEcdsaChannelSigner; - -/** - * A writeable signer. - * - * There will always be two instances of a signer per channel, one occupied by the - * [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ -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 EcdsaChannelSigner for this object. - */ - struct LDKEcdsaChannelSigner EcdsaChannelSigner; - /** - * Serialize the object into a byte array - */ - struct LDKCVec_u8Z (*write)(const void *this_arg); - /** - * Called, if set, after this WriteableEcdsaChannelSigner has been cloned into a duplicate object. - * The new WriteableEcdsaChannelSigner is provided, and should be mutated as needed to perform a + * Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. + * The new EcdsaChannelSigner is provided, and should be mutated as needed to perform a * deep copy of the object pointed to by this_arg or avoid any double-freeing. */ - void (*cloned)(struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR new_WriteableEcdsaChannelSigner); + void (*cloned)(struct LDKEcdsaChannelSigner *NONNULL_PTR new_EcdsaChannelSigner); /** * 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); -} LDKWriteableEcdsaChannelSigner; +} LDKEcdsaChannelSigner; /** - * The contents of CResult_WriteableEcdsaChannelSignerDecodeErrorZ + * The contents of CResult_EcdsaChannelSignerDecodeErrorZ */ -typedef union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr { +typedef union LDKCResult_EcdsaChannelSignerDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKWriteableEcdsaChannelSigner *result; + struct LDKEcdsaChannelSigner *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_WriteableEcdsaChannelSignerDecodeErrorZPtr; +} LDKCResult_EcdsaChannelSignerDecodeErrorZPtr; /** - * A CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::sign::WriteableEcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_EcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::sign::ecdsa::EcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ { +typedef struct LDKCResult_EcdsaChannelSignerDecodeErrorZ { /** - * The contents of this CResult_WriteableEcdsaChannelSignerDecodeErrorZ, accessible via either + * The contents of this CResult_EcdsaChannelSignerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZPtr contents; + union LDKCResult_EcdsaChannelSignerDecodeErrorZPtr contents; /** - * Whether this CResult_WriteableEcdsaChannelSignerDecodeErrorZ represents a success state. + * Whether this CResult_EcdsaChannelSignerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ; +} LDKCResult_EcdsaChannelSignerDecodeErrorZ; /** * The contents of CResult_CVec_u8ZNoneZ @@ -3213,57 +3956,41 @@ typedef struct LDKCOption_boolZ { } LDKCOption_boolZ; /** - * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_CVec_u8ZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCVec_u8Z *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_CVec_u8ZZ; - -/** - * The contents of CResult_CVec_CVec_u8ZZNoneZ + * The contents of CResult_WitnessNoneZ */ -typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { +typedef union LDKCResult_WitnessNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_CVec_u8ZZ *result; + struct LDKWitness *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_CVec_CVec_u8ZZNoneZPtr; +} LDKCResult_WitnessNoneZPtr; /** - * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. + * A CResult_WitnessNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Witness on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { +typedef struct LDKCResult_WitnessNoneZ { /** - * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either + * The contents of this CResult_WitnessNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; + union LDKCResult_WitnessNoneZPtr contents; /** - * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. + * Whether this CResult_WitnessNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_CVec_u8ZZNoneZ; +} LDKCResult_WitnessNoneZ; /** - * A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory. + * A simple implementation of [`EcdsaChannelSigner`] that just keeps the private keys in memory. * * This implementation performs no policy checks and is insufficient by itself as * a secure external signer. @@ -3316,57 +4043,181 @@ typedef struct LDKCResult_InMemorySignerDecodeErrorZ { bool result_ok; } LDKCResult_InMemorySignerDecodeErrorZ; + + /** - * The contents of CResult_TransactionNoneZ + * A [`CandidateRouteHop::FirstHop`] entry. */ -typedef union LDKCResult_TransactionNoneZPtr { +typedef struct MUST_USE_STRUCT LDKFirstHopCandidate { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKTransaction *result; + LDKnativeFirstHopCandidate *inner; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - void *err; -} LDKCResult_TransactionNoneZPtr; + bool is_owned; +} LDKFirstHopCandidate; + + /** - * A CResult_TransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Transaction on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A [`CandidateRouteHop::PublicHop`] entry. */ -typedef struct LDKCResult_TransactionNoneZ { +typedef struct MUST_USE_STRUCT LDKPublicHopCandidate { /** - * The contents of this CResult_TransactionNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - union LDKCResult_TransactionNoneZPtr contents; + LDKnativePublicHopCandidate *inner; /** - * Whether this CResult_TransactionNoneZ represents a success state. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - bool result_ok; -} LDKCResult_TransactionNoneZ; + bool is_owned; +} LDKPublicHopCandidate; /** - * Represents the compressed public key of a node + * A [`CandidateRouteHop::PrivateHop`] entry. */ -typedef struct MUST_USE_STRUCT LDKNodeId { +typedef struct MUST_USE_STRUCT LDKPrivateHopCandidate { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeId *inner; + LDKnativePrivateHopCandidate *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNodeId; +} LDKPrivateHopCandidate; + + + +/** + * A [`CandidateRouteHop::Blinded`] entry. + */ +typedef struct MUST_USE_STRUCT LDKBlindedPathCandidate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedPathCandidate *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKBlindedPathCandidate; + + + +/** + * A [`CandidateRouteHop::OneHopBlinded`] entry. + */ +typedef struct MUST_USE_STRUCT LDKOneHopBlindedPathCandidate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOneHopBlindedPathCandidate *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKOneHopBlindedPathCandidate; + +/** + * A wrapper around the various hop representations. + * + * Can be used to examine the properties of a hop, + * potentially to decide whether to include it in a route. + */ +typedef enum LDKCandidateRouteHop_Tag { + /** + * A hop from the payer, where the outbound liquidity is known. + */ + LDKCandidateRouteHop_FirstHop, + /** + * A hop found in the [`ReadOnlyNetworkGraph`]. + */ + LDKCandidateRouteHop_PublicHop, + /** + * A private hop communicated by the payee, generally via a BOLT 11 invoice. + * + * Because BOLT 11 route hints can take multiple hops to get to the destination, this may not + * terminate at the payee. + */ + LDKCandidateRouteHop_PrivateHop, + /** + * A blinded path which starts with an introduction point and ultimately terminates with the + * payee. + * + * Because we don't know the payee's identity, [`CandidateRouteHop::target`] will return + * `None` in this state. + * + * Because blinded paths are \"all or nothing\", and we cannot use just one part of a blinded + * path, the full path is treated as a single [`CandidateRouteHop`]. + */ + LDKCandidateRouteHop_Blinded, + /** + * Similar to [`Self::Blinded`], but the path here only has one hop. + * + * While we treat this similarly to [`CandidateRouteHop::Blinded`] in many respects (e.g. + * returning `None` from [`CandidateRouteHop::target`]), in this case we do actually know the + * payee's identity - it's the introduction point! + * + * [`BlindedPayInfo`] provided for 1-hop blinded paths is ignored because it is meant to apply + * to the hops *between* the introduction node and the destination. + * + * This primarily exists to track that we need to included a blinded path at the end of our + * [`Route`], even though it doesn't actually add an additional hop in the payment. + * + * [`BlindedPayInfo`]: crate::blinded_path::payment::BlindedPayInfo + */ + LDKCandidateRouteHop_OneHopBlinded, + /** + * Must be last for serialization purposes + */ + LDKCandidateRouteHop_Sentinel, +} LDKCandidateRouteHop_Tag; + +typedef struct MUST_USE_STRUCT LDKCandidateRouteHop { + LDKCandidateRouteHop_Tag tag; + union { + struct { + struct LDKFirstHopCandidate first_hop; + }; + struct { + struct LDKPublicHopCandidate public_hop; + }; + struct { + struct LDKPrivateHopCandidate private_hop; + }; + struct { + struct LDKBlindedPathCandidate blinded; + }; + struct { + struct LDKOneHopBlindedPathCandidate one_hop_blinded; + }; + }; +} LDKCandidateRouteHop; @@ -3437,7 +4288,7 @@ typedef struct LDKScoreLookUp { * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. * Thus, implementations should be overflow-safe. */ - uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); + uint64_t (*channel_penalty_msat)(const void *this_arg, const struct LDKCandidateRouteHop *NONNULL_PTR candidate, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -3478,19 +4329,26 @@ typedef struct LDKScoreUpdate { /** * Handles updating channel penalties after failing to route through a channel. */ - void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); + void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); /** * Handles updating channel penalties after successfully routing along a path. */ - void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); + void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); /** * Handles updating channel penalties after a probe over the given path failed. */ - void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id); + void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); /** * Handles updating channel penalties after a probe over the given path succeeded. */ - void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path); + void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); + /** + * Scorers may wish to reduce their certainty of channel liquidity information over time. + * Thus, this method is provided to allow scorers to observe the passage of time - the holder + * of this object should call this method regularly (generally via the + * `lightning-background-processor` crate). + */ + void (*time_passed)(void *this_arg, uint64_t duration_since_epoch); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -3617,8 +4475,89 @@ typedef struct LDKCResult_NoneIOErrorZ { +/** + * Parameters needed to find a [`Route`]. + * + * Passed to [`find_route`] and [`build_route_from_hops`]. + */ +typedef struct MUST_USE_STRUCT LDKRouteParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteParameters *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRouteParameters; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { + /** + * The element at position 0 + */ + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + struct LDKRecipientOnionFields b; + /** + * The element at position 2 + */ + struct LDKRouteParameters c; +} LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ; + +/** + * The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ + */ +typedef union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr; + +/** + * A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + /** + * The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr contents; + /** + * Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ; + + + /** * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] + * + * Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and + * [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain + * transactions. + * + * [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances + * [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances */ typedef struct MUST_USE_STRUCT LDKChannelDetails { /** @@ -3636,7 +4575,7 @@ typedef struct MUST_USE_STRUCT LDKChannelDetails { } LDKChannelDetails; /** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_ChannelDetailsZ { @@ -3727,6 +4666,211 @@ typedef struct LDKCResult_RouteLightningErrorZ { +/** + * A blinded path to be used for sending or receiving a payment, hiding the identity of the + * recipient. + */ +typedef struct MUST_USE_STRUCT LDKBlindedPaymentPath { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedPaymentPath *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; +} LDKBlindedPaymentPath; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::payment::BlindedPaymentPaths of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_BlindedPaymentPathZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKBlindedPaymentPath *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_BlindedPaymentPathZ; + +/** + * The contents of CResult_CVec_BlindedPaymentPathZNoneZ + */ +typedef union LDKCResult_CVec_BlindedPaymentPathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_BlindedPaymentPathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_BlindedPaymentPathZNoneZPtr; + +/** + * A CResult_CVec_BlindedPaymentPathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedPaymentPathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedPaymentPathZNoneZ { + /** + * The contents of this CResult_CVec_BlindedPaymentPathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_BlindedPaymentPathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedPaymentPathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedPaymentPathZNoneZ; + +/** + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PublicKeyZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPublicKey *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PublicKeyZ; + + + +/** + * A path for sending an [`OnionMessage`]. + */ +typedef struct MUST_USE_STRUCT LDKOnionMessagePath { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOnionMessagePath *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKOnionMessagePath; + +/** + * The contents of CResult_OnionMessagePathNoneZ + */ +typedef union LDKCResult_OnionMessagePathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionMessagePath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_OnionMessagePathNoneZPtr; + +/** + * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionMessagePathNoneZ { + /** + * The contents of this CResult_OnionMessagePathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionMessagePathNoneZPtr contents; + /** + * Whether this CResult_OnionMessagePathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionMessagePathNoneZ; + +/** + * The contents of CResult_CVec_BlindedMessagePathZNoneZ + */ +typedef union LDKCResult_CVec_BlindedMessagePathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_BlindedMessagePathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_BlindedMessagePathZNoneZPtr; + +/** + * A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedMessagePathZNoneZ { + /** + * The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_BlindedMessagePathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedMessagePathZNoneZ; + + + +/** + * An intermediate node, and possibly a short channel id leading to the next node. + */ +typedef struct MUST_USE_STRUCT LDKMessageForwardNode { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMessageForwardNode *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; +} LDKMessageForwardNode; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_MessageForwardNodeZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKMessageForwardNode *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_MessageForwardNodeZ; + + + /** * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for * in-use channel liquidity. @@ -3992,28 +5136,6 @@ typedef struct LDKCResult_RouteDecodeErrorZ { bool result_ok; } LDKCResult_RouteDecodeErrorZ; - - -/** - * Parameters needed to find a [`Route`]. - * - * Passed to [`find_route`] and [`build_route_from_hops`]. - */ -typedef struct MUST_USE_STRUCT LDKRouteParameters { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRouteParameters *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKRouteParameters; - /** * The contents of CResult_RouteParametersDecodeErrorZ */ @@ -4116,36 +5238,6 @@ typedef struct LDKCResult_PaymentParametersDecodeErrorZ { bool result_ok; } LDKCResult_PaymentParametersDecodeErrorZ; -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ { - /** - * The element at position 0 - */ - struct LDKBlindedPayInfo a; - /** - * The element at position 1 - */ - struct LDKBlindedPath b; -} LDKC2Tuple_BlindedPayInfoBlindedPathZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ; - /** @@ -4167,7 +5259,7 @@ typedef struct MUST_USE_STRUCT LDKRouteHint { } LDKRouteHint; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size. + * A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_RouteHintZ { @@ -4182,42 +5274,6 @@ typedef struct LDKCVec_RouteHintZ { uintptr_t datalen; } LDKCVec_RouteHintZ; - - -/** - * A channel descriptor for a hop along a payment path. - */ -typedef struct MUST_USE_STRUCT LDKRouteHintHop { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRouteHintHop *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKRouteHintHop; - -/** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_RouteHintHopZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKRouteHintHop *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_RouteHintHopZ; - /** * The contents of CResult_RouteHintDecodeErrorZ */ @@ -4236,7 +5292,7 @@ typedef union LDKCResult_RouteHintDecodeErrorZPtr { /** * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning_types::routing::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_RouteHintDecodeErrorZ { @@ -4251,6 +5307,30 @@ typedef struct LDKCResult_RouteHintDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintDecodeErrorZ; + + +/** + * A channel descriptor for a hop along a payment path. + * + * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are + * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as + * fields not supported in BOLT 11 will be stripped. + */ +typedef struct MUST_USE_STRUCT LDKRouteHintHop { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHintHop *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRouteHintHop; + /** * The contents of CResult_RouteHintHopDecodeErrorZ */ @@ -4269,7 +5349,7 @@ typedef union LDKCResult_RouteHintHopDecodeErrorZPtr { /** * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning_types::routing::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { @@ -4284,22 +5364,6 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintHopDecodeErrorZ; -/** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PublicKeyZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKPublicKey *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; - /** @@ -4353,6 +5417,26 @@ typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { bool result_ok; } LDKCResult_FixedPenaltyScorerDecodeErrorZ; + + +/** + * Represents the compressed public key of a node + */ +typedef struct MUST_USE_STRUCT LDKNodeId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeId *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKNodeId; + /** * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. * This corresponds to std::vector in C++ @@ -4524,7 +5608,7 @@ typedef struct MUST_USE_STRUCT LDKRecord { } LDKRecord; /** - * A trait encapsulating the operations required of a logger + * A trait encapsulating the operations required of a logger. */ typedef struct LDKLogger { /** @@ -4533,9 +5617,9 @@ typedef struct LDKLogger { */ void *this_arg; /** - * Logs the `Record` + * Logs the [`Record`]. */ - void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); + void (*log)(const void *this_arg, struct LDKRecord record); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -4576,7 +5660,7 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { * 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)`). - *6762, 1070 + * * 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 @@ -4591,11 +5675,6 @@ typedef struct MUST_USE_STRUCT LDKNetworkGraph { * formula, but using the history of a channel rather than our latest estimates for the liquidity * bounds. * - * # Note - * - * Mixing the `no-std` feature between serialization and deserialization results in undefined - * behavior. - * * [1]: https://arxiv.org/abs/2107.05322 * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_multiplier_msat * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringFeeParameters::liquidity_penalty_amount_multiplier_msat @@ -4651,6 +5730,59 @@ typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ { bool result_ok; } LDKCResult_ProbabilisticScorerDecodeErrorZ; + + +/** + * The best known block as identified by its hash and height. + */ +typedef struct MUST_USE_STRUCT LDKBestBlock { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBestBlock *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; +} LDKBestBlock; + +/** + * The contents of CResult_BestBlockDecodeErrorZ + */ +typedef union LDKCResult_BestBlockDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBestBlock *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_BestBlockDecodeErrorZPtr; + +/** + * A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::BestBlock 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_BestBlockDecodeErrorZ { + /** + * The contents of this CResult_BestBlockDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BestBlockDecodeErrorZPtr contents; + /** + * Whether this CResult_BestBlockDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BestBlockDecodeErrorZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -4682,9 +5814,9 @@ typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { } LDKCVec_C2Tuple_usizeTransactionZZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { +typedef struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { /** * The element at position 0 */ @@ -4692,24 +5824,28 @@ typedef struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ { /** * The element at position 1 */ - struct LDKCOption_ThirtyTwoBytesZ b; -} LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ; + uint32_t b; + /** + * The element at position 2 + */ + struct LDKCOption_ThirtyTwoBytesZ c; +} LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ { +typedef struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *data; + struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ; +} LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ; /** * The contents of CResult_ChannelMonitorUpdateStatusNoneZ @@ -4765,6 +5901,217 @@ typedef struct MUST_USE_STRUCT LDKHTLCUpdate { bool is_owned; } LDKHTLCUpdate; + + +/** + * Struct to `Display` fields in a safe way using `PrintableString` + */ +typedef struct MUST_USE_STRUCT LDKUntrustedString { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUntrustedString *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; +} LDKUntrustedString; + +/** + * The reason the channel was closed. See individual variants for more details. + */ +typedef enum LDKClosureReason_Tag { + /** + * Closure generated from receiving a peer error message. + * + * Our counterparty may have broadcasted their latest commitment state, and we have + * as well. + */ + LDKClosureReason_CounterpartyForceClosed, + /** + * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * + * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + */ + LDKClosureReason_HolderForceClosed, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. Note the shutdown may have been initiated by us. + * + * This was only set in versions of LDK prior to 0.0.122. + */ + LDKClosureReason_LegacyCooperativeClosure, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. This indicates that the shutdown was initiated by our + * counterparty. + * + * In rare cases where we initiated closure immediately prior to shutting down without + * persisting, this value may be provided for channels we initiated closure for. + */ + LDKClosureReason_CounterpartyInitiatedCooperativeClosure, + /** + * The channel was closed after negotiating a cooperative close and we've now broadcasted + * the cooperative close transaction. This indicates that the shutdown was initiated by us. + */ + LDKClosureReason_LocallyInitiatedCooperativeClosure, + /** + * A commitment transaction was confirmed on chain, closing the channel. Most likely this + * commitment transaction came from our counterparty, but it may also have come from + * a copy of our own `ChannelMonitor`. + */ + LDKClosureReason_CommitmentTxConfirmed, + /** + * The funding transaction failed to confirm in a timely manner on an inbound channel. + */ + LDKClosureReason_FundingTimedOut, + /** + * Closure generated from processing an event, likely a HTLC forward/relay/reception. + */ + LDKClosureReason_ProcessingError, + /** + * The peer disconnected prior to funding completing. In this case the spec mandates that we + * forget the channel entirely - we can attempt again if the peer reconnects. + * + * This includes cases where we restarted prior to funding completion, including prior to the + * initial [`ChannelMonitor`] persistence completing. + * + * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the + * peer because of mutual incompatibility between us and our channel counterparty. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + LDKClosureReason_DisconnectedPeer, + /** + * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than + * the [`ChannelManager`] deserialized. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + LDKClosureReason_OutdatedChannelManager, + /** + * The counterparty requested a cooperative close of a channel that had not been funded yet. + * The channel has been immediately closed. + */ + LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, + /** + * Another channel in the same funding batch closed before the funding transaction + * was ready to be broadcast. + */ + LDKClosureReason_FundingBatchClosure, + /** + * One of our HTLCs timed out in a channel, causing us to force close the channel. + */ + LDKClosureReason_HTLCsTimedOut, + /** + * Our peer provided a feerate which violated our required minimum (fetched from our + * [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or + * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]). + * + * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator + * [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedAnchorChannelRemoteFee + * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee + */ + LDKClosureReason_PeerFeerateTooLow, + /** + * Must be last for serialization purposes + */ + LDKClosureReason_Sentinel, +} LDKClosureReason_Tag; + +typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { + /** + * The error which the peer sent us. + * + * 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` + * + * [`UntrustedString`]: crate::util::string::UntrustedString + */ + struct LDKUntrustedString peer_msg; +} LDKClosureReason_LDKCounterpartyForceClosed_Body; + +typedef struct LDKClosureReason_LDKHolderForceClosed_Body { + /** + * Whether or not the latest transaction was broadcasted when the channel was force + * closed. + * + * Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have + * this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`] + * or force-closed prior to being funded will have this field set to false. + * + * This will be `None` for objects generated or written by LDK 0.0.123 and + * earlier. + * + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn. + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn. + */ + struct LDKCOption_boolZ broadcasted_latest_txn; +} LDKClosureReason_LDKHolderForceClosed_Body; + +typedef struct LDKClosureReason_LDKProcessingError_Body { + /** + * A developer-readable error message which we generated. + */ + struct LDKStr err; +} LDKClosureReason_LDKProcessingError_Body; + +typedef struct LDKClosureReason_LDKPeerFeerateTooLow_Body { + /** + * The feerate on our channel set by our peer. + */ + uint32_t peer_feerate_sat_per_kw; + /** + * The required feerate we enforce, from our [`FeeEstimator`]. + * + * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator + */ + uint32_t required_feerate_sat_per_kw; +} LDKClosureReason_LDKPeerFeerateTooLow_Body; + +typedef struct MUST_USE_STRUCT LDKClosureReason { + LDKClosureReason_Tag tag; + union { + LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; + LDKClosureReason_LDKHolderForceClosed_Body holder_force_closed; + LDKClosureReason_LDKProcessingError_Body processing_error; + LDKClosureReason_LDKPeerFeerateTooLow_Body peer_feerate_too_low; + }; +} LDKClosureReason; + + + +/** + * A unique 32-byte identifier for a channel. + * Depending on how the ID is generated, several varieties are distinguished + * (but all are stored as 32 bytes): + * _v1_ and _temporary_. + * A _v1_ channel ID is generated based on funding tx outpoint (txid & index). + * A _temporary_ ID is generated randomly. + * (Later revocation-point-based _v2_ is a possibility.) + * The variety (context) is not stored, it is relevant only at creation. + */ +typedef struct MUST_USE_STRUCT LDKChannelId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelId *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; +} LDKChannelId; + /** * An event to be processed by the ChannelManager. */ @@ -4774,7 +6121,13 @@ typedef enum LDKMonitorEvent_Tag { */ LDKMonitorEvent_HTLCEvent, /** - * A monitor event that the Channel's commitment transaction was confirmed. + * Indicates we broadcasted the channel's latest commitment transaction and thus closed the + * channel. Holds information about the channel and why it was closed. + */ + LDKMonitorEvent_HolderForceClosedWithInfo, + /** + * Indicates we broadcasted the channel's latest commitment transaction and thus closed the + * channel. */ LDKMonitorEvent_HolderForceClosed, /** @@ -4790,11 +6143,30 @@ typedef enum LDKMonitorEvent_Tag { LDKMonitorEvent_Sentinel, } LDKMonitorEvent_Tag; +typedef struct LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body { + /** + * The reason the channel was closed. + */ + struct LDKClosureReason reason; + /** + * The funding outpoint of the channel. + */ + struct LDKOutPoint outpoint; + /** + * The channel ID of the channel. + */ + struct LDKChannelId channel_id; +} LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body; + typedef struct LDKMonitorEvent_LDKCompleted_Body { /** * The funding outpoint of the [`ChannelMonitor`] that was updated */ struct LDKOutPoint funding_txo; + /** + * The channel ID of the channel associated with the [`ChannelMonitor`] + */ + struct LDKChannelId channel_id; /** * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or * [`ChannelMonitor::get_latest_update_id`]. @@ -4811,6 +6183,7 @@ typedef struct MUST_USE_STRUCT LDKMonitorEvent { struct { struct LDKHTLCUpdate htlc_event; }; + LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body holder_force_closed_with_info; struct { struct LDKOutPoint holder_force_closed; }; @@ -4835,9 +6208,9 @@ typedef struct LDKCVec_MonitorEventZ { } LDKCVec_MonitorEventZ; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * A tuple of 4 elements. See the individual fields for the types contained. */ -typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { +typedef struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { /** * The element at position 0 */ @@ -4845,28 +6218,32 @@ typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { /** * The element at position 1 */ - struct LDKCVec_MonitorEventZ b; + struct LDKChannelId b; /** * The element at position 2 */ - struct LDKPublicKey c; -} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; + struct LDKCVec_MonitorEventZ c; + /** + * The element at position 3 + */ + struct LDKPublicKey d; +} LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { +typedef struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data; + struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; +} LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; @@ -4906,7 +6283,7 @@ typedef union 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. + * containing a crate::lightning_types::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 { @@ -4959,7 +6336,7 @@ typedef union 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. + * containing a crate::lightning_types::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 { @@ -5012,7 +6389,7 @@ typedef union 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. + * containing a crate::lightning_types::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 { @@ -5065,7 +6442,7 @@ typedef union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { /** * A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning_types::features::Bolt11InvoiceFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ { @@ -5118,7 +6495,7 @@ typedef union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { /** * A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning_types::features::Bolt12InvoiceFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ { @@ -5171,7 +6548,7 @@ typedef union 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. + * containing a crate::lightning_types::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 { @@ -5233,7 +6610,7 @@ typedef union 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. + * containing a crate::lightning_types::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 { @@ -5250,6 +6627,91 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { +/** + * An identifier for an [`Offer`] built using [`DerivedMetadata`]. + */ +typedef struct MUST_USE_STRUCT LDKOfferId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOfferId *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; +} LDKOfferId; + +/** + * The contents of CResult_OfferIdDecodeErrorZ + */ +typedef union LDKCResult_OfferIdDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOfferId *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_OfferIdDecodeErrorZPtr; + +/** + * A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::OfferId 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_OfferIdDecodeErrorZ { + /** + * The contents of this CResult_OfferIdDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferIdDecodeErrorZPtr contents; + /** + * Whether this CResult_OfferIdDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferIdDecodeErrorZ; + +/** + * The contents of CResult_NoneBolt12SemanticErrorZ + */ +typedef union LDKCResult_NoneBolt12SemanticErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_NoneBolt12SemanticErrorZPtr; + +/** + * A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneBolt12SemanticErrorZ { + /** + * The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_NoneBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneBolt12SemanticErrorZ; + + + /** * An `Offer` is a potentially long-lived proposal for payment of a good or service. * @@ -5260,7 +6722,7 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { * 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. + * Through the use of [`BlindedMessagePath`]s, offers provide recipient privacy. * * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice @@ -5281,9 +6743,9 @@ typedef struct MUST_USE_STRUCT LDKOffer { } LDKOffer; /** - * The contents of CResult_OfferBolt12ParseErrorZ + * The contents of CResult_OfferBolt12SemanticErrorZ */ -typedef union LDKCResult_OfferBolt12ParseErrorZPtr { +typedef union LDKCResult_OfferBolt12SemanticErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -5293,58 +6755,205 @@ typedef union LDKCResult_OfferBolt12ParseErrorZPtr { * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKBolt12ParseError *err; -} LDKCResult_OfferBolt12ParseErrorZPtr; + enum LDKBolt12SemanticError *err; +} LDKCResult_OfferBolt12SemanticErrorZPtr; /** - * A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. + * A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_OfferBolt12ParseErrorZ { +typedef struct LDKCResult_OfferBolt12SemanticErrorZ { /** - * The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either + * The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_OfferBolt12ParseErrorZPtr contents; + union LDKCResult_OfferBolt12SemanticErrorZPtr contents; /** - * Whether this CResult_OfferBolt12ParseErrorZ represents a success state. + * Whether this CResult_OfferBolt12SemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_OfferBolt12ParseErrorZ; +} LDKCResult_OfferBolt12SemanticErrorZ; + + /** - * The contents of CResult_PublicKeySecp256k1ErrorZ + * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self */ -typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr { +typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithDerivedPayerIdBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceRequestWithDerivedPayerIdBuilder *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; +} LDKInvoiceRequestWithDerivedPayerIdBuilder; + +/** + * The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPublicKey *result; + struct LDKInvoiceRequestWithDerivedPayerIdBuilder *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_PublicKeySecp256k1ErrorZPtr; + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr; /** - * A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation, - * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. + * A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PublicKeySecp256k1ErrorZ { +typedef struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { /** - * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either + * The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; + union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr contents; /** - * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. + * Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PublicKeySecp256k1ErrorZ; +} LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ; + + + +/** + * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithExplicitPayerIdBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceRequestWithExplicitPayerIdBuilder *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; +} LDKInvoiceRequestWithExplicitPayerIdBuilder; + +/** + * The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequestWithExplicitPayerIdBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ; + +/** + * The contents of CResult_OfferDecodeErrorZ + */ +typedef union LDKCResult_OfferDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOffer *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_OfferDecodeErrorZPtr; + +/** + * A CResult_OfferDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::Offer 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_OfferDecodeErrorZ { + /** + * The contents of this CResult_OfferDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferDecodeErrorZPtr contents; + /** + * Whether this CResult_OfferDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferDecodeErrorZ; + +/** + * The contents of CResult_OfferBolt12ParseErrorZ + */ +typedef union LDKCResult_OfferBolt12ParseErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOffer *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKBolt12ParseError *err; +} LDKCResult_OfferBolt12ParseErrorZPtr; + +/** + * A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OfferBolt12ParseErrorZ { + /** + * The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferBolt12ParseErrorZPtr contents; + /** + * Whether this CResult_OfferBolt12ParseErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferBolt12ParseErrorZ; /** * The contents of CResult_NodeIdDecodeErrorZ @@ -5379,27 +6988,38 @@ typedef struct LDKCResult_NodeIdDecodeErrorZ { bool result_ok; } LDKCResult_NodeIdDecodeErrorZ; - +/** + * The contents of CResult_PublicKeySecp256k1ErrorZ + */ +typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + 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_PublicKeySecp256k1ErrorZPtr; /** - * 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 + * A CResult_PublicKeySecp256k1ErrorZ represents the result of a fallible operation, + * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +typedef struct LDKCResult_PublicKeySecp256k1ErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeChannelUpdate *inner; + union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. */ - bool is_owned; -} LDKChannelUpdate; + bool result_ok; +} LDKCResult_PublicKeySecp256k1ErrorZ; /** * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion @@ -5408,11 +7028,6 @@ typedef struct MUST_USE_STRUCT LDKChannelUpdate { * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md */ typedef enum LDKNetworkUpdate_Tag { - /** - * An error indicating a `channel_update` messages should be applied via - * [`NetworkGraph::update_channel`]. - */ - LDKNetworkUpdate_ChannelUpdateMessage, /** * An error indicating that a channel failed to route a payment, which should be applied via * [`NetworkGraph::channel_failed_permanent`] if permanent. @@ -5429,13 +7044,6 @@ typedef enum LDKNetworkUpdate_Tag { LDKNetworkUpdate_Sentinel, } LDKNetworkUpdate_Tag; -typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { - /** - * The update to apply via [`NetworkGraph::update_channel`]. - */ - struct LDKChannelUpdate msg; -} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; - typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { /** * The short channel id of the closed channel. @@ -5463,7 +7071,6 @@ typedef struct 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; }; @@ -5761,6 +7368,28 @@ typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { bool is_owned; } LDKChannelAnnouncement; + + +/** + * 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 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelUpdate *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelUpdate; + /** * A tuple of 3 elements. See the individual fields for the types contained. */ @@ -5950,6 +7579,90 @@ typedef struct MUST_USE_STRUCT LDKFundingSigned { +/** + * An `stfu` (quiescence) message to be sent by or received from the stfu initiator. + * + */ +typedef struct MUST_USE_STRUCT LDKStfu { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeStfu *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKStfu; + + + +/** + * A `splice_init` message to be sent by or received from the stfu initiator (splice initiator). + * + */ +typedef struct MUST_USE_STRUCT LDKSpliceInit { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSpliceInit *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; +} LDKSpliceInit; + + + +/** + * A `splice_ack` message to be received by or sent to the splice initiator. + * + */ +typedef struct MUST_USE_STRUCT LDKSpliceAck { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSpliceAck *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSpliceAck; + + + +/** + * A `splice_locked` message to be sent to or received from a peer. + * + */ +typedef struct MUST_USE_STRUCT LDKSpliceLocked { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSpliceLocked *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSpliceLocked; + + + /** * A tx_add_input message for adding an input during interactive transaction construction * @@ -6593,6 +8306,22 @@ typedef enum LDKMessageSendEvent_Tag { * Used to indicate that a funding_signed message should be sent to the peer with the given node_id. */ LDKMessageSendEvent_SendFundingSigned, + /** + * Used to indicate that a stfu message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendStfu, + /** + * Used to indicate that a splice_init message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSpliceInit, + /** + * Used to indicate that a splice_ack message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSpliceAck, + /** + * Used to indicate that a splice_locked message should be sent to the peer with the given node id. + */ + LDKMessageSendEvent_SendSpliceLocked, /** * Used to indicate that a tx_add_input message should be sent to the peer with the given node_id. */ @@ -6785,6 +8514,50 @@ typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { struct LDKFundingSigned msg; } LDKMessageSendEvent_LDKSendFundingSigned_Body; +typedef struct LDKMessageSendEvent_LDKSendStfu_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKStfu msg; +} LDKMessageSendEvent_LDKSendStfu_Body; + +typedef struct LDKMessageSendEvent_LDKSendSpliceInit_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSpliceInit msg; +} LDKMessageSendEvent_LDKSendSpliceInit_Body; + +typedef struct LDKMessageSendEvent_LDKSendSpliceAck_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSpliceAck msg; +} LDKMessageSendEvent_LDKSendSpliceAck_Body; + +typedef struct LDKMessageSendEvent_LDKSendSpliceLocked_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKSpliceLocked msg; +} LDKMessageSendEvent_LDKSendSpliceLocked_Body; + typedef struct LDKMessageSendEvent_LDKSendTxAddInput_Body { /** * The node_id of the node which should receive this message @@ -7078,6 +8851,10 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKSendOpenChannelV2_Body send_open_channel_v2; LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; + LDKMessageSendEvent_LDKSendStfu_Body send_stfu; + LDKMessageSendEvent_LDKSendSpliceInit_Body send_splice_init; + LDKMessageSendEvent_LDKSendSpliceAck_Body send_splice_ack; + LDKMessageSendEvent_LDKSendSpliceLocked_Body send_splice_locked; LDKMessageSendEvent_LDKSendTxAddInput_Body send_tx_add_input; LDKMessageSendEvent_LDKSendTxAddOutput_Body send_tx_add_output; LDKMessageSendEvent_LDKSendTxRemoveInput_Body send_tx_remove_input; @@ -7268,7 +9045,7 @@ typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { /** * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. + * containing a crate::lightning_types::routing::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_RoutingFeesDecodeErrorZ { @@ -7449,21 +9226,53 @@ typedef struct LDKCVec_SocketAddressZ { /** - * Information received in the latest node_announcement from this node. + * Non-relayable information received in the latest node_announcement from this node. */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { +typedef struct MUST_USE_STRUCT LDKNodeAnnouncementDetails { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeAnnouncementInfo *inner; + LDKnativeNodeAnnouncementDetails *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; +} LDKNodeAnnouncementDetails; + +/** + * Information received in the latest node_announcement from this node. + */ +typedef enum LDKNodeAnnouncementInfo_Tag { + /** + * An initial announcement of the node + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + */ + LDKNodeAnnouncementInfo_Relayed, + /** + * Non-relayable information received in the latest node_announcement from this node. + */ + LDKNodeAnnouncementInfo_Local, + /** + * Must be last for serialization purposes + */ + LDKNodeAnnouncementInfo_Sentinel, +} LDKNodeAnnouncementInfo_Tag; + +typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { + LDKNodeAnnouncementInfo_Tag tag; + union { + struct { + struct LDKNodeAnnouncement relayed; + }; + struct { + struct LDKNodeAnnouncementDetails local; + }; + }; } LDKNodeAnnouncementInfo; /** @@ -7555,6 +9364,33 @@ typedef struct LDKCResult_NodeAliasDecodeErrorZ { bool result_ok; } LDKCResult_NodeAliasDecodeErrorZ; +/** + * An enum which can either contain a crate::lightning::routing::gossip::NodeAnnouncementInfo or not + */ +typedef enum LDKCOption_NodeAnnouncementInfoZ_Tag { + /** + * When we're in this state, this COption_NodeAnnouncementInfoZ contains a crate::lightning::routing::gossip::NodeAnnouncementInfo + */ + LDKCOption_NodeAnnouncementInfoZ_Some, + /** + * When we're in this state, this COption_NodeAnnouncementInfoZ contains nothing + */ + LDKCOption_NodeAnnouncementInfoZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NodeAnnouncementInfoZ_Sentinel, +} LDKCOption_NodeAnnouncementInfoZ_Tag; + +typedef struct LDKCOption_NodeAnnouncementInfoZ { + LDKCOption_NodeAnnouncementInfoZ_Tag tag; + union { + struct { + struct LDKNodeAnnouncementInfo some; + }; + }; +} LDKCOption_NodeAnnouncementInfoZ; + /** @@ -7668,6 +9504,113 @@ typedef struct LDKCOption_CVec_SocketAddressZZ { }; } LDKCOption_CVec_SocketAddressZZ; +/** + * The contents of CResult_u64ShortChannelIdErrorZ + */ +typedef union LDKCResult_u64ShortChannelIdErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + uint64_t *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKShortChannelIdError *err; +} LDKCResult_u64ShortChannelIdErrorZPtr; + +/** + * A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, + * containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_u64ShortChannelIdErrorZ { + /** + * The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_u64ShortChannelIdErrorZPtr contents; + /** + * Whether this CResult_u64ShortChannelIdErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_u64ShortChannelIdErrorZ; + + + +/** + * Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it + * should go next. + */ +typedef struct MUST_USE_STRUCT LDKPendingHTLCInfo { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePendingHTLCInfo *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; +} LDKPendingHTLCInfo; + + + +/** + * Invalid inbound onion payment. + */ +typedef struct MUST_USE_STRUCT LDKInboundHTLCErr { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInboundHTLCErr *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInboundHTLCErr; + +/** + * The contents of CResult_PendingHTLCInfoInboundHTLCErrZ + */ +typedef union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPendingHTLCInfo *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKInboundHTLCErr *err; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr; + +/** + * A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ { + /** + * The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr contents; + /** + * Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. + */ + bool result_ok; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZ; + /** * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. * This corresponds to std::vector in C++ @@ -7887,6 +9830,141 @@ typedef struct LDKCResult_CVec_UtxoZNoneZ { bool result_ok; } LDKCResult_CVec_UtxoZNoneZ; + + +/** + * An unknown payment context. + */ +typedef struct MUST_USE_STRUCT LDKUnknownPaymentContext { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnknownPaymentContext *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; +} LDKUnknownPaymentContext; + + + +/** + * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + */ +typedef struct MUST_USE_STRUCT LDKBolt12OfferContext { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12OfferContext *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; +} LDKBolt12OfferContext; + + + +/** + * The context of a payment made for an invoice sent for a BOLT 12 [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund + */ +typedef struct MUST_USE_STRUCT LDKBolt12RefundContext { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12RefundContext *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; +} LDKBolt12RefundContext; + +/** + * The context of an inbound payment, which is included in a [`BlindedPaymentPath`] via + * [`ReceiveTlvs`] and surfaced in [`PaymentPurpose`]. + * + * [`PaymentPurpose`]: crate::events::PaymentPurpose + */ +typedef enum LDKPaymentContext_Tag { + /** + * The payment context was unknown. + */ + LDKPaymentContext_Unknown, + /** + * The payment was made for an invoice requested from a BOLT 12 [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + */ + LDKPaymentContext_Bolt12Offer, + /** + * The payment was made for an invoice sent for a BOLT 12 [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund + */ + LDKPaymentContext_Bolt12Refund, + /** + * Must be last for serialization purposes + */ + LDKPaymentContext_Sentinel, +} LDKPaymentContext_Tag; + +typedef struct MUST_USE_STRUCT LDKPaymentContext { + LDKPaymentContext_Tag tag; + union { + struct { + struct LDKUnknownPaymentContext unknown; + }; + struct { + struct LDKBolt12OfferContext bolt12_offer; + }; + struct { + struct LDKBolt12RefundContext bolt12_refund; + }; + }; +} LDKPaymentContext; + +/** + * An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not + */ +typedef enum LDKCOption_PaymentContextZ_Tag { + /** + * When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext + */ + LDKCOption_PaymentContextZ_Some, + /** + * When we're in this state, this COption_PaymentContextZ contains nothing + */ + LDKCOption_PaymentContextZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_PaymentContextZ_Sentinel, +} LDKCOption_PaymentContextZ_Tag; + +typedef struct LDKCOption_PaymentContextZ { + LDKCOption_PaymentContextZ_Tag tag; + union { + struct { + struct LDKPaymentContext some; + }; + }; +} LDKCOption_PaymentContextZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -7929,64 +10007,37 @@ typedef struct LDKCOption_C2Tuple_u64u16ZZ { } LDKCOption_C2Tuple_u64u16ZZ; /** - * An enum which can either contain a crate::lightning::ln::channelmanager::ChannelShutdownState or not + * The contents of CResult_ChannelIdAPIErrorZ */ -typedef enum LDKCOption_ChannelShutdownStateZ_Tag { - /** - * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channelmanager::ChannelShutdownState - */ - LDKCOption_ChannelShutdownStateZ_Some, - /** - * When we're in this state, this COption_ChannelShutdownStateZ contains nothing - */ - LDKCOption_ChannelShutdownStateZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_ChannelShutdownStateZ_Sentinel, -} LDKCOption_ChannelShutdownStateZ_Tag; - -typedef struct LDKCOption_ChannelShutdownStateZ { - LDKCOption_ChannelShutdownStateZ_Tag tag; - union { - struct { - enum LDKChannelShutdownState some; - }; - }; -} LDKCOption_ChannelShutdownStateZ; - -/** - * The contents of CResult_ThirtyTwoBytesAPIErrorZ - */ -typedef union LDKCResult_ThirtyTwoBytesAPIErrorZPtr { +typedef union LDKCResult_ChannelIdAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKChannelId *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_ThirtyTwoBytesAPIErrorZPtr; +} LDKCResult_ChannelIdAPIErrorZPtr; /** - * A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::types::ChannelId 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_ThirtyTwoBytesAPIErrorZ { +typedef struct LDKCResult_ChannelIdAPIErrorZ { /** - * The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either + * The contents of this CResult_ChannelIdAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ThirtyTwoBytesAPIErrorZPtr contents; + union LDKCResult_ChannelIdAPIErrorZPtr contents; /** - * Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. + * Whether this CResult_ChannelIdAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ThirtyTwoBytesAPIErrorZ; +} LDKCResult_ChannelIdAPIErrorZ; /** * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments. @@ -8466,32 +10517,105 @@ typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFa /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ { +typedef struct LDKC2Tuple_ChannelIdPublicKeyZ { /** * The element at position 0 */ - struct LDKThirtyTwoBytes a; + struct LDKChannelId a; /** * The element at position 1 */ struct LDKPublicKey b; -} LDKC2Tuple_ThirtyTwoBytesPublicKeyZ; +} LDKC2Tuple_ChannelIdPublicKeyZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesPublicKeyZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ { +typedef struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *data; + struct LDKC2Tuple_ChannelIdPublicKeyZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ; +} LDKCVec_C2Tuple_ChannelIdPublicKeyZZ; + +/** + * A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ChannelIdZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKChannelId *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ChannelIdZ; + + + +/** + * Builds an [`Offer`] for the \"offer to be paid\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKOfferWithDerivedMetadataBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOfferWithDerivedMetadataBuilder *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; +} LDKOfferWithDerivedMetadataBuilder; + +/** + * The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOfferWithDerivedMetadataBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ; /** * An enum which can either contain a crate::c_types::Str or not @@ -8521,121 +10645,249 @@ typedef struct LDKCOption_StrZ { } LDKCOption_StrZ; /** - * The contents of CResult_NoneBolt12SemanticErrorZ + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ */ -typedef union LDKCResult_NoneBolt12SemanticErrorZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - enum LDKBolt12SemanticError *err; -} LDKCResult_NoneBolt12SemanticErrorZPtr; + void *err; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr; /** - * A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneBolt12SemanticErrorZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { /** - * The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneBolt12SemanticErrorZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr contents; /** - * Whether this CResult_NoneBolt12SemanticErrorZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_NoneBolt12SemanticErrorZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; /** - * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ + * The contents of CResult_ThirtyTwoBytesAPIErrorZ */ -typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { +typedef union LDKCResult_ThirtyTwoBytesAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *result; + struct LDKThirtyTwoBytes *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr; + struct LDKAPIError *err; +} LDKCResult_ThirtyTwoBytesAPIErrorZPtr; /** - * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a () on failure. + * A CResult_ThirtyTwoBytesAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { +typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ { /** - * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ, accessible via either + * The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr contents; + union LDKCResult_ThirtyTwoBytesAPIErrorZPtr contents; /** - * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. + * Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; +} LDKCResult_ThirtyTwoBytesAPIErrorZ; /** - * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. + * A 128-bit number used only once. * - * 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. + * Needed when constructing [`Offer::metadata`] and deriving [`Offer::signing_pubkey`] from + * [`ExpandedKey`]. Must not be reused for any other derivation without first hashing. * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + * [`Offer::signing_pubkey`]: crate::offers::offer::Offer::signing_pubkey + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequest { +typedef struct MUST_USE_STRUCT LDKNonce { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeNonce *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; +} LDKNonce; +/** + * Contains data specific to an [`OffersMessage`]. + * + * [`OffersMessage`]: crate::onion_message::offers::OffersMessage + */ +typedef enum LDKOffersContext_Tag { + /** + * Context used by a [`BlindedMessagePath`] within an [`Offer`]. + * + * This variant is intended to be received when handling an [`InvoiceRequest`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + LDKOffersContext_InvoiceRequest, + /** + * Context used by a [`BlindedMessagePath`] within a [`Refund`] or as a reply path for an + * [`InvoiceRequest`]. + * + * This variant is intended to be received when handling a [`Bolt12Invoice`] or an + * [`InvoiceError`]. + * + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + */ + LDKOffersContext_OutboundPayment, + /** + * Context used by a [`BlindedMessagePath`] as a reply path for a [`Bolt12Invoice`]. + * + * This variant is intended to be received when handling an [`InvoiceError`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + */ + LDKOffersContext_InboundPayment, + /** + * Must be last for serialization purposes + */ + LDKOffersContext_Sentinel, +} LDKOffersContext_Tag; +typedef struct LDKOffersContext_LDKInvoiceRequest_Body { + /** + * A nonce used for authenticating that an [`InvoiceRequest`] is for a valid [`Offer`] and + * for deriving the offer's signing keys. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Offer`]: crate::offers::offer::Offer + */ + struct LDKNonce nonce; +} LDKOffersContext_LDKInvoiceRequest_Body; + +typedef struct LDKOffersContext_LDKOutboundPayment_Body { + /** + * Payment ID used when creating a [`Refund`] or [`InvoiceRequest`]. + * + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKThirtyTwoBytes payment_id; + /** + * A nonce used for authenticating that a [`Bolt12Invoice`] is for a valid [`Refund`] or + * [`InvoiceRequest`] and for deriving their signing keys. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKNonce nonce; + /** + * Authentication code for the [`PaymentId`], which should be checked when the context is + * used with an [`InvoiceError`]. + * + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes hmac; +} LDKOffersContext_LDKOutboundPayment_Body; + +typedef struct LDKOffersContext_LDKInboundPayment_Body { + /** + * The same payment hash as [`Bolt12Invoice::payment_hash`]. + * + * [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash + */ + struct LDKThirtyTwoBytes payment_hash; +} LDKOffersContext_LDKInboundPayment_Body; + +typedef struct MUST_USE_STRUCT LDKOffersContext { + LDKOffersContext_Tag tag; + union { + LDKOffersContext_LDKInvoiceRequest_Body invoice_request; + LDKOffersContext_LDKOutboundPayment_Body outbound_payment; + LDKOffersContext_LDKInboundPayment_Body inbound_payment; + }; +} LDKOffersContext; /** - * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. + * An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not + */ +typedef enum LDKCOption_OffersContextZ_Tag { + /** + * When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext + */ + LDKCOption_OffersContextZ_Some, + /** + * When we're in this state, this COption_OffersContextZ contains nothing + */ + LDKCOption_OffersContextZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_OffersContextZ_Sentinel, +} LDKCOption_OffersContextZ_Tag; + +typedef struct LDKCOption_OffersContextZ { + LDKCOption_OffersContextZ_Tag tag; + union { + struct { + struct LDKOffersContext some; + }; + }; +} LDKCOption_OffersContextZ; + + + +/** + * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. * - * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent - * directly after scanning a refund. It includes all the information needed to pay a recipient. + * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request + * specifies these such that its recipient can send an invoice for payment. * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice * [`Offer`]: crate::offers::offer::Offer - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -typedef struct MUST_USE_STRUCT LDKBolt12Invoice { +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. */ - LDKnativeBolt12Invoice *inner; + 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; -} LDKBolt12Invoice; +} LDKInvoiceRequest; @@ -8703,32 +10955,66 @@ typedef struct MUST_USE_STRUCT LDKOffersMessage { }; } LDKOffersMessage; + + +/** + * Instructions for how and where to send the response to an onion message. + */ +typedef struct MUST_USE_STRUCT LDKResponseInstruction { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeResponseInstruction *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; +} LDKResponseInstruction; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OffersMessageResponseInstructionZ { + /** + * The element at position 0 + */ + struct LDKOffersMessage a; + /** + * The element at position 1 + */ + struct LDKResponseInstruction b; +} LDKC2Tuple_OffersMessageResponseInstructionZ; + /** - * An enum which can either contain a crate::lightning::onion_message::offers::OffersMessage or not + * An enum which can either contain a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ or not */ -typedef enum LDKCOption_OffersMessageZ_Tag { +typedef enum LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_Tag { /** - * When we're in this state, this COption_OffersMessageZ contains a crate::lightning::onion_message::offers::OffersMessage + * When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ */ - LDKCOption_OffersMessageZ_Some, + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_Some, /** - * When we're in this state, this COption_OffersMessageZ contains nothing + * When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains nothing */ - LDKCOption_OffersMessageZ_None, + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_OffersMessageZ_Sentinel, -} LDKCOption_OffersMessageZ_Tag; + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_Tag; -typedef struct LDKCOption_OffersMessageZ { - LDKCOption_OffersMessageZ_Tag tag; +typedef struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ { + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ_Tag tag; union { struct { - struct LDKOffersMessage some; + struct LDKC2Tuple_OffersMessageResponseInstructionZ some; }; }; -} LDKCOption_OffersMessageZ; +} LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ; /** * The destination of an onion message. @@ -8755,15 +11041,129 @@ typedef struct MUST_USE_STRUCT LDKDestination { struct LDKPublicKey node; }; struct { - struct LDKBlindedPath blinded_path; + struct LDKBlindedMessagePath blinded_path; }; }; } LDKDestination; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * Additional data included by the recipient in a [`BlindedMessagePath`]. + * + * This data is encrypted by the recipient and will be given to the corresponding message handler + * when handling a message sent over the [`BlindedMessagePath`]. The recipient can use this data to + * authenticate the message or for further processing if needed. + */ +typedef enum LDKMessageContext_Tag { + /** + * Context specific to an [`OffersMessage`]. + * + * [`OffersMessage`]: crate::onion_message::offers::OffersMessage + */ + LDKMessageContext_Offers, + /** + * Context specific to a [`CustomOnionMessageHandler::CustomMessage`]. + * + * [`CustomOnionMessageHandler::CustomMessage`]: crate::onion_message::messenger::CustomOnionMessageHandler::CustomMessage + */ + LDKMessageContext_Custom, + /** + * Must be last for serialization purposes + */ + LDKMessageContext_Sentinel, +} LDKMessageContext_Tag; + +typedef struct MUST_USE_STRUCT LDKMessageContext { + LDKMessageContext_Tag tag; + union { + struct { + struct LDKOffersContext offers; + }; + struct { + struct LDKCVec_u8Z custom; + }; + }; +} LDKMessageContext; + +/** + * Instructions for how and where to send a message. */ -typedef struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ { +typedef enum LDKMessageSendInstructions_Tag { + /** + * Indicates that a message should be sent including the provided reply path for the recipient + * to respond. + */ + LDKMessageSendInstructions_WithSpecifiedReplyPath, + /** + * Indicates that a message should be sent including a reply path for the recipient to + * respond. + */ + LDKMessageSendInstructions_WithReplyPath, + /** + * Indicates that a message should be sent without including a reply path, preventing the + * recipient from responding. + */ + LDKMessageSendInstructions_WithoutReplyPath, + /** + * Indicates that a message is being sent as a reply to a received message. + */ + LDKMessageSendInstructions_ForReply, + /** + * Must be last for serialization purposes + */ + LDKMessageSendInstructions_Sentinel, +} LDKMessageSendInstructions_Tag; + +typedef struct LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; + /** + * The reply path which should be included in the message. + */ + struct LDKBlindedMessagePath reply_path; +} LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKWithReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; + /** + * The context to include in the reply path we'll give the recipient so they can respond + * to us. + */ + struct LDKMessageContext context; +} LDKMessageSendInstructions_LDKWithReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKWithoutReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; +} LDKMessageSendInstructions_LDKWithoutReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKForReply_Body { + /** + * The instructions provided by the [`Responder`]. + */ + struct LDKResponseInstruction instructions; +} LDKMessageSendInstructions_LDKForReply_Body; + +typedef struct MUST_USE_STRUCT LDKMessageSendInstructions { + LDKMessageSendInstructions_Tag tag; + union { + LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body with_specified_reply_path; + LDKMessageSendInstructions_LDKWithReplyPath_Body with_reply_path; + LDKMessageSendInstructions_LDKWithoutReplyPath_Body without_reply_path; + LDKMessageSendInstructions_LDKForReply_Body for_reply; + }; +} LDKMessageSendInstructions; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ { /** * The element at position 0 */ @@ -8771,256 +11171,568 @@ typedef struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ { /** * The element at position 1 */ - struct LDKDestination b; - /** - * The element at position 2 - */ - struct LDKBlindedPath c; -} LDKC3Tuple_OffersMessageDestinationBlindedPathZ; + struct LDKMessageSendInstructions b; +} LDKC2Tuple_OffersMessageMessageSendInstructionsZ; /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OffersMessageDestinationBlindedPathZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OffersMessageMessageSendInstructionsZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ { +typedef struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *data; + struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ; +} LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ; /** - * Information needed for constructing an invoice route hint for this channel. + * Releases the HTLC corresponding to an inbound [`HeldHtlcAvailable`] message. */ -typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { +typedef struct MUST_USE_STRUCT LDKReleaseHeldHtlc { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeCounterpartyForwardingInfo *inner; + LDKnativeReleaseHeldHtlc *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKCounterpartyForwardingInfo; +} LDKReleaseHeldHtlc; /** - * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { +typedef struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ { /** - * 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 LDKCounterpartyForwardingInfo *result; + struct LDKReleaseHeldHtlc 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_CounterpartyForwardingInfoDecodeErrorZPtr; + struct LDKResponseInstruction b; +} LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ; /** - * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An enum which can either contain a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ or not */ -typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ { +typedef enum LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_Tag { /** - * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ */ - union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_Some, /** - * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. + * When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains nothing */ - bool result_ok; -} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_Tag; + +typedef struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ some; + }; + }; +} LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; /** - * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] - * to better separate parameters. + * An HTLC destined for the recipient of this message is being held upstream. The reply path + * accompanying this onion message should be used to send a [`ReleaseHeldHtlc`] response, which + * will cause the upstream HTLC to be released. */ -typedef struct MUST_USE_STRUCT LDKChannelCounterparty { +typedef struct MUST_USE_STRUCT LDKHeldHtlcAvailable { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelCounterparty *inner; + LDKnativeHeldHtlcAvailable *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; -} LDKChannelCounterparty; +} LDKHeldHtlcAvailable; /** - * The contents of CResult_ChannelCounterpartyDecodeErrorZ + * Possible async payment messages sent and received via an [`OnionMessage`]. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ -typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { +typedef enum LDKAsyncPaymentsMessage_Tag { + /** + * An HTLC is being held upstream for the often-offline recipient, to be released via + * [`ReleaseHeldHtlc`]. + */ + LDKAsyncPaymentsMessage_HeldHtlcAvailable, + /** + * Releases the HTLC corresponding to an inbound [`HeldHtlcAvailable`] message. + */ + LDKAsyncPaymentsMessage_ReleaseHeldHtlc, + /** + * Must be last for serialization purposes + */ + LDKAsyncPaymentsMessage_Sentinel, +} LDKAsyncPaymentsMessage_Tag; + +typedef struct MUST_USE_STRUCT LDKAsyncPaymentsMessage { + LDKAsyncPaymentsMessage_Tag tag; + union { + struct { + struct LDKHeldHtlcAvailable held_htlc_available; + }; + struct { + struct LDKReleaseHeldHtlc release_held_htlc; + }; + }; +} LDKAsyncPaymentsMessage; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + /** + * The element at position 0 + */ + struct LDKAsyncPaymentsMessage a; + /** + * The element at position 1 + */ + struct LDKMessageSendInstructions b; +} LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ; + + + +/** + * Route hints used in constructing invoices for [phantom node payents]. + * + * [phantom node payments]: crate::sign::PhantomKeysManager + */ +typedef struct MUST_USE_STRUCT LDKPhantomRouteHints { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePhantomRouteHints *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; +} LDKPhantomRouteHints; + +/** + * The contents of CResult_PhantomRouteHintsDecodeErrorZ + */ +typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelCounterparty *result; + struct LDKPhantomRouteHints *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_ChannelCounterpartyDecodeErrorZPtr; +} LDKCResult_PhantomRouteHintsDecodeErrorZPtr; /** - * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_ChannelCounterpartyDecodeErrorZ { +typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ { /** - * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either + * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents; + union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelCounterpartyDecodeErrorZ; +} LDKCResult_PhantomRouteHintsDecodeErrorZ; + + /** - * The contents of CResult_ChannelDetailsDecodeErrorZ + * Information used to forward or fail this HTLC that is being forwarded within a blinded path. */ -typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKBlindedForward { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedForward *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKBlindedForward; + +/** + * The contents of CResult_BlindedForwardDecodeErrorZ + */ +typedef union LDKCResult_BlindedForwardDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelDetails *result; + struct LDKBlindedForward *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_ChannelDetailsDecodeErrorZPtr; +} LDKCResult_BlindedForwardDecodeErrorZPtr; /** - * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelDetailsDecodeErrorZ { +typedef struct LDKCResult_BlindedForwardDecodeErrorZ { /** - * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either + * The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; + union LDKCResult_BlindedForwardDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. + * Whether this CResult_BlindedForwardDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelDetailsDecodeErrorZ; +} LDKCResult_BlindedForwardDecodeErrorZ; /** - * Route hints used in constructing invoices for [phantom node payents]. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * BOLT 4 onion packet including hop data for the next peer. */ -typedef struct MUST_USE_STRUCT LDKPhantomRouteHints { +typedef struct MUST_USE_STRUCT LDKOnionPacket { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePhantomRouteHints *inner; + LDKnativeOnionPacket *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKPhantomRouteHints; +} LDKOnionPacket; + + /** - * The contents of CResult_PhantomRouteHintsDecodeErrorZ + * Information communicated in the onion to the recipient for multi-part tracking and proof that + * the payment is associated with an invoice. */ -typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKFinalOnionHopData { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeFinalOnionHopData *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKFinalOnionHopData; + +/** + * Information about where a received HTLC('s onion) has indicated the HTLC should go. + */ +typedef enum LDKPendingHTLCRouting_Tag { + /** + * An HTLC which should be forwarded on to another node. + */ + LDKPendingHTLCRouting_Forward, + /** + * The onion indicates that this is a payment for an invoice (supposedly) generated by us. + * + * Note that at this point, we have not checked that the invoice being paid was actually + * generated by us, but rather it's claiming to pay an invoice of ours. + */ + LDKPendingHTLCRouting_Receive, + /** + * The onion indicates that this is for payment to us but which contains the preimage for + * claiming included, and is unrelated to any invoice we'd previously generated (aka a + * \"keysend\" or \"spontaneous\" payment). + */ + LDKPendingHTLCRouting_ReceiveKeysend, + /** + * Must be last for serialization purposes + */ + LDKPendingHTLCRouting_Sentinel, +} LDKPendingHTLCRouting_Tag; + +typedef struct LDKPendingHTLCRouting_LDKForward_Body { + /** + * The onion which should be included in the forwarded HTLC, telling the next hop what to + * do with the HTLC. + */ + struct LDKOnionPacket onion_packet; + /** + * The short channel ID of the channel which we were instructed to forward this HTLC to. + * + * This could be a real on-chain SCID, an SCID alias, or some other SCID which has meaning + * to the receiving node, such as one returned from + * [`ChannelManager::get_intercept_scid`] or [`ChannelManager::get_phantom_scid`]. + */ + uint64_t short_channel_id; + /** + * Set if this HTLC is being forwarded within a blinded path. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedForward blinded; +} LDKPendingHTLCRouting_LDKForward_Body; + +typedef struct LDKPendingHTLCRouting_LDKReceive_Body { + /** + * Information about the amount the sender intended to pay and (potential) proof that this + * is a payment for an invoice we generated. This proof of payment is is also used for + * linking MPP parts of a larger payment. + */ + struct LDKFinalOnionHopData payment_data; + /** + * Additional data which we (allegedly) instructed the sender to include in the onion. + * + * For HTLCs received by LDK, this will ultimately be exposed in + * [`Event::PaymentClaimable::onion_fields`] as + * [`RecipientOnionFields::payment_metadata`]. + */ + struct LDKCOption_CVec_u8ZZ payment_metadata; + /** + * The context of the payment included by the recipient in a blinded path, or `None` if a + * blinded path was not used. + * + * Used in part to determine the [`events::PaymentPurpose`]. + */ + struct LDKCOption_PaymentContextZ payment_context; + /** + * CLTV expiry of the received HTLC. + * + * Used to track when we should expire pending HTLCs that go unclaimed. + */ + uint32_t incoming_cltv_expiry; + /** + * If the onion had forwarding instructions to one of our phantom node SCIDs, this will + * provide the onion shared secret used to decrypt the next level of forwarding + * instructions. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes phantom_shared_secret; + /** + * Custom TLVs which were set by the sender. + * + * For HTLCs received by LDK, this will ultimately be exposed in + * [`Event::PaymentClaimable::onion_fields`] as + * [`RecipientOnionFields::custom_tlvs`]. + */ + struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs; + /** + * Set if this HTLC is the final hop in a multi-hop blinded path. + */ + bool requires_blinded_error; +} LDKPendingHTLCRouting_LDKReceive_Body; + +typedef struct LDKPendingHTLCRouting_LDKReceiveKeysend_Body { + /** + * Information about the amount the sender intended to pay and possibly a token to + * associate MPP parts of a larger payment. + * + * This will only be filled in if receiving MPP keysend payments is enabled, and it being + * present will cause deserialization to fail on versions of LDK prior to 0.0.116. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKFinalOnionHopData payment_data; + /** + * Preimage for this onion payment. This preimage is provided by the sender and will be + * used to settle the spontaneous payment. + */ + struct LDKThirtyTwoBytes payment_preimage; + /** + * Additional data which we (allegedly) instructed the sender to include in the onion. + * + * For HTLCs received by LDK, this will ultimately bubble back up as + * [`RecipientOnionFields::payment_metadata`]. + */ + struct LDKCOption_CVec_u8ZZ payment_metadata; + /** + * CLTV expiry of the received HTLC. + * + * Used to track when we should expire pending HTLCs that go unclaimed. + */ + uint32_t incoming_cltv_expiry; + /** + * Custom TLVs which were set by the sender. + * + * For HTLCs received by LDK, these will ultimately bubble back up as + * [`RecipientOnionFields::custom_tlvs`]. + */ + struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs; + /** + * Set if this HTLC is the final hop in a multi-hop blinded path. + */ + bool requires_blinded_error; +} LDKPendingHTLCRouting_LDKReceiveKeysend_Body; + +typedef struct MUST_USE_STRUCT LDKPendingHTLCRouting { + LDKPendingHTLCRouting_Tag tag; + union { + LDKPendingHTLCRouting_LDKForward_Body forward; + LDKPendingHTLCRouting_LDKReceive_Body receive; + LDKPendingHTLCRouting_LDKReceiveKeysend_Body receive_keysend; + }; +} LDKPendingHTLCRouting; + +/** + * The contents of CResult_PendingHTLCRoutingDecodeErrorZ + */ +typedef union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPhantomRouteHints *result; + struct LDKPendingHTLCRouting *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_PhantomRouteHintsDecodeErrorZPtr; +} LDKCResult_PendingHTLCRoutingDecodeErrorZPtr; /** - * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ { +typedef struct LDKCResult_PendingHTLCRoutingDecodeErrorZ { /** - * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either + * The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents; + union LDKCResult_PendingHTLCRoutingDecodeErrorZPtr contents; /** - * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. + * Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PhantomRouteHintsDecodeErrorZ; +} LDKCResult_PendingHTLCRoutingDecodeErrorZ; /** - * The contents of CResult_ChannelShutdownStateDecodeErrorZ + * The contents of CResult_PendingHTLCInfoDecodeErrorZ */ -typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr { +typedef union LDKCResult_PendingHTLCInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKChannelShutdownState *result; + struct LDKPendingHTLCInfo *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_ChannelShutdownStateDecodeErrorZPtr; +} LDKCResult_PendingHTLCInfoDecodeErrorZPtr; /** - * A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelShutdownStateDecodeErrorZ { +typedef struct LDKCResult_PendingHTLCInfoDecodeErrorZ { /** - * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either + * The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents; + union LDKCResult_PendingHTLCInfoDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. + * Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelShutdownStateDecodeErrorZ; +} LDKCResult_PendingHTLCInfoDecodeErrorZ; + +/** + * The contents of CResult_BlindedFailureDecodeErrorZ + */ +typedef union LDKCResult_BlindedFailureDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + enum LDKBlindedFailure *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_BlindedFailureDecodeErrorZPtr; + +/** + * A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedFailureDecodeErrorZ { + /** + * The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedFailureDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedFailureDecodeErrorZ; @@ -9159,7 +11871,7 @@ typedef struct LDKWatch { * For details on asynchronous [`ChannelMonitor`] updating and returning * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`]. */ - struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg); + struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_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. @@ -9205,7 +11917,7 @@ typedef struct LDKBroadcasterInterface { * be sure to manage both cases correctly. * * Bitcoin transaction packages are defined in BIP 331 and here: - * https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md + * */ void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs); /** @@ -9236,70 +11948,54 @@ typedef struct LDKEntropySource { void (*free)(void *this_arg); } LDKEntropySource; -/** - * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not - * own the memory pointed to by data. - */ -typedef struct LDKu8slice { - /** - * A pointer to the byte buffer - */ - const uint8_t *data; - /** - * The number of bytes pointed to by `data`. - */ - uintptr_t datalen; -} LDKu8slice; - /** - * A semantically valid [`InvoiceRequest`] that hasn't been signed. - * - * # Serialization + * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, + * but without the signature information. + * Decoding and encoding should not lead to information loss but may lead to different hashes. * - * This is serialized as a TLV stream, which includes TLV records from the originating message. As - * such, it may include unknown, odd TLV records. + * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. */ -typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { +typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeRawBolt11Invoice *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; +} LDKRawBolt11Invoice; /** - * A semantically valid [`Bolt12Invoice`] that hasn't been signed. + * A semantically valid [`InvoiceRequest`] that hasn't been signed. * * # Serialization * * This is serialized as a TLV stream, which includes TLV records from the originating message. As * such, it may include unknown, odd TLV records. */ -typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { +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. */ - LDKnativeUnsignedBolt12Invoice *inner; + 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; -} LDKUnsignedBolt12Invoice; +} LDKUnsignedInvoiceRequest; @@ -9436,7 +12132,7 @@ typedef struct LDKNodeSigner { * * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient recipient); + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKRawBolt11Invoice *NONNULL_PTR invoice, enum LDKRecipient recipient); /** * Signs the [`TaggedHash`] of a BOLT 12 invoice request. * @@ -9491,7 +12187,7 @@ typedef struct LDKSignerProvider { */ void *this_arg; /** - * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::Signer`] through + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::EcdsaSigner`] through * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated * `channel_keys_id`. @@ -9507,11 +12203,11 @@ typedef struct LDKSignerProvider { * re-derived from its `channel_keys_id`, which can be obtained through its trait method * [`ChannelSigner::channel_keys_id`]. */ - struct LDKWriteableEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + struct LDKEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. * This is only called during deserialization of other objects which contain - * [`WriteableEcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). + * [`EcdsaChannelSigner`]-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. @@ -9519,20 +12215,21 @@ typedef struct LDKSignerProvider { * This method is slowly being phased out -- it will only be called when reading objects * written by LDK versions prior to 0.0.113. * - * [`Signer`]: Self::Signer + * [`Signer`]: Self::EcdsaSigner * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + struct LDKCResult_EcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); /** * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. * * If this function returns an error, this will result in a channel failing to open. * * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * on-chain funds across channels as controlled to the same user. `channel_keys_id` may be + * used to derive a unique value for each channel. */ - struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg); + struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id); /** * Get a script pubkey which we will send funds to when closing a channel. * @@ -9562,6 +12259,10 @@ typedef struct LDKSignerProvider { * * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're * called from inside the library in response to chain events, P2P events, or timer events). + * + * LDK may generate a substantial number of fee-estimation calls in some cases. You should + * pre-calculate and cache the fee estimate results to ensure you don't substantially slow HTLC + * handling. */ typedef struct LDKFeeEstimator { /** @@ -9587,6 +12288,68 @@ typedef struct LDKFeeEstimator { void (*free)(void *this_arg); } LDKFeeEstimator; + + +/** + * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and + * may not be valid if received by another lightning implementation. + */ +typedef struct MUST_USE_STRUCT LDKReceiveTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeReceiveTlvs *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKReceiveTlvs; + +/** + * A trait defining behavior for routing an [`OnionMessage`]. + */ +typedef struct LDKMessageRouter { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. + */ + struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); + /** + * Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to + * be direct peers with the `recipient`. + */ + struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers); + /** + * Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are + * assumed to be direct peers with the `recipient`. + * + * Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, + * which is beneficial when a QR code is used to transport the data. The SCID is passed using + * a [`MessageForwardNode`] but may be `None` for graceful degradation. + * + * Implementations using additional intermediate nodes are responsible for using a + * [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations + * should call [`BlindedMessagePath::use_compact_introduction_node`]. + * + * The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], + * ignoring the short channel ids. + */ + struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_compact_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKMessageRouter; + /** * A trait defining behavior for routing a payment. */ @@ -9617,6 +12380,16 @@ typedef struct LDKRouter { * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` + * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are + * given in `tlvs`. + */ + struct LDKCResult_CVec_BlindedPaymentPathZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats); + /** + * Implementation of MessageRouter for this object. + */ + struct LDKMessageRouter MessageRouter; /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -9627,11 +12400,656 @@ typedef struct 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. + * A lightning node's channel state machine and payment management logic, which facilitates + * sending, forwarding, and receiving payments through lightning channels. + * + * [`ChannelManager`] is parameterized by a number of components to achieve this. + * - [`chain::Watch`] (typically [`ChainMonitor`]) for on-chain monitoring and enforcement of each + * channel + * - [`BroadcasterInterface`] for broadcasting transactions related to opening, funding, and + * closing channels + * - [`EntropySource`] for providing random data needed for cryptographic operations + * - [`NodeSigner`] for cryptographic operations scoped to the node + * - [`SignerProvider`] for providing signers whose operations are scoped to individual channels + * - [`FeeEstimator`] to determine transaction fee rates needed to have a transaction mined in a + * timely manner + * - [`Router`] for finding payment paths when initiating and retrying payments + * - [`Logger`] for logging operational information of varying degrees + * + * Additionally, it implements the following traits: + * - [`ChannelMessageHandler`] to handle off-chain channel activity from peers + * - [`MessageSendEventsProvider`] to similarly send such messages to peers + * - [`OffersMessageHandler`] for BOLT 12 message handling and sending + * - [`EventsProvider`] to generate user-actionable [`Event`]s + * - [`chain::Listen`] and [`chain::Confirm`] for notification of on-chain activity + * + * Thus, [`ChannelManager`] is typically used to parameterize a [`MessageHandler`] and an + * [`OnionMessenger`]. The latter is required to support BOLT 12 functionality. + * + * # `ChannelManager` vs `ChannelMonitor` + * + * It's important to distinguish between the *off-chain* management and *on-chain* enforcement of + * lightning channels. [`ChannelManager`] exchanges messages with peers to manage the off-chain + * state of each channel. During this process, it generates a [`ChannelMonitor`] for each channel + * and a [`ChannelMonitorUpdate`] for each relevant change, notifying its parameterized + * [`chain::Watch`] of them. + * + * An implementation of [`chain::Watch`], such as [`ChainMonitor`], is responsible for aggregating + * these [`ChannelMonitor`]s and applying any [`ChannelMonitorUpdate`]s to them. It then monitors + * for any pertinent on-chain activity, enforcing claims as needed. + * + * This division of off-chain management and on-chain enforcement allows for interesting node + * setups. For instance, on-chain enforcement could be moved to a separate host or have added + * redundancy, possibly as a watchtower. See [`chain::Watch`] for the relevant interface. + * + * # Initialization + * + * Use [`ChannelManager::new`] with the most recent [`BlockHash`] when creating a fresh instance. + * Otherwise, if restarting, construct [`ChannelManagerReadArgs`] with the necessary parameters and + * references to any deserialized [`ChannelMonitor`]s that were previously persisted. Use this to + * deserialize the [`ChannelManager`] and feed it any new chain data since it was last online, as + * detailed in the [`ChannelManagerReadArgs`] documentation. + * + * ``` + * use bitcoin::BlockHash; + * use bitcoin::network::Network; + * use lightning::chain::BestBlock; + * # use lightning::chain::channelmonitor::ChannelMonitor; + * use lightning::ln::channelmanager::{ChainParameters, ChannelManager, ChannelManagerReadArgs}; + * # use lightning::routing::gossip::NetworkGraph; + * use lightning::util::config::UserConfig; + * use lightning::util::ser::ReadableArgs; + * + * # fn read_channel_monitors() -> Vec> { vec![] } + * # fn example< + * # 'a, + * # L: lightning::util::logger::Logger, + * # ES: lightning::sign::EntropySource, + * # S: for <'b> lightning::routing::scoring::LockableScore<'b, ScoreLookUp = SL>, + * # SL: lightning::routing::scoring::ScoreLookUp, + * # SP: Sized, + * # R: lightning::io::Read, + * # >( + * # fee_estimator: &dyn lightning::chain::chaininterface::FeeEstimator, + * # chain_monitor: &dyn lightning::chain::Watch, + * # tx_broadcaster: &dyn lightning::chain::chaininterface::BroadcasterInterface, + * # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S, SP, SL>, + * # logger: &L, + * # entropy_source: &ES, + * # node_signer: &dyn lightning::sign::NodeSigner, + * # signer_provider: &lightning::sign::DynSignerProvider, + * # best_block: lightning::chain::BestBlock, + * # current_timestamp: u32, + * # mut reader: R, + * # ) -> Result<(), lightning::ln::msgs::DecodeError> { + * // Fresh start with no channels + * let params = ChainParameters { + * network: Network::Bitcoin, + * best_block, + * }; + * let default_config = UserConfig::default(); + * let channel_manager = ChannelManager::new( + * fee_estimator, chain_monitor, tx_broadcaster, router, logger, entropy_source, node_signer, + * signer_provider, default_config, params, current_timestamp + * ); + * + * // Restart from deserialized data + * let mut channel_monitors = read_channel_monitors(); + * let args = ChannelManagerReadArgs::new( + * entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, + * router, logger, default_config, channel_monitors.iter_mut().collect() + * ); + * let (block_hash, channel_manager) = + * <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; + * + * // Update the ChannelManager and ChannelMonitors with the latest chain data + * // ... + * + * // Move the monitors to the ChannelManager's chain::Watch parameter + * for monitor in channel_monitors { + * chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor); + * } + * # Ok(()) + * # } + * ``` + * + * # Operation + * + * The following is required for [`ChannelManager`] to function properly: + * - Handle messages from peers using its [`ChannelMessageHandler`] implementation (typically + * called by [`PeerManager::read_event`] when processing network I/O) + * - Send messages to peers obtained via its [`MessageSendEventsProvider`] implementation + * (typically initiated when [`PeerManager::process_events`] is called) + * - Feed on-chain activity using either its [`chain::Listen`] or [`chain::Confirm`] implementation + * as documented by those traits + * - Perform any periodic channel and payment checks by calling [`timer_tick_occurred`] roughly + * every minute + * - Persist to disk whenever [`get_and_clear_needs_persistence`] returns `true` using a + * [`Persister`] such as a [`KVStore`] implementation + * - Handle [`Event`]s obtained via its [`EventsProvider`] implementation + * + * The [`Future`] returned by [`get_event_or_persistence_needed_future`] is useful in determining + * when the last two requirements need to be checked. + * + * The [`lightning-block-sync`] and [`lightning-transaction-sync`] crates provide utilities that + * simplify feeding in on-chain activity using the [`chain::Listen`] and [`chain::Confirm`] traits, + * respectively. The remaining requirements can be met using the [`lightning-background-processor`] + * crate. For languages other than Rust, the availability of similar utilities may vary. + * + * # Channels + * + * [`ChannelManager`]'s primary function involves managing a channel state. Without channels, + * payments can't be sent. Use [`list_channels`] or [`list_usable_channels`] for a snapshot of the + * currently open channels. + * + * ``` + * # use lightning::ln::channelmanager::AChannelManager; + * # + * # fn example(channel_manager: T) { + * # let channel_manager = channel_manager.get_cm(); + * let channels = channel_manager.list_usable_channels(); + * for details in channels { + * println!(\"{:?}\", details); + * } + * # } + * ``` + * + * Each channel is identified using a [`ChannelId`], which will change throughout the channel's + * life cycle. Additionally, channels are assigned a `user_channel_id`, which is given in + * [`Event`]s associated with the channel and serves as a fixed identifier but is otherwise unused + * by [`ChannelManager`]. + * + * ## Opening Channels + * + * To an open a channel with a peer, call [`create_channel`]. This will initiate the process of + * opening an outbound channel, which requires self-funding when handling + * [`Event::FundingGenerationReady`]. + * + * ``` + * # use bitcoin::{ScriptBuf, Transaction}; + * # use bitcoin::secp256k1::PublicKey; + * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::events::{Event, EventsProvider}; + * # + * # trait Wallet { + * # fn create_funding_transaction( + * # &self, _amount_sats: u64, _output_script: ScriptBuf + * # ) -> Transaction; + * # } + * # + * # fn example(channel_manager: T, wallet: W, peer_id: PublicKey) { + * # let channel_manager = channel_manager.get_cm(); + * let value_sats = 1_000_000; + * let push_msats = 10_000_000; + * match channel_manager.create_channel(peer_id, value_sats, push_msats, 42, None, None) { + * Ok(channel_id) => println!(\"Opening channel {}\", channel_id), + * Err(e) => println!(\"Error opening channel: {:?}\", e), + * } + * + * // On the event processing thread once the peer has responded + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::FundingGenerationReady { + * temporary_channel_id, counterparty_node_id, channel_value_satoshis, output_script, + * user_channel_id, .. + * } => { + * assert_eq!(user_channel_id, 42); + * let funding_transaction = wallet.create_funding_transaction( + * channel_value_satoshis, output_script + * ); + * match channel_manager.funding_transaction_generated( + * temporary_channel_id, counterparty_node_id, funding_transaction + * ) { + * Ok(()) => println!(\"Funding channel {}\", temporary_channel_id), + * Err(e) => println!(\"Error funding channel {}: {:?}\", temporary_channel_id, e), + * } + * }, + * Event::ChannelPending { channel_id, user_channel_id, former_temporary_channel_id, .. } => { + * assert_eq!(user_channel_id, 42); + * println!( + * \"Channel {} now {} pending (funding transaction has been broadcasted)\", channel_id, + * former_temporary_channel_id.unwrap() + * ); + * }, + * Event::ChannelReady { channel_id, user_channel_id, .. } => { + * assert_eq!(user_channel_id, 42); + * println!(\"Channel {} ready\", channel_id); + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * ## Accepting Channels + * + * Inbound channels are initiated by peers and are automatically accepted unless [`ChannelManager`] + * has [`UserConfig::manually_accept_inbound_channels`] set. In that case, the channel may be + * either accepted or rejected when handling [`Event::OpenChannelRequest`]. + * + * ``` + * # use bitcoin::secp256k1::PublicKey; + * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::events::{Event, EventsProvider}; + * # + * # fn is_trusted(counterparty_node_id: PublicKey) -> bool { + * # // ... + * # unimplemented!() + * # } + * # + * # fn example(channel_manager: T) { + * # let channel_manager = channel_manager.get_cm(); + * # let error_message = \"Channel force-closed\"; + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, .. } => { + * if !is_trusted(counterparty_node_id) { + * match channel_manager.force_close_without_broadcasting_txn( + * &temporary_channel_id, &counterparty_node_id, error_message.to_string() + * ) { + * Ok(()) => println!(\"Rejecting channel {}\", temporary_channel_id), + * Err(e) => println!(\"Error rejecting channel {}: {:?}\", temporary_channel_id, e), + * } + * return Ok(()); + * } + * + * let user_channel_id = 43; + * match channel_manager.accept_inbound_channel( + * &temporary_channel_id, &counterparty_node_id, user_channel_id + * ) { + * Ok(()) => println!(\"Accepting channel {}\", temporary_channel_id), + * Err(e) => println!(\"Error accepting channel {}: {:?}\", temporary_channel_id, e), + * } + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * ## Closing Channels + * + * There are two ways to close a channel: either cooperatively using [`close_channel`] or + * unilaterally using [`force_close_broadcasting_latest_txn`]. The former is ideal as it makes for + * lower fees and immediate access to funds. However, the latter may be necessary if the + * counterparty isn't behaving properly or has gone offline. [`Event::ChannelClosed`] is generated + * once the channel has been closed successfully. + * + * ``` + * # use bitcoin::secp256k1::PublicKey; + * # use lightning::ln::types::ChannelId; + * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::events::{Event, EventsProvider}; + * # + * # fn example( + * # channel_manager: T, channel_id: ChannelId, counterparty_node_id: PublicKey + * # ) { + * # let channel_manager = channel_manager.get_cm(); + * match channel_manager.close_channel(&channel_id, &counterparty_node_id) { + * Ok(()) => println!(\"Closing channel {}\", channel_id), + * Err(e) => println!(\"Error closing channel {}: {:?}\", channel_id, e), + * } + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::ChannelClosed { channel_id, user_channel_id, .. } => { + * assert_eq!(user_channel_id, 42); + * println!(\"Channel {} closed\", channel_id); + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * # Payments + * + * [`ChannelManager`] is responsible for sending, forwarding, and receiving payments through its + * channels. A payment is typically initiated from a [BOLT 11] invoice or a [BOLT 12] offer, though + * spontaneous (i.e., keysend) payments are also possible. Incoming payments don't require + * maintaining any additional state as [`ChannelManager`] can reconstruct the [`PaymentPreimage`] + * from the [`PaymentSecret`]. Sending payments, however, require tracking in order to retry failed + * HTLCs. + * + * After a payment is initiated, it will appear in [`list_recent_payments`] until a short time + * after either an [`Event::PaymentSent`] or [`Event::PaymentFailed`] is handled. Failed HTLCs + * for a payment will be retried according to the payment's [`Retry`] strategy or until + * [`abandon_payment`] is called. + * + * ## BOLT 11 Invoices + * + * The [`lightning-invoice`] crate is useful for creating BOLT 11 invoices. Specifically, use the + * functions in its `utils` module for constructing invoices that are compatible with + * [`ChannelManager`]. These functions serve as a convenience for building invoices with the + * [`PaymentHash`] and [`PaymentSecret`] returned from [`create_inbound_payment`]. To provide your + * own [`PaymentHash`], use [`create_inbound_payment_for_hash`] or the corresponding functions in + * the [`lightning-invoice`] `utils` module. + * + * [`ChannelManager`] generates an [`Event::PaymentClaimable`] once the full payment has been + * received. Call [`claim_funds`] to release the [`PaymentPreimage`], which in turn will result in + * an [`Event::PaymentClaimed`]. + * + * ``` + * # use lightning::events::{Event, EventsProvider, PaymentPurpose}; + * # use lightning::ln::channelmanager::AChannelManager; + * # + * # fn example(channel_manager: T) { + * # let channel_manager = channel_manager.get_cm(); + * // Or use utils::create_invoice_from_channelmanager + * let known_payment_hash = match channel_manager.create_inbound_payment( + * Some(10_000_000), 3600, None + * ) { + * Ok((payment_hash, _payment_secret)) => { + * println!(\"Creating inbound payment {}\", payment_hash); + * payment_hash + * }, + * Err(()) => panic!(\"Error creating inbound payment\"), + * }; + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose { + * PaymentPurpose::Bolt11InvoicePayment { payment_preimage: Some(payment_preimage), .. } => { + * assert_eq!(payment_hash, known_payment_hash); + * println!(\"Claiming payment {}\", payment_hash); + * channel_manager.claim_funds(payment_preimage); + * }, + * PaymentPurpose::Bolt11InvoicePayment { payment_preimage: None, .. } => { + * println!(\"Unknown payment hash: {}\", payment_hash); + * }, + * PaymentPurpose::SpontaneousPayment(payment_preimage) => { + * assert_ne!(payment_hash, known_payment_hash); + * println!(\"Claiming spontaneous payment {}\", payment_hash); + * channel_manager.claim_funds(payment_preimage); + * }, + * // ... + * # _ => {}, + * }, + * Event::PaymentClaimed { payment_hash, amount_msat, .. } => { + * assert_eq!(payment_hash, known_payment_hash); + * println!(\"Claimed {} msats\", amount_msat); + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * For paying an invoice, [`lightning-invoice`] provides a `payment` module with convenience + * functions for use with [`send_payment`]. + * + * ``` + * # use lightning::events::{Event, EventsProvider}; + * # use lightning::ln::types::PaymentHash; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, RecipientOnionFields, Retry}; + * # use lightning::routing::router::RouteParameters; + * # + * # fn example( + * # channel_manager: T, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields, + * # route_params: RouteParameters, retry: Retry + * # ) { + * # let channel_manager = channel_manager.get_cm(); + * // let (payment_hash, recipient_onion, route_params) = + * // payment::payment_parameters_from_invoice(&invoice); + * let payment_id = PaymentId([42; 32]); + * match channel_manager.send_payment( + * payment_hash, recipient_onion, payment_id, route_params, retry + * ) { + * Ok(()) => println!(\"Sending payment with hash {}\", payment_hash), + * Err(e) => println!(\"Failed sending payment with hash {}: {:?}\", payment_hash, e), + * } + * + * let expected_payment_id = payment_id; + * let expected_payment_hash = payment_hash; + * assert!( + * channel_manager.list_recent_payments().iter().find(|details| matches!( + * details, + * RecentPaymentDetails::Pending { + * payment_id: expected_payment_id, + * payment_hash: expected_payment_hash, + * .. + * } + * )).is_some() + * ); + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentSent { payment_hash, .. } => println!(\"Paid {}\", payment_hash), + * Event::PaymentFailed { payment_hash: Some(payment_hash), .. } => + * println!(\"Failed paying {}\", payment_hash), + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * ## BOLT 12 Offers + * + * The [`offers`] module is useful for creating BOLT 12 offers. An [`Offer`] is a precursor to a + * [`Bolt12Invoice`], which must first be requested by the payer. The interchange of these messages + * as defined in the specification is handled by [`ChannelManager`] and its implementation of + * [`OffersMessageHandler`]. However, this only works with an [`Offer`] created using a builder + * returned by [`create_offer_builder`]. With this approach, BOLT 12 offers and invoices are + * stateless just as BOLT 11 invoices are. + * + * ``` + * # use lightning::events::{Event, EventsProvider, PaymentPurpose}; + * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::offers::parse::Bolt12SemanticError; + * # + * # fn example(channel_manager: T) -> Result<(), Bolt12SemanticError> { + * # let channel_manager = channel_manager.get_cm(); + * # let absolute_expiry = None; + * let offer = channel_manager + * .create_offer_builder(absolute_expiry)? + * # ; + * # // Needed for compiling for c_bindings + * # let builder: lightning::offers::offer::OfferBuilder<_, _> = offer.into(); + * # let offer = builder + * .description(\"coffee\".to_string()) + * .amount_msats(10_000_000) + * .build()?; + * let bech32_offer = offer.to_string(); + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose { + * PaymentPurpose::Bolt12OfferPayment { payment_preimage: Some(payment_preimage), .. } => { + * println!(\"Claiming payment {}\", payment_hash); + * channel_manager.claim_funds(payment_preimage); + * }, + * PaymentPurpose::Bolt12OfferPayment { payment_preimage: None, .. } => { + * println!(\"Unknown payment hash: {}\", payment_hash); + * } + * # _ => {}, + * }, + * Event::PaymentClaimed { payment_hash, amount_msat, .. } => { + * println!(\"Claimed {} msats\", amount_msat); + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # Ok(()) + * # } + * ``` + * + * Use [`pay_for_offer`] to initiated payment, which sends an [`InvoiceRequest`] for an [`Offer`] + * and pays the [`Bolt12Invoice`] response. + * + * ``` + * # use lightning::events::{Event, EventsProvider}; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry}; + * # use lightning::offers::offer::Offer; + * # + * # fn example( + * # channel_manager: T, offer: &Offer, quantity: Option, amount_msats: Option, + * # payer_note: Option, retry: Retry, max_total_routing_fee_msat: Option + * # ) { + * # let channel_manager = channel_manager.get_cm(); + * let payment_id = PaymentId([42; 32]); + * match channel_manager.pay_for_offer( + * offer, quantity, amount_msats, payer_note, payment_id, retry, max_total_routing_fee_msat + * ) { + * Ok(()) => println!(\"Requesting invoice for offer\"), + * Err(e) => println!(\"Unable to request invoice for offer: {:?}\", e), + * } + * + * // First the payment will be waiting on an invoice + * let expected_payment_id = payment_id; + * assert!( + * channel_manager.list_recent_payments().iter().find(|details| matches!( + * details, + * RecentPaymentDetails::AwaitingInvoice { payment_id: expected_payment_id } + * )).is_some() + * ); + * + * // Once the invoice is received, a payment will be sent + * assert!( + * channel_manager.list_recent_payments().iter().find(|details| matches!( + * details, + * RecentPaymentDetails::Pending { payment_id: expected_payment_id, .. } + * )).is_some() + * ); + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentSent { payment_id: Some(payment_id), .. } => println!(\"Paid {}\", payment_id), + * Event::PaymentFailed { payment_id, .. } => println!(\"Failed paying {}\", payment_id), + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * ## BOLT 12 Refunds + * + * A [`Refund`] is a request for an invoice to be paid. Like *paying* for an [`Offer`], *creating* + * a [`Refund`] involves maintaining state since it represents a future outbound payment. + * Therefore, use [`create_refund_builder`] when creating one, otherwise [`ChannelManager`] will + * refuse to pay any corresponding [`Bolt12Invoice`] that it receives. + * + * ``` + * # use core::time::Duration; + * # use lightning::events::{Event, EventsProvider}; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry}; + * # use lightning::offers::parse::Bolt12SemanticError; + * # + * # fn example( + * # channel_manager: T, amount_msats: u64, absolute_expiry: Duration, retry: Retry, + * # max_total_routing_fee_msat: Option + * # ) -> Result<(), Bolt12SemanticError> { + * # let channel_manager = channel_manager.get_cm(); + * let payment_id = PaymentId([42; 32]); + * let refund = channel_manager + * .create_refund_builder( + * amount_msats, absolute_expiry, payment_id, retry, max_total_routing_fee_msat + * )? + * # ; + * # // Needed for compiling for c_bindings + * # let builder: lightning::offers::refund::RefundBuilder<_> = refund.into(); + * # let refund = builder + * .description(\"coffee\".to_string()) + * .payer_note(\"refund for order 1234\".to_string()) + * .build()?; + * let bech32_refund = refund.to_string(); + * + * // First the payment will be waiting on an invoice + * let expected_payment_id = payment_id; + * assert!( + * channel_manager.list_recent_payments().iter().find(|details| matches!( + * details, + * RecentPaymentDetails::AwaitingInvoice { payment_id: expected_payment_id } + * )).is_some() + * ); * - * Implements [`ChannelMessageHandler`], handling the multi-channel parts and passing things through - * to individual Channels. + * // Once the invoice is received, a payment will be sent + * assert!( + * channel_manager.list_recent_payments().iter().find(|details| matches!( + * details, + * RecentPaymentDetails::Pending { payment_id: expected_payment_id, .. } + * )).is_some() + * ); + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentSent { payment_id: Some(payment_id), .. } => println!(\"Paid {}\", payment_id), + * Event::PaymentFailed { payment_id, .. } => println!(\"Failed paying {}\", payment_id), + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # Ok(()) + * # } + * ``` + * + * Use [`request_refund_payment`] to send a [`Bolt12Invoice`] for receiving the refund. Similar to + * *creating* an [`Offer`], this is stateless as it represents an inbound payment. + * + * ``` + * # use lightning::events::{Event, EventsProvider, PaymentPurpose}; + * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::offers::refund::Refund; + * # + * # fn example(channel_manager: T, refund: &Refund) { + * # let channel_manager = channel_manager.get_cm(); + * let known_payment_hash = match channel_manager.request_refund_payment(refund) { + * Ok(invoice) => { + * let payment_hash = invoice.payment_hash(); + * println!(\"Requesting refund payment {}\", payment_hash); + * payment_hash + * }, + * Err(e) => panic!(\"Unable to request payment for refund: {:?}\", e), + * }; + * + * // On the event processing thread + * channel_manager.process_pending_events(&|event| { + * match event { + * Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose { + * PaymentPurpose::Bolt12RefundPayment { payment_preimage: Some(payment_preimage), .. } => { + * assert_eq!(payment_hash, known_payment_hash); + * println!(\"Claiming payment {}\", payment_hash); + * channel_manager.claim_funds(payment_preimage); + * }, + * PaymentPurpose::Bolt12RefundPayment { payment_preimage: None, .. } => { + * println!(\"Unknown payment hash: {}\", payment_hash); + * }, + * // ... + * # _ => {}, + * }, + * Event::PaymentClaimed { payment_hash, amount_msat, .. } => { + * assert_eq!(payment_hash, known_payment_hash); + * println!(\"Claimed {} msats\", amount_msat); + * }, + * // ... + * # _ => {}, + * } + * Ok(()) + * }); + * # } + * ``` + * + * # Persistence * * 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 @@ -9652,12 +13070,16 @@ typedef struct LDKRouter { * 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. * + * # `ChannelUpdate` Messages + * * 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. * + * # DoS Mitigation + * * 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 @@ -9667,19 +13089,53 @@ typedef struct LDKRouter { * 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. * + * # Type Aliases + * * 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. * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor + * [`MessageHandler`]: crate::ln::peer_handler::MessageHandler + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * [`PeerManager::read_event`]: crate::ln::peer_handler::PeerManager::read_event + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`timer_tick_occurred`]: Self::timer_tick_occurred + * [`get_and_clear_needs_persistence`]: Self::get_and_clear_needs_persistence + * [`Persister`]: crate::util::persist::Persister + * [`KVStore`]: crate::util::persist::KVStore + * [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future + * [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync + * [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync + * [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor + * [`list_channels`]: Self::list_channels + * [`list_usable_channels`]: Self::list_usable_channels + * [`create_channel`]: Self::create_channel + * [`close_channel`]: Self::force_close_broadcasting_latest_txn + * [`force_close_broadcasting_latest_txn`]: Self::force_close_broadcasting_latest_txn + * [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md + * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md + * [`list_recent_payments`]: Self::list_recent_payments + * [`abandon_payment`]: Self::abandon_payment + * [`lightning-invoice`]: https://docs.rs/lightning_invoice/latest/lightning_invoice + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`claim_funds`]: Self::claim_funds + * [`send_payment`]: Self::send_payment + * [`offers`]: crate::offers + * [`create_offer_builder`]: Self::create_offer_builder + * [`pay_for_offer`]: Self::pay_for_offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`create_refund_builder`]: Self::create_refund_builder + * [`request_refund_payment`]: Self::request_refund_payment * [`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 { @@ -9745,7 +13201,7 @@ typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { } LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; /** - * Options for how to set the max dust HTLC exposure allowed on a channel. See + * Options for how to set the max dust exposure allowed on a channel. See * [`ChannelConfig::max_dust_htlc_exposure`] for details. */ typedef enum LDKMaxDustHTLCExposure_Tag { @@ -9762,19 +13218,17 @@ typedef enum LDKMaxDustHTLCExposure_Tag { */ LDKMaxDustHTLCExposure_FixedLimitMsat, /** - * This sets a multiplier on the estimated high priority feerate (sats/KW, as obtained from - * [`FeeEstimator`]) to determine the maximum allowed dust exposure. If this variant is used - * then the maximum dust exposure in millisatoshis is calculated as: - * `high_priority_feerate_per_kw * value`. For example, with our default value - * `FeeRateMultiplier(5000)`: + * This sets a multiplier on the [`ConfirmationTarget::MaximumFeeEstimate`] feerate (in + * sats/KW) to determine the maximum allowed dust exposure. If this variant is used then the + * maximum dust exposure in millisatoshis is calculated as: + * `feerate_per_kw * value`. For example, with our default value + * `FeeRateMultiplier(10_000)`: * * - For the minimum fee rate of 1 sat/vByte (250 sat/KW, although the minimum - * defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would - * be 253 * 5000 = 1,265,000 msats. + * defaults to 253 sats/KW for rounding, see [`FeeEstimator`]), the max dust exposure would + * be 253 * 10_000 = 2,530,000 msats. * - For a fee rate of 30 sat/vByte (7500 sat/KW), the max dust exposure would be - * 7500 * 5000 = 37,500,000 msats. - * - * This allows the maximum dust exposure to automatically scale with fee rate changes. + * 7500 * 50_000 = 75,000,000 msats (0.00075 BTC). * * Note, if you're using a third-party fee estimator, this may leave you more exposed to a * fee griefing attack, where your fee estimator may purposely overestimate the fee rate, @@ -9789,6 +13243,7 @@ typedef enum LDKMaxDustHTLCExposure_Tag { * by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat. * * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator + * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate */ LDKMaxDustHTLCExposure_FeeRateMultiplier, /** @@ -10183,6 +13638,62 @@ typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { uintptr_t datalen; } LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; + + +/** + * An error type that may be returned to LDK in order to safely abort event handling if it can't + * currently succeed (e.g., due to a persistence failure). + * + * Depending on the type, LDK may ensure the event is persisted and will eventually be replayed. + * Please refer to the documentation of each [`Event`] variant for more details. + */ +typedef struct MUST_USE_STRUCT LDKReplayEvent { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeReplayEvent *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; +} LDKReplayEvent; + +/** + * The contents of CResult_NoneReplayEventZ + */ +typedef union LDKCResult_NoneReplayEventZPtr { + /** + * 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 LDKReplayEvent *err; +} LDKCResult_NoneReplayEventZPtr; + +/** + * A CResult_NoneReplayEventZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::events::ReplayEvent on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneReplayEventZ { + /** + * The contents of this CResult_NoneReplayEventZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneReplayEventZPtr contents; + /** + * Whether this CResult_NoneReplayEventZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneReplayEventZ; + /** * A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. * This corresponds to std::vector in C++ @@ -10319,6 +13830,59 @@ typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { * required to do so. */ uint64_t amount_satoshis; + /** + * The transaction fee we pay for the closing commitment transaction. This amount is not + * included in the [`Balance::ClaimableOnChannelClose::amount_satoshis`] value. + * + * Note that if this channel is inbound (and thus our counterparty pays the commitment + * transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK + * 0.0.124, the channel is always treated as outbound (and thus this value is never zero). + */ + uint64_t transaction_fee_satoshis; + /** + * The amount of millisatoshis which has been burned to fees from HTLCs which are outbound + * from us and are related to a payment which was sent by us. This is the sum of the + * millisatoshis part of all HTLCs which are otherwise represented by + * [`Balance::MaybeTimeoutClaimableHTLC`] with their + * [`Balance::MaybeTimeoutClaimableHTLC::outbound_payment`] flag set, as well as any dust + * HTLCs which would otherwise be represented the same. + * + * This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`. + */ + uint64_t outbound_payment_htlc_rounded_msat; + /** + * The amount of millisatoshis which has been burned to fees from HTLCs which are outbound + * from us and are related to a forwarded HTLC. This is the sum of the millisatoshis part + * of all HTLCs which are otherwise represented by [`Balance::MaybeTimeoutClaimableHTLC`] + * with their [`Balance::MaybeTimeoutClaimableHTLC::outbound_payment`] flag *not* set, as + * well as any dust HTLCs which would otherwise be represented the same. + * + * This amount (rounded up to a whole satoshi value) will not be included in `amount_satoshis`. + */ + uint64_t outbound_forwarded_htlc_rounded_msat; + /** + * The amount of millisatoshis which has been burned to fees from HTLCs which are inbound + * to us and for which we know the preimage. This is the sum of the millisatoshis part of + * all HTLCs which would be represented by [`Balance::ContentiousClaimable`] on channel + * close, but whose current value is included in + * [`Balance::ClaimableOnChannelClose::amount_satoshis`], as well as any dust HTLCs which + * would otherwise be represented the same. + * + * This amount (rounded up to a whole satoshi value) will not be included in the counterparty's + * `amount_satoshis`. + */ + uint64_t inbound_claiming_htlc_rounded_msat; + /** + * The amount of millisatoshis which has been burned to fees from HTLCs which are inbound + * to us and for which we do not know the preimage. This is the sum of the millisatoshis + * part of all HTLCs which would be represented by [`Balance::MaybePreimageClaimableHTLC`] + * on channel close, as well as any dust HTLCs which would otherwise be represented the + * same. + * + * This amount (rounded up to a whole satoshi value) will not be included in the counterparty's + * `amount_satoshis`. + */ + uint64_t inbound_htlc_rounded_msat; } LDKBalance_LDKClaimableOnChannelClose_Body; typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { @@ -10332,6 +13896,10 @@ typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { * amount. */ uint32_t confirmation_height; + /** + * Whether this balance is a result of cooperative close, a force-close, or an HTLC. + */ + enum LDKBalanceSource source; } LDKBalance_LDKClaimableAwaitingConfirmations_Body; typedef struct LDKBalance_LDKContentiousClaimable_Body { @@ -10370,6 +13938,12 @@ typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { * The payment hash whose preimage our counterparty needs to claim this HTLC. */ struct LDKThirtyTwoBytes payment_hash; + /** + * Whether this HTLC represents a payment which was sent outbound from us. Otherwise it + * represents an HTLC which was forwarded (and should, thus, have a corresponding inbound + * edge on another channel). + */ + bool outbound_payment; } LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body; typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { @@ -10553,10 +14127,18 @@ typedef struct LDKOnionMessageContents { * Returns the TLV type identifying the message contents. MUST be >= 64. */ uint64_t (*tlv_type)(const void *this_arg); + /** + * Returns the message type + */ + struct LDKStr (*msg_type)(const void *this_arg); /** * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Return a human-readable "debug" string describing this object + */ + struct LDKStr (*debug_str)(const void *this_arg); /** * Called, if set, after this OnionMessageContents has been cloned into a duplicate object. * The new OnionMessageContents is provided, and should be mutated as needed to perform a @@ -10570,6 +14152,47 @@ typedef struct LDKOnionMessageContents { void (*free)(void *this_arg); } LDKOnionMessageContents; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ { + /** + * The element at position 0 + */ + struct LDKOnionMessageContents a; + /** + * The element at position 1 + */ + struct LDKResponseInstruction b; +} LDKC2Tuple_OnionMessageContentsResponseInstructionZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ or not + */ +typedef enum LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ + */ + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains nothing + */ + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_Tag; + +typedef struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ some; + }; + }; +} LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ; + /** * An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not */ @@ -10631,9 +14254,9 @@ typedef struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ { } LDKCResult_COption_OnionMessageContentsZDecodeErrorZ; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ { +typedef struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ { /** * The element at position 0 */ @@ -10641,28 +14264,24 @@ typedef struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ { /** * The element at position 1 */ - struct LDKDestination b; - /** - * The element at position 2 - */ - struct LDKBlindedPath c; -} LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ; + struct LDKMessageSendInstructions b; +} LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ; /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OnionMessageContentsDestinationBlindedPathZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ { +typedef struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *data; + struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ; +} LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ; /** * An enum which can either contain a crate::lightning::ln::wire::Type or not @@ -10751,35 +14370,41 @@ typedef struct LDKCOption_SocketAddressZ { }; } LDKCOption_SocketAddressZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Details of a connected peer as returned by [`PeerManager::list_peers`]. */ -typedef struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ { +typedef struct MUST_USE_STRUCT LDKPeerDetails { /** - * The element at position 0 + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - struct LDKPublicKey a; + LDKnativePeerDetails *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 LDKCOption_SocketAddressZ b; -} LDKC2Tuple_PublicKeyCOption_SocketAddressZZ; + bool is_owned; +} LDKPeerDetails; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyCOption_SocketAddressZZs of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ { +typedef struct LDKCVec_PeerDetailsZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *data; + struct LDKPeerDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ; +} LDKCVec_PeerDetailsZ; @@ -10951,7 +14576,7 @@ typedef union LDKCResult_u32GraphSyncErrorZPtr { /** * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, - * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure. + * containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ typedef struct LDKCResult_u32GraphSyncErrorZ { @@ -10999,22 +14624,6 @@ typedef struct LDKCResult_CVec_u8ZIOErrorZ { bool result_ok; } LDKCResult_CVec_u8ZIOErrorZ; -/** - * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_StrZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKStr *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_StrZ; - /** * The contents of CResult_CVec_StrZIOErrorZ */ @@ -11131,47 +14740,138 @@ typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; /** - * Represents a valid secp256k1 secret key serialized as a 32 byte array. + * The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ */ -typedef struct LDKSecretKey { +typedef union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { /** - * The bytes of the secret key + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint8_t bytes[32]; -} LDKSecretKey; + struct LDKUnsignedInvoiceRequest *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr; /** - * An enum which can either contain a crate::c_types::SecretKey or not + * A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef enum LDKCOption_SecretKeyZ_Tag { +typedef struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { /** - * When we're in this state, this COption_SecretKeyZ contains a crate::c_types::SecretKey + * The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_SecretKeyZ_Some, + union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr contents; /** - * When we're in this state, this COption_SecretKeyZ contains nothing + * Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state. */ - LDKCOption_SecretKeyZ_None, + bool result_ok; +} LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ; + +/** + * The contents of CResult_InvoiceRequestBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr { /** - * Must be last for serialization purposes + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_SecretKeyZ_Sentinel, -} LDKCOption_SecretKeyZ_Tag; + struct LDKInvoiceRequest *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestBolt12SemanticErrorZ; + -typedef struct LDKCOption_SecretKeyZ { - LDKCOption_SecretKeyZ_Tag tag; - union { - struct { - struct LDKSecretKey some; - }; - }; -} LDKCOption_SecretKeyZ; +/** + * Builds a [`Bolt12Invoice`] from either: + * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or + * - a [`Refund`] for the \"offer for money\" flow. + * + * See [module-level documentation] for usage. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Refund`]: crate::offers::refund::Refund + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKInvoiceWithExplicitSigningPubkeyBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceWithExplicitSigningPubkeyBuilder *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; +} LDKInvoiceWithExplicitSigningPubkeyBuilder; +/** + * The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceWithExplicitSigningPubkeyBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr; /** - * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different - * ways to respond depending on whether the signing keys were derived. + * A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; + + + +/** + * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] and exposes different ways to respond depending + * on whether the signing keys were derived. */ typedef struct MUST_USE_STRUCT LDKVerifiedInvoiceRequest { /** @@ -11220,6 +14920,122 @@ typedef struct LDKCResult_VerifiedInvoiceRequestNoneZ { bool result_ok; } LDKCResult_VerifiedInvoiceRequestNoneZ; + + +/** + * Builds a [`Bolt12Invoice`] from either: + * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or + * - a [`Refund`] for the \"offer for money\" flow. + * + * See [module-level documentation] for usage. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Refund`]: crate::offers::refund::Refund + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKInvoiceWithDerivedSigningPubkeyBuilder { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceWithDerivedSigningPubkeyBuilder *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; +} LDKInvoiceWithDerivedSigningPubkeyBuilder; + +/** + * The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceWithDerivedSigningPubkeyBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; + + + +/** + * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`]. + * + * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFields { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoiceRequestFields *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; +} LDKInvoiceRequestFields; + +/** + * The contents of CResult_InvoiceRequestFieldsDecodeErrorZ + */ +typedef union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequestFields *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_InvoiceRequestFieldsDecodeErrorZPtr; + +/** + * A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequestFields 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_InvoiceRequestFieldsDecodeErrorZ { + /** + * The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestFieldsDecodeErrorZ; + /** * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. * This corresponds to std::vector in C++ @@ -11236,6 +15052,33 @@ typedef struct LDKCVec_WitnessZ { uintptr_t datalen; } LDKCVec_WitnessZ; +/** + * An enum which can either contain a crate::c_types::ECDSASignature or not + */ +typedef enum LDKCOption_ECDSASignatureZ_Tag { + /** + * When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature + */ + LDKCOption_ECDSASignatureZ_Some, + /** + * When we're in this state, this COption_ECDSASignatureZ contains nothing + */ + LDKCOption_ECDSASignatureZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_ECDSASignatureZ_Sentinel, +} LDKCOption_ECDSASignatureZ_Tag; + +typedef struct LDKCOption_ECDSASignatureZ { + LDKCOption_ECDSASignatureZ_Tag tag; + union { + struct { + struct LDKECDSASignature some; + }; + }; +} LDKCOption_ECDSASignatureZ; + /** * An enum which can either contain a i64 or not */ @@ -11547,6 +15390,138 @@ typedef struct LDKCResult_AcceptChannelV2DecodeErrorZ { bool result_ok; } LDKCResult_AcceptChannelV2DecodeErrorZ; +/** + * The contents of CResult_StfuDecodeErrorZ + */ +typedef union LDKCResult_StfuDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStfu *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_StfuDecodeErrorZPtr; + +/** + * A CResult_StfuDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_StfuDecodeErrorZ { + /** + * The contents of this CResult_StfuDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StfuDecodeErrorZPtr contents; + /** + * Whether this CResult_StfuDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StfuDecodeErrorZ; + +/** + * The contents of CResult_SpliceInitDecodeErrorZ + */ +typedef union LDKCResult_SpliceInitDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSpliceInit *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_SpliceInitDecodeErrorZPtr; + +/** + * A CResult_SpliceInitDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SpliceInit 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_SpliceInitDecodeErrorZ { + /** + * The contents of this CResult_SpliceInitDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceInitDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceInitDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceInitDecodeErrorZ; + +/** + * The contents of CResult_SpliceAckDecodeErrorZ + */ +typedef union LDKCResult_SpliceAckDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSpliceAck *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_SpliceAckDecodeErrorZPtr; + +/** + * A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SpliceAckDecodeErrorZ { + /** + * The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceAckDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceAckDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceAckDecodeErrorZ; + +/** + * The contents of CResult_SpliceLockedDecodeErrorZ + */ +typedef union LDKCResult_SpliceLockedDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSpliceLocked *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_SpliceLockedDecodeErrorZPtr; + +/** + * A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SpliceLockedDecodeErrorZ { + /** + * The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SpliceLockedDecodeErrorZPtr contents; + /** + * Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SpliceLockedDecodeErrorZ; + /** * The contents of CResult_TxAddInputDecodeErrorZ */ @@ -12001,6 +15976,59 @@ typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ { +/** + * Optional batch parameters for `commitment_signed` message. + */ +typedef struct MUST_USE_STRUCT LDKCommitmentSignedBatch { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCommitmentSignedBatch *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; +} LDKCommitmentSignedBatch; + +/** + * The contents of CResult_CommitmentSignedBatchDecodeErrorZ + */ +typedef union LDKCResult_CommitmentSignedBatchDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCommitmentSignedBatch *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_CommitmentSignedBatchDecodeErrorZPtr; + +/** + * A CResult_CommitmentSignedBatchDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::CommitmentSignedBatch 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_CommitmentSignedBatchDecodeErrorZ { + /** + * The contents of this CResult_CommitmentSignedBatchDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CommitmentSignedBatchDecodeErrorZPtr contents; + /** + * Whether this CResult_CommitmentSignedBatchDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CommitmentSignedBatchDecodeErrorZ; + + + /** * A [`commitment_signed`] message to be sent to or received from a peer. * @@ -12494,6 +16522,39 @@ typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ { bool result_ok; } LDKCResult_UpdateFulfillHTLCDecodeErrorZ; +/** + * The contents of CResult_OnionPacketDecodeErrorZ + */ +typedef union LDKCResult_OnionPacketDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionPacket *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_OnionPacketDecodeErrorZPtr; + +/** + * A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionPacketDecodeErrorZ { + /** + * The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionPacketDecodeErrorZPtr contents; + /** + * Whether this CResult_OnionPacketDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionPacketDecodeErrorZ; + /** * The contents of CResult_UpdateAddHTLCDecodeErrorZ */ @@ -12581,6 +16642,39 @@ typedef struct LDKCResult_OnionMessageDecodeErrorZ { bool result_ok; } LDKCResult_OnionMessageDecodeErrorZ; +/** + * The contents of CResult_FinalOnionHopDataDecodeErrorZ + */ +typedef union LDKCResult_FinalOnionHopDataDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKFinalOnionHopData *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_FinalOnionHopDataDecodeErrorZPtr; + +/** + * A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_FinalOnionHopDataDecodeErrorZ { + /** + * The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_FinalOnionHopDataDecodeErrorZPtr contents; + /** + * Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_FinalOnionHopDataDecodeErrorZ; + /** @@ -13146,115 +17240,467 @@ typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ { } LDKCResult_GossipTimestampFilterDecodeErrorZ; /** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not */ -typedef struct LDKCVec_PhantomRouteHintsZ { +typedef enum LDKCOption_InboundHTLCStateDetailsZ_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_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails */ - struct LDKPhantomRouteHints *data; + LDKCOption_InboundHTLCStateDetailsZ_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing */ - uintptr_t datalen; -} LDKCVec_PhantomRouteHintsZ; + LDKCOption_InboundHTLCStateDetailsZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_InboundHTLCStateDetailsZ_Sentinel, +} LDKCOption_InboundHTLCStateDetailsZ_Tag; +typedef struct LDKCOption_InboundHTLCStateDetailsZ { + LDKCOption_InboundHTLCStateDetailsZ_Tag tag; + union { + struct { + enum LDKInboundHTLCStateDetails some; + }; + }; +} LDKCOption_InboundHTLCStateDetailsZ; +/** + * The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ + */ +typedef union LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_InboundHTLCStateDetailsZ *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_InboundHTLCStateDetailsZDecodeErrorZPtr; /** - * Represents a syntactically and semantically correct lightning BOLT11 invoice. - * - * There are three ways to construct a `Bolt11Invoice`: - * 1. using [`InvoiceBuilder`] - * 2. using [`Bolt11Invoice::from_signed`] - * 3. using `str::parse::(&str)` (see [`Bolt11Invoice::from_str`]) - * - * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr + * A CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKBolt11Invoice { +typedef struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + /** + * The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; + + + +/** + * Exposes details around pending inbound HTLCs. + */ +typedef struct MUST_USE_STRUCT LDKInboundHTLCDetails { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBolt11Invoice *inner; + LDKnativeInboundHTLCDetails *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; -} LDKBolt11Invoice; +} LDKInboundHTLCDetails; /** - * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`] - * may occur. + * The contents of CResult_InboundHTLCDetailsDecodeErrorZ */ -typedef enum LDKSignOrCreationError_Tag { +typedef union LDKCResult_InboundHTLCDetailsDecodeErrorZPtr { /** - * An error occurred during signing + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKSignOrCreationError_SignError, + struct LDKInboundHTLCDetails *result; /** - * An error occurred while building the transaction + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKSignOrCreationError_CreationError, + struct LDKDecodeError *err; +} LDKCResult_InboundHTLCDetailsDecodeErrorZPtr; + +/** + * A CResult_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::InboundHTLCDetails 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_InboundHTLCDetailsDecodeErrorZ { + /** + * The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InboundHTLCDetailsDecodeErrorZPtr contents; + /** + * Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InboundHTLCDetailsDecodeErrorZ; + +/** + * An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not + */ +typedef enum LDKCOption_OutboundHTLCStateDetailsZ_Tag { + /** + * When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + */ + LDKCOption_OutboundHTLCStateDetailsZ_Some, + /** + * When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing + */ + LDKCOption_OutboundHTLCStateDetailsZ_None, /** * Must be last for serialization purposes */ - LDKSignOrCreationError_Sentinel, -} LDKSignOrCreationError_Tag; + LDKCOption_OutboundHTLCStateDetailsZ_Sentinel, +} LDKCOption_OutboundHTLCStateDetailsZ_Tag; -typedef struct MUST_USE_STRUCT LDKSignOrCreationError { - LDKSignOrCreationError_Tag tag; +typedef struct LDKCOption_OutboundHTLCStateDetailsZ { + LDKCOption_OutboundHTLCStateDetailsZ_Tag tag; union { struct { - enum LDKCreationError creation_error; + enum LDKOutboundHTLCStateDetails some; }; }; -} LDKSignOrCreationError; +} LDKCOption_OutboundHTLCStateDetailsZ; /** - * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ + * The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ */ -typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr { +typedef union LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBolt11Invoice *result; + struct LDKCOption_OutboundHTLCStateDetailsZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKSignOrCreationError *err; -} LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr; /** - * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. + * A CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ 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_Bolt11InvoiceSignOrCreationErrorZ { +typedef struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { /** - * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either + * The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents; + union LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr contents; /** - * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. + * Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; +} LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ; + + + +/** + * Exposes details around pending outbound HTLCs. + */ +typedef struct MUST_USE_STRUCT LDKOutboundHTLCDetails { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOutboundHTLCDetails *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; +} LDKOutboundHTLCDetails; + +/** + * The contents of CResult_OutboundHTLCDetailsDecodeErrorZ + */ +typedef union LDKCResult_OutboundHTLCDetailsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOutboundHTLCDetails *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_OutboundHTLCDetailsDecodeErrorZPtr; + +/** + * A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::OutboundHTLCDetails 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_OutboundHTLCDetailsDecodeErrorZ { + /** + * The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OutboundHTLCDetailsDecodeErrorZPtr contents; + /** + * Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OutboundHTLCDetailsDecodeErrorZ; + + + +/** + * Information needed for constructing an invoice route hint for this channel. + */ +typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeCounterpartyForwardingInfo *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKCounterpartyForwardingInfo; + +/** + * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ + */ +typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCounterpartyForwardingInfo *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_CounterpartyForwardingInfoDecodeErrorZPtr; + +/** + * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo 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_CounterpartyForwardingInfoDecodeErrorZ { + /** + * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; + + + +/** + * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] + * to better separate parameters. + */ +typedef struct MUST_USE_STRUCT LDKChannelCounterparty { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelCounterparty *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; +} LDKChannelCounterparty; + +/** + * The contents of CResult_ChannelCounterpartyDecodeErrorZ + */ +typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelCounterparty *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_ChannelCounterpartyDecodeErrorZPtr; + +/** + * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::ChannelCounterparty 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_ChannelCounterpartyDecodeErrorZ { + /** + * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelCounterpartyDecodeErrorZ; + +/** + * An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not + */ +typedef enum LDKCOption_ChannelShutdownStateZ_Tag { + /** + * When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState + */ + LDKCOption_ChannelShutdownStateZ_Some, + /** + * When we're in this state, this COption_ChannelShutdownStateZ contains nothing + */ + LDKCOption_ChannelShutdownStateZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_ChannelShutdownStateZ_Sentinel, +} LDKCOption_ChannelShutdownStateZ_Tag; + +typedef struct LDKCOption_ChannelShutdownStateZ { + LDKCOption_ChannelShutdownStateZ_Tag tag; + union { + struct { + enum LDKChannelShutdownState some; + }; + }; +} LDKCOption_ChannelShutdownStateZ; + +/** + * A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_InboundHTLCDetailsZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKInboundHTLCDetails *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_InboundHTLCDetailsZ; + +/** + * A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_OutboundHTLCDetailsZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKOutboundHTLCDetails *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_OutboundHTLCDetailsZ; + +/** + * The contents of CResult_ChannelDetailsDecodeErrorZ + */ +typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelDetails *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_ChannelDetailsDecodeErrorZPtr; + +/** + * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::ChannelDetails 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_ChannelDetailsDecodeErrorZ { + /** + * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelDetailsDecodeErrorZ; + +/** + * The contents of CResult_ChannelShutdownStateDecodeErrorZ + */ +typedef union LDKCResult_ChannelShutdownStateDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + enum LDKChannelShutdownState *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_ChannelShutdownStateDecodeErrorZPtr; + +/** + * A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_state::ChannelShutdownState 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_ChannelShutdownStateDecodeErrorZ { + /** + * The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelShutdownStateDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelShutdownStateDecodeErrorZ; /** * 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 { /** @@ -13287,6 +17733,105 @@ typedef struct LDKCVec_FutureZ { uintptr_t datalen; } LDKCVec_FutureZ; +/** + * The contents of CResult_HeldHtlcAvailableDecodeErrorZ + */ +typedef union LDKCResult_HeldHtlcAvailableDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHeldHtlcAvailable *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_HeldHtlcAvailableDecodeErrorZPtr; + +/** + * A CResult_HeldHtlcAvailableDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::HeldHtlcAvailable 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_HeldHtlcAvailableDecodeErrorZ { + /** + * The contents of this CResult_HeldHtlcAvailableDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HeldHtlcAvailableDecodeErrorZPtr contents; + /** + * Whether this CResult_HeldHtlcAvailableDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_HeldHtlcAvailableDecodeErrorZ; + +/** + * The contents of CResult_ReleaseHeldHtlcDecodeErrorZ + */ +typedef union LDKCResult_ReleaseHeldHtlcDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKReleaseHeldHtlc *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_ReleaseHeldHtlcDecodeErrorZPtr; + +/** + * A CResult_ReleaseHeldHtlcDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::ReleaseHeldHtlc 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_ReleaseHeldHtlcDecodeErrorZ { + /** + * The contents of this CResult_ReleaseHeldHtlcDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ReleaseHeldHtlcDecodeErrorZPtr contents; + /** + * Whether this CResult_ReleaseHeldHtlcDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ReleaseHeldHtlcDecodeErrorZ; + +/** + * The contents of CResult_AsyncPaymentsMessageDecodeErrorZ + */ +typedef union LDKCResult_AsyncPaymentsMessageDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKAsyncPaymentsMessage *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_AsyncPaymentsMessageDecodeErrorZPtr; + +/** + * A CResult_AsyncPaymentsMessageDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::AsyncPaymentsMessage 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_AsyncPaymentsMessageDecodeErrorZ { + /** + * The contents of this CResult_AsyncPaymentsMessageDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_AsyncPaymentsMessageDecodeErrorZPtr contents; + /** + * Whether this CResult_AsyncPaymentsMessageDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_AsyncPaymentsMessageDecodeErrorZ; + /** * The contents of CResult_OffersMessageDecodeErrorZ */ @@ -13947,7 +18492,7 @@ typedef struct LDKCResult_ShutdownScriptDecodeErrorZ { /** - * An error occurring when converting from [`Script`] to [`ShutdownScript`]. + * An error occurring when converting from [`ScriptBuf`] to [`ShutdownScript`]. */ typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript { /** @@ -13997,15 +18542,107 @@ typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { bool result_ok; } LDKCResult_ShutdownScriptInvalidShutdownScriptZ; +/** + * `FundingInfo` holds information about a channel's funding transaction. + * + * When LDK is set to manual propagation of the funding transaction + * (via [`ChannelManager::unsafe_manual_funding_transaction_generated`), + * LDK does not have the full transaction data. Instead, the `OutPoint` + * for the funding is provided here. + * + * [`ChannelManager::unsafe_manual_funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::unsafe_manual_funding_transaction_generated + */ +typedef enum LDKFundingInfo_Tag { + /** + * The full funding `Transaction`. + */ + LDKFundingInfo_Tx, + /** + * The `OutPoint` of the funding. + */ + LDKFundingInfo_OutPoint, + /** + * Must be last for serialization purposes + */ + LDKFundingInfo_Sentinel, +} LDKFundingInfo_Tag; + +typedef struct LDKFundingInfo_LDKTx_Body { + /** + * The funding transaction + */ + struct LDKTransaction transaction; +} LDKFundingInfo_LDKTx_Body; + +typedef struct LDKFundingInfo_LDKOutPoint_Body { + /** + * The outpoint of the funding + */ + struct LDKOutPoint outpoint; +} LDKFundingInfo_LDKOutPoint_Body; + +typedef struct MUST_USE_STRUCT LDKFundingInfo { + LDKFundingInfo_Tag tag; + union { + LDKFundingInfo_LDKTx_Body tx; + LDKFundingInfo_LDKOutPoint_Body out_point; + }; +} LDKFundingInfo; + +/** + * The contents of CResult_FundingInfoDecodeErrorZ + */ +typedef union LDKCResult_FundingInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKFundingInfo *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_FundingInfoDecodeErrorZPtr; + +/** + * A CResult_FundingInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::FundingInfo 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_FundingInfoDecodeErrorZ { + /** + * The contents of this CResult_FundingInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_FundingInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_FundingInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_FundingInfoDecodeErrorZ; + /** * Some information provided on receipt of payment depends on whether the payment received is a * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice. */ typedef enum LDKPaymentPurpose_Tag { /** - * Information for receiving a payment that we generated an invoice for. + * A payment for a BOLT 11 invoice. + */ + LDKPaymentPurpose_Bolt11InvoicePayment, + /** + * A payment for a BOLT 12 [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer */ - LDKPaymentPurpose_InvoicePayment, + LDKPaymentPurpose_Bolt12OfferPayment, + /** + * A payment for a BOLT 12 [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund + */ + LDKPaymentPurpose_Bolt12RefundPayment, /** * Because this is a spontaneous payment, the payer generated their own preimage rather than us * (the payee) providing a preimage. @@ -14017,11 +18654,12 @@ typedef enum LDKPaymentPurpose_Tag { LDKPaymentPurpose_Sentinel, } LDKPaymentPurpose_Tag; -typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { +typedef struct LDKPaymentPurpose_LDKBolt11InvoicePayment_Body { /** * The preimage to the payment_hash, if the payment hash (and secret) were fetched via - * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to - * [`ChannelManager::claim_funds`]. + * [`ChannelManager::create_inbound_payment`]. When handling [`Event::PaymentClaimable`], + * this can be passed directly to [`ChannelManager::claim_funds`] to claim the payment. No + * action is needed when seen in [`Event::PaymentClaimed`]. * * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds @@ -14040,12 +18678,64 @@ typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash */ struct LDKThirtyTwoBytes payment_secret; -} LDKPaymentPurpose_LDKInvoicePayment_Body; +} LDKPaymentPurpose_LDKBolt11InvoicePayment_Body; + +typedef struct LDKPaymentPurpose_LDKBolt12OfferPayment_Body { + /** + * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be + * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed + * when seen in [`Event::PaymentClaimed`]. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + */ + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; + /** + * The secret used to authenticate the sender to the recipient, preventing a number of + * de-anonymization attacks while routing a payment. + * + * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. + */ + struct LDKThirtyTwoBytes payment_secret; + /** + * The context of the payment such as information about the corresponding [`Offer`] and + * [`InvoiceRequest`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKBolt12OfferContext payment_context; +} LDKPaymentPurpose_LDKBolt12OfferPayment_Body; + +typedef struct LDKPaymentPurpose_LDKBolt12RefundPayment_Body { + /** + * The preimage to the payment hash. When handling [`Event::PaymentClaimable`], this can be + * passed directly to [`ChannelManager::claim_funds`], if provided. No action is needed + * when seen in [`Event::PaymentClaimed`]. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + */ + struct LDKCOption_ThirtyTwoBytesZ payment_preimage; + /** + * The secret used to authenticate the sender to the recipient, preventing a number of + * de-anonymization attacks while routing a payment. + * + * See [`PaymentPurpose::Bolt11InvoicePayment::payment_secret`] for further details. + */ + struct LDKThirtyTwoBytes payment_secret; + /** + * The context of the payment such as information about the corresponding [`Refund`]. + * + * [`Refund`]: crate::offers::refund::Refund + */ + struct LDKBolt12RefundContext payment_context; +} LDKPaymentPurpose_LDKBolt12RefundPayment_Body; typedef struct MUST_USE_STRUCT LDKPaymentPurpose { LDKPaymentPurpose_Tag tag; union { - LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; + LDKPaymentPurpose_LDKBolt11InvoicePayment_Body bolt11_invoice_payment; + LDKPaymentPurpose_LDKBolt12OfferPayment_Body bolt12_offer_payment; + LDKPaymentPurpose_LDKBolt12RefundPayment_Body bolt12_refund_payment; struct { struct LDKThirtyTwoBytes spontaneous_payment; }; @@ -14247,127 +18937,6 @@ typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ { bool result_ok; } LDKCResult_COption_PathFailureZDecodeErrorZ; - - -/** - * Struct to `Display` fields in a safe way using `PrintableString` - */ -typedef struct MUST_USE_STRUCT LDKUntrustedString { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUntrustedString *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; -} LDKUntrustedString; - -/** - * The reason the channel was closed. See individual variants for more details. - */ -typedef enum LDKClosureReason_Tag { - /** - * Closure generated from receiving a peer error message. - * - * Our counterparty may have broadcasted their latest commitment state, and we have - * as well. - */ - LDKClosureReason_CounterpartyForceClosed, - /** - * Closure generated from [`ChannelManager::force_close_channel`], called by the user. - * - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. - */ - LDKClosureReason_HolderForceClosed, - /** - * The channel was closed after negotiating a cooperative close and we've now broadcasted - * the cooperative close transaction. Note the shutdown may have been initiated by us. - */ - LDKClosureReason_CooperativeClosure, - /** - * A commitment transaction was confirmed on chain, closing the channel. Most likely this - * commitment transaction came from our counterparty, but it may also have come from - * a copy of our own `ChannelMonitor`. - */ - LDKClosureReason_CommitmentTxConfirmed, - /** - * The funding transaction failed to confirm in a timely manner on an inbound channel. - */ - LDKClosureReason_FundingTimedOut, - /** - * Closure generated from processing an event, likely a HTLC forward/relay/reception. - */ - LDKClosureReason_ProcessingError, - /** - * The peer disconnected prior to funding completing. In this case the spec mandates that we - * forget the channel entirely - we can attempt again if the peer reconnects. - * - * This includes cases where we restarted prior to funding completion, including prior to the - * initial [`ChannelMonitor`] persistence completing. - * - * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the - * peer because of mutual incompatibility between us and our channel counterparty. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ - LDKClosureReason_DisconnectedPeer, - /** - * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than - * the [`ChannelManager`] deserialized. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - LDKClosureReason_OutdatedChannelManager, - /** - * The counterparty requested a cooperative close of a channel that had not been funded yet. - * The channel has been immediately closed. - */ - LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, - /** - * Another channel in the same funding batch closed before the funding transaction - * was ready to be broadcast. - */ - LDKClosureReason_FundingBatchClosure, - /** - * Must be last for serialization purposes - */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; - -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { - /** - * The error which the peer sent us. - * - * 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` - * - * [`UntrustedString`]: crate::util::string::UntrustedString - */ - struct LDKUntrustedString peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { - /** - * A developer-readable error message which we generated. - */ - struct LDKStr err; -} LDKClosureReason_LDKProcessingError_Body; - -typedef struct MUST_USE_STRUCT LDKClosureReason { - LDKClosureReason_Tag tag; - union { - LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; - LDKClosureReason_LDKProcessingError_Body processing_error; - }; -} LDKClosureReason; - /** * An enum which can either contain a crate::lightning::events::ClosureReason or not */ @@ -14446,6 +19015,10 @@ typedef enum LDKHTLCDestination_Tag { * intercept HTLC. */ LDKHTLCDestination_InvalidForward, + /** + * We couldn't decode the incoming onion to obtain the forwarding details. + */ + LDKHTLCDestination_InvalidOnion, /** * Failure scenario where an HTLC may have been forwarded to be intended for us, * but is invalid for some reason, so we reject it. @@ -14477,7 +19050,7 @@ typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { /** * The outgoing `channel_id` between us and the next node. */ - struct LDKThirtyTwoBytes channel_id; + struct LDKChannelId channel_id; } LDKHTLCDestination_LDKNextHopChannel_Body; typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { @@ -14572,37 +19145,64 @@ typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { } LDKCResult_COption_HTLCDestinationZDecodeErrorZ; /** - * The contents of CResult_PaymentFailureReasonDecodeErrorZ + * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not + */ +typedef enum LDKCOption_PaymentFailureReasonZ_Tag { + /** + * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason + */ + LDKCOption_PaymentFailureReasonZ_Some, + /** + * When we're in this state, this COption_PaymentFailureReasonZ contains nothing + */ + LDKCOption_PaymentFailureReasonZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_PaymentFailureReasonZ_Sentinel, +} LDKCOption_PaymentFailureReasonZ_Tag; + +typedef struct LDKCOption_PaymentFailureReasonZ { + LDKCOption_PaymentFailureReasonZ_Tag tag; + union { + struct { + enum LDKPaymentFailureReason some; + }; + }; +} LDKCOption_PaymentFailureReasonZ; + +/** + * The contents of CResult_COption_PaymentFailureReasonZDecodeErrorZ */ -typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr { +typedef union LDKCResult_COption_PaymentFailureReasonZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKPaymentFailureReason *result; + struct LDKCOption_PaymentFailureReasonZ *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_PaymentFailureReasonDecodeErrorZPtr; +} LDKCResult_COption_PaymentFailureReasonZDecodeErrorZPtr; /** - * 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. + * A CResult_COption_PaymentFailureReasonZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_PaymentFailureReasonZ 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 { +typedef struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ { /** - * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either + * The contents of this CResult_COption_PaymentFailureReasonZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents; + union LDKCResult_COption_PaymentFailureReasonZDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state. + * Whether this CResult_COption_PaymentFailureReasonZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentFailureReasonDecodeErrorZ; +} LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ; /** * An enum which can either contain a crate::c_types::U128 or not @@ -14647,32 +19247,47 @@ typedef struct LDKCVec_ClaimedHTLCZ { uintptr_t datalen; } LDKCVec_ClaimedHTLCZ; + + /** - * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not + * The `Responder` struct creates an appropriate [`ResponseInstruction`] for responding to a + * message. */ -typedef enum LDKCOption_PaymentFailureReasonZ_Tag { +typedef struct MUST_USE_STRUCT LDKResponder { /** - * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_PaymentFailureReasonZ_Some, + LDKnativeResponder *inner; /** - * When we're in this state, this COption_PaymentFailureReasonZ contains nothing + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKCOption_PaymentFailureReasonZ_None, + bool is_owned; +} LDKResponder; + + + +/** + * A subset of [`CommonOpenChannelFields`], containing various parameters which are set by the + * channel initiator and which are not part of the channel funding transaction. + */ +typedef struct MUST_USE_STRUCT LDKChannelParameters { /** - * Must be last for serialization purposes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_PaymentFailureReasonZ_Sentinel, -} LDKCOption_PaymentFailureReasonZ_Tag; - -typedef struct LDKCOption_PaymentFailureReasonZ { - LDKCOption_PaymentFailureReasonZ_Tag tag; - union { - struct { - enum LDKPaymentFailureReason some; - }; - }; -} LDKCOption_PaymentFailureReasonZ; + LDKnativeChannelParameters *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; +} LDKChannelParameters; @@ -14735,8 +19350,8 @@ typedef enum LDKBumpTransactionEvent_Tag { * an empty `pending_htlcs`), confirmation of the commitment transaction can be considered to * be not urgent. * - * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::EcdsaChannelSigner::sign_holder_anchor_input + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness */ LDKBumpTransactionEvent_ChannelClose, @@ -14768,8 +19383,8 @@ typedef enum LDKBumpTransactionEvent_Tag { * longer able to commit external confirmed funds to the HTLC transaction or the fee committed * to the HTLC transaction is greater in value than the HTLCs being claimed. * - * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction + * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner + * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction */ LDKBumpTransactionEvent_HTLCResolution, /** @@ -14779,6 +19394,14 @@ typedef enum LDKBumpTransactionEvent_Tag { } LDKBumpTransactionEvent_Tag; typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body { + /** + * The `channel_id` of the channel which has been closed. + */ + struct LDKChannelId channel_id; + /** + * Counterparty in the closed channel. + */ + struct LDKPublicKey counterparty_node_id; /** * The unique identifier for the claim of the anchor output in the commitment transaction. * @@ -14816,6 +19439,14 @@ typedef struct LDKBumpTransactionEvent_LDKChannelClose_Body { } LDKBumpTransactionEvent_LDKChannelClose_Body; typedef struct LDKBumpTransactionEvent_LDKHTLCResolution_Body { + /** + * The `channel_id` of the channel which has been closed. + */ + struct LDKChannelId channel_id; + /** + * Counterparty in the closed channel. + */ + struct LDKPublicKey counterparty_node_id; /** * The unique identifier for the claim of the HTLCs in the confirmed commitment * transaction. @@ -14863,10 +19494,29 @@ typedef enum LDKEvent_Tag { * Note that *all inputs* in the funding transaction must spend SegWit outputs or your * counterparty can steal your funds! * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`), but won't be persisted across restarts. + * * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ LDKEvent_FundingGenerationReady, + /** + * Used to indicate that the counterparty node has provided the signature(s) required to + * recover our funds in case they go offline. + * + * It is safe (and your responsibility) to broadcast the funding transaction upon receiving this + * event. + * + * This event is only emitted if you called + * [`ChannelManager::unsafe_manual_funding_transaction_generated`] instead of + * [`ChannelManager::funding_transaction_generated`]. + * + * [`ChannelManager::unsafe_manual_funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::unsafe_manual_funding_transaction_generated + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + */ + LDKEvent_FundingTxBroadcastSafe, /** * 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`]. @@ -14897,6 +19547,10 @@ typedef enum LDKEvent_Tag { * # Note * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds * [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs * [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload @@ -14918,26 +19572,64 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get * multiple `PaymentClaimed` events. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ LDKEvent_PaymentClaimed, /** - * Indicates a request for an invoice failed to yield a response in a reasonable amount of time - * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an - * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed. + * Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`]. + * + * Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a + * [`Destination`]. Once a connection is established, any messages buffered by an + * [`OnionMessageHandler`] may be sent. + * + * This event will not be generated for onion message forwards; only for sends including + * replies. Handlers should connect to the node otherwise any buffered messages may be lost. + * + * # Failure Behavior and Persistence + * This event won't be replayed after failures-to-handle + * (i.e., the event handler returning `Err(ReplayEvent ())`), and also won't be persisted + * across restarts. + * + * [`OnionMessage`]: msgs::OnionMessage + * [`MessageRouter`]: crate::onion_message::messenger::MessageRouter + * [`Destination`]: crate::onion_message::messenger::Destination + * [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler + */ + LDKEvent_ConnectionNeeded, + /** + * Indicates a [`Bolt12Invoice`] in response to an [`InvoiceRequest`] or a [`Refund`] was + * received. + * + * This event will only be generated if [`UserConfig::manually_handle_bolt12_invoices`] is set. + * Use [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or + * [`ChannelManager::abandon_payment`] to abandon the associated payment. See those docs for + * further details. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Offer`]: crate::offers::offer::Offer * [`Refund`]: crate::offers::refund::Refund + * [`UserConfig::manually_handle_bolt12_invoices`]: crate::util::config::UserConfig::manually_handle_bolt12_invoices + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ - LDKEvent_InvoiceRequestFailed, + LDKEvent_InvoiceReceived, /** * 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. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_PaymentSent, /** @@ -14953,6 +19645,10 @@ typedef enum LDKEvent_Tag { * received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored, * and the payment MUST be treated as having succeeded. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`Retry`]: crate::ln::channelmanager::Retry * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ @@ -14962,6 +19658,10 @@ typedef enum LDKEvent_Tag { * * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See * [`Event::PaymentSent`] for obtaining the payment preimage. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_PaymentPathSuccessful, /** @@ -14974,21 +19674,37 @@ typedef enum LDKEvent_Tag { * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have * been exhausted. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ LDKEvent_PaymentPathFailed, /** * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ProbeSuccessful, /** * Indicates that a probe payment we sent failed at an intermediary node on the path. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ProbeFailed, /** * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at * a time in the future. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be regenerated after restarts. + * * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ LDKEvent_PendingHTLCsForwardable, @@ -15001,6 +19717,10 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See * their docs for more information. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`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 @@ -15010,14 +19730,28 @@ typedef enum LDKEvent_Tag { /** * 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 + * + * Such an output will *never* be spent directly by LDK, 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. + * + * You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending + * transactions for you. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * + * [`OutputSweeper`]: crate::util::sweep::OutputSweeper */ LDKEvent_SpendableOutputs, /** * This event is generated when a payment has been successfully forwarded through us and a * forwarding fee earned. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_PaymentForwarded, /** @@ -15027,6 +19761,10 @@ typedef enum LDKEvent_Tag { * 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. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ChannelPending, /** @@ -15034,11 +19772,15 @@ typedef enum LDKEvent_Tag { * 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. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ChannelReady, /** - * Used to indicate that a previously opened channel with the given `channel_id` is in the - * process of closure. + * Used to indicate that a channel that got past the initial handshake with the given `channel_id` is in the + * process of closure. This includes previously opened channels, and channels that time out from not being funded. * * Note that this event is only triggered for accepted channels: if the * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is @@ -15046,6 +19788,10 @@ typedef enum LDKEvent_Tag { * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ChannelClosed, /** @@ -15053,6 +19799,10 @@ typedef enum LDKEvent_Tag { * inputs for another purpose. * * This event is not guaranteed to be generated for channels that are closed due to a restart. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_DiscardFunding, /** @@ -15065,6 +19815,10 @@ typedef enum LDKEvent_Tag { * 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. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * * [`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 @@ -15083,6 +19837,10 @@ typedef enum LDKEvent_Tag { * * 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). + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_HTLCHandlingFailed, /** @@ -15093,9 +19851,40 @@ typedef enum LDKEvent_Tag { * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true. * It is limited to the scope of channels with anchor outputs. * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts. + * * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx */ LDKEvent_BumpTransaction, + /** + * We received an onion message that is intended to be forwarded to a peer + * that is currently offline. This event will only be generated if the + * `OnionMessenger` was initialized with + * [`OnionMessenger::new_with_offline_peer_interception`], see its docs. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`), but won't be persisted across restarts. + * + * [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception + */ + LDKEvent_OnionMessageIntercepted, + /** + * Indicates that an onion message supporting peer has come online and it may + * be time to forward any onion messages that were previously intercepted for + * them. This event will only be generated if the `OnionMessenger` was + * initialized with + * [`OnionMessenger::new_with_offline_peer_interception`], see its docs. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`), but won't be persisted across restarts. + * + * [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception + */ + LDKEvent_OnionMessagePeerConnected, /** * Must be last for serialization purposes */ @@ -15109,7 +19898,7 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { * * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - struct LDKThirtyTwoBytes temporary_channel_id; + struct LDKChannelId temporary_channel_id; /** * The counterparty's node_id, which you'll need to pass back into * [`ChannelManager::funding_transaction_generated`]. @@ -15139,6 +19928,31 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { struct LDKU128 user_channel_id; } LDKEvent_LDKFundingGenerationReady_Body; +typedef struct LDKEvent_LDKFundingTxBroadcastSafe_Body { + /** + * The `channel_id` indicating which channel has reached this stage. + */ + struct LDKChannelId channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`]. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + */ + struct LDKU128 user_channel_id; + /** + * The outpoint of the channel's funding transaction. + */ + struct LDKOutPoint funding_txo; + /** + * The `node_id` of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The `temporary_channel_id` this channel used to be known by during channel establishment. + */ + struct LDKChannelId former_temporary_channel_id; +} LDKEvent_LDKFundingTxBroadcastSafe_Body; + typedef struct LDKEvent_LDKPaymentClaimable_Body { /** * The node that will receive the payment after it has been claimed. @@ -15195,8 +20009,10 @@ typedef struct LDKEvent_LDKPaymentClaimable_Body { struct LDKPaymentPurpose purpose; /** * The `channel_id` indicating over which channel we received the payment. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCOption_ThirtyTwoBytesZ via_channel_id; + struct LDKChannelId via_channel_id; /** * The `user_channel_id` indicating over which channel we received the payment. */ @@ -15250,14 +20066,54 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { * serialized prior to LDK version 0.0.117. */ struct LDKCOption_u64Z sender_intended_total_msat; + /** + * 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.124 will have this field unset. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKRecipientOnionFields onion_fields; } LDKEvent_LDKPaymentClaimed_Body; -typedef struct LDKEvent_LDKInvoiceRequestFailed_Body { +typedef struct LDKEvent_LDKConnectionNeeded_Body { + /** + * The node id for the node needing a connection. + */ + struct LDKPublicKey node_id; + /** + * Sockets for connecting to the node. + */ + struct LDKCVec_SocketAddressZ addresses; +} LDKEvent_LDKConnectionNeeded_Body; + +typedef struct LDKEvent_LDKInvoiceReceived_Body { /** - * The `payment_id` to have been associated with payment for the requested invoice. + * The `payment_id` associated with payment for the invoice. */ struct LDKThirtyTwoBytes payment_id; -} LDKEvent_LDKInvoiceRequestFailed_Body; + /** + * The invoice to pay. + */ + struct LDKBolt12Invoice invoice; + /** + * The context of the [`BlindedMessagePath`] used to send the invoice. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + */ + struct LDKCOption_OffersContextZ context; + /** + * A responder for replying with an [`InvoiceError`] if needed. + * + * `None` if the invoice wasn't sent with a reply path. + * + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKResponder responder; +} LDKEvent_LDKInvoiceReceived_Body; typedef struct LDKEvent_LDKPaymentSent_Body { /** @@ -15287,6 +20143,8 @@ typedef struct LDKEvent_LDKPaymentSent_Body { * If the recipient or an intermediate node misbehaves and gives us free money, this may * overstate the amount paid, though this is unlikely. * + * This is only `None` for payments initiated on LDK versions prior to 0.0.103. + * * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees */ struct LDKCOption_u64Z fee_paid_msat; @@ -15300,14 +20158,17 @@ typedef struct LDKEvent_LDKPaymentFailed_Body { */ struct LDKThirtyTwoBytes payment_id; /** - * The hash that was given to [`ChannelManager::send_payment`]. + * The hash that was given to [`ChannelManager::send_payment`]. `None` if the payment failed + * before receiving an invoice when paying a BOLT12 [`Offer`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`Offer`]: crate::offers::offer::Offer */ - struct LDKThirtyTwoBytes payment_hash; + struct LDKCOption_ThirtyTwoBytesZ payment_hash; /** * The reason the payment failed. This is only `None` for events generated or serialized - * by versions prior to 0.0.115. + * by versions prior to 0.0.115, or when downgrading to a version with a reason that was + * added after. */ struct LDKCOption_PaymentFailureReasonZ reason; } LDKEvent_LDKPaymentFailed_Body; @@ -15478,23 +20339,45 @@ typedef struct LDKEvent_LDKSpendableOutputs_Body { * The `channel_id` indicating which channel the spendable outputs belong to. * * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCOption_ThirtyTwoBytesZ channel_id; + struct LDKChannelId channel_id; } LDKEvent_LDKSpendableOutputs_Body; typedef struct LDKEvent_LDKPaymentForwarded_Body { /** - * The incoming channel between the previous node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. + * The channel id of 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 LDKChannelId prev_channel_id; + /** + * The channel id of 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 LDKChannelId next_channel_id; + /** + * The `user_channel_id` of the incoming channel between the previous node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.122. */ - struct LDKCOption_ThirtyTwoBytesZ prev_channel_id; + struct LDKCOption_U128Z prev_user_channel_id; /** - * The outgoing channel between the next node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. + * The `user_channel_id` of the outgoing channel between the next node and us. + * + * This will be `None` if the payment was settled via an on-chain transaction. See the + * caveat described for the `total_fee_earned_msat` field. Moreover it will be `None` for + * events generated or serialized by versions prior to 0.0.122. */ - struct LDKCOption_ThirtyTwoBytesZ next_channel_id; + struct LDKCOption_U128Z next_user_channel_id; /** - * The fee, in milli-satoshis, which was earned as a result of the payment. + * The total 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 @@ -15505,10 +20388,26 @@ typedef struct LDKEvent_LDKPaymentForwarded_Body { * 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 + * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is * `None`. */ - struct LDKCOption_u64Z fee_earned_msat; + struct LDKCOption_u64Z total_fee_earned_msat; + /** + * The share of the total fee, in milli-satoshis, which was withheld in addition to the + * forwarding fee. + * + * This will only be `Some` if we forwarded an intercepted HTLC with less than the + * expected amount. This means our counterparty accepted to receive less than the invoice + * amount, e.g., by claiming the payment featuring a corresponding + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]. + * + * Will also always be `None` for events serialized with LDK prior to version 0.0.122. + * + * The caveat described above the `total_fee_earned_msat` field applies here as well. + * + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat + */ + struct LDKCOption_u64Z skimmed_fee_msat; /** * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain * transaction. @@ -15517,7 +20416,7 @@ typedef struct LDKEvent_LDKPaymentForwarded_Body { /** * 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. + * The caveat described above the `total_fee_earned_msat` field applies here as well. */ struct LDKCOption_u64Z outbound_amount_forwarded_msat; } LDKEvent_LDKPaymentForwarded_Body; @@ -15526,7 +20425,7 @@ typedef struct LDKEvent_LDKChannelPending_Body { /** * The `channel_id` of the channel that is pending confirmation. */ - struct LDKThirtyTwoBytes channel_id; + struct LDKChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -15542,8 +20441,10 @@ typedef struct LDKEvent_LDKChannelPending_Body { * The `temporary_channel_id` this channel used to be known by during channel establishment. * * Will be `None` for channels created prior to LDK version 0.0.115. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id; + struct LDKChannelId former_temporary_channel_id; /** * The `node_id` of the channel counterparty. */ @@ -15552,13 +20453,21 @@ typedef struct LDKEvent_LDKChannelPending_Body { * The outpoint of the channel's funding transaction. */ struct LDKOutPoint funding_txo; + /** + * The features that this channel will operate with. + * + * Will be `None` for channels created prior to LDK version 0.0.122. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelTypeFeatures channel_type; } LDKEvent_LDKChannelPending_Body; typedef struct LDKEvent_LDKChannelReady_Body { /** * The `channel_id` of the channel that is ready. */ - struct LDKThirtyTwoBytes channel_id; + struct LDKChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -15585,7 +20494,7 @@ 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; + struct LDKChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -15617,17 +20526,25 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * This field will be `None` for objects serialized prior to LDK 0.0.117. */ struct LDKCOption_u64Z channel_capacity_sats; + /** + * The original channel funding TXO; this helps checking for the existence and confirmation + * status of the closing tx. + * Note that for instances serialized in v0.0.119 or prior this will be missing (None). + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOutPoint channel_funding_txo; } LDKEvent_LDKChannelClosed_Body; typedef struct LDKEvent_LDKDiscardFunding_Body { /** * The channel_id of the channel which has been closed. */ - struct LDKThirtyTwoBytes channel_id; + struct LDKChannelId channel_id; /** * The full transaction received from the user */ - struct LDKTransaction transaction; + struct LDKFundingInfo funding_info; } LDKEvent_LDKDiscardFunding_Body; typedef struct LDKEvent_LDKOpenChannelRequest_Body { @@ -15641,7 +20558,7 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * [`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 LDKThirtyTwoBytes temporary_channel_id; + struct LDKChannelId temporary_channel_id; /** * The node_id of the counterparty requesting to open the channel. * @@ -15680,26 +20597,55 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ struct LDKChannelTypeFeatures channel_type; + /** + * True if this channel is (or will be) publicly-announced. + */ + bool is_announced; + /** + * Channel parameters given by the counterparty. + */ + struct LDKChannelParameters params; } LDKEvent_LDKOpenChannelRequest_Body; typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { /** * The channel over which the HTLC was received. */ - struct LDKThirtyTwoBytes prev_channel_id; + struct LDKChannelId prev_channel_id; /** * Destination of the HTLC that failed to be processed. */ struct LDKHTLCDestination failed_next_destination; } LDKEvent_LDKHTLCHandlingFailed_Body; +typedef struct LDKEvent_LDKOnionMessageIntercepted_Body { + /** + * The node id of the offline peer. + */ + struct LDKPublicKey peer_node_id; + /** + * The onion message intended to be forwarded to `peer_node_id`. + */ + struct LDKOnionMessage message; +} LDKEvent_LDKOnionMessageIntercepted_Body; + +typedef struct LDKEvent_LDKOnionMessagePeerConnected_Body { + /** + * The node id of the peer we just connected to, who advertises support for + * onion messages. + */ + struct LDKPublicKey peer_node_id; +} LDKEvent_LDKOnionMessagePeerConnected_Body; + typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; + LDKEvent_LDKFundingTxBroadcastSafe_Body funding_tx_broadcast_safe; LDKEvent_LDKPaymentClaimable_Body payment_claimable; LDKEvent_LDKPaymentClaimed_Body payment_claimed; - LDKEvent_LDKInvoiceRequestFailed_Body invoice_request_failed; + LDKEvent_LDKConnectionNeeded_Body connection_needed; + LDKEvent_LDKInvoiceReceived_Body invoice_received; LDKEvent_LDKPaymentSent_Body payment_sent; LDKEvent_LDKPaymentFailed_Body payment_failed; LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful; @@ -15719,6 +20665,8 @@ typedef struct MUST_USE_STRUCT LDKEvent { struct { struct LDKBumpTransactionEvent bump_transaction; }; + LDKEvent_LDKOnionMessageIntercepted_Body onion_message_intercepted; + LDKEvent_LDKOnionMessagePeerConnected_Body onion_message_peer_connected; }; } LDKEvent; @@ -15782,6 +20730,55 @@ typedef struct LDKCResult_COption_EventZDecodeErrorZ { bool result_ok; } LDKCResult_COption_EventZDecodeErrorZ; +/** + * The contents of CResult_NonceDecodeErrorZ + */ +typedef union LDKCResult_NonceDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNonce *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_NonceDecodeErrorZPtr; + +/** + * A CResult_NonceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::nonce::Nonce 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_NonceDecodeErrorZ { + /** + * The contents of this CResult_NonceDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NonceDecodeErrorZPtr contents; + /** + * Whether this CResult_NonceDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NonceDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::lightning_types::routing::RouteHintHops of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHintHopZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKRouteHintHop *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_RouteHintHopZ; + /** * Sub-errors which don't have specific information in them use this type. */ @@ -15879,6 +20876,33 @@ typedef struct LDKCResult_SiPrefixBolt11ParseErrorZ { bool result_ok; } LDKCResult_SiPrefixBolt11ParseErrorZ; + + +/** + * Represents a syntactically and semantically correct lightning BOLT11 invoice. + * + * There are three ways to construct a `Bolt11Invoice`: + * 1. using [`InvoiceBuilder`] + * 2. using [`Bolt11Invoice::from_signed`] + * 3. using `str::parse::(&str)` (see [`Bolt11Invoice::from_str`]) + * + * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr + */ +typedef struct MUST_USE_STRUCT LDKBolt11Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt11Invoice *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; +} LDKBolt11Invoice; + /** * Indicates that something went wrong while parsing or validating the invoice. Parsing errors * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors @@ -16003,30 +21027,6 @@ typedef struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { -/** - * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, - * but without the signature information. - * Decoding and encoding should not lead to information loss but may lead to different hashes. - * - * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. - */ -typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRawBolt11Invoice *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; -} LDKRawBolt11Invoice; - - - /** * Recoverable signature */ @@ -16460,6 +21460,39 @@ typedef struct LDKCResult_BigSizeDecodeErrorZ { bool result_ok; } LDKCResult_BigSizeDecodeErrorZ; +/** + * 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_types::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_HostnameDecodeErrorZ */ @@ -16582,91 +21615,172 @@ typedef struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ { } LDKCResult_TransactionU16LenLimitedDecodeErrorZ; /** - * The contents of CResult_UntrustedStringDecodeErrorZ + * The contents of CResult_ChannelIdDecodeErrorZ */ -typedef union LDKCResult_UntrustedStringDecodeErrorZPtr { +typedef union LDKCResult_ChannelIdDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKUntrustedString *result; + struct LDKChannelId *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; +} LDKCResult_ChannelIdDecodeErrorZPtr; /** - * 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. + * A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::types::ChannelId 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 { +typedef struct LDKCResult_ChannelIdDecodeErrorZ { /** - * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_UntrustedStringDecodeErrorZPtr contents; + union LDKCResult_ChannelIdDecodeErrorZPtr contents; /** - * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. + * Whether this CResult_ChannelIdDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_UntrustedStringDecodeErrorZ; +} LDKCResult_ChannelIdDecodeErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple__u832u16Z { + /** + * The element at position 0 + */ + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + uint16_t b; +} LDKC2Tuple__u832u16Z; /** - * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and - * may not be valid if received by another lightning implementation. + * Information needed to route a payment across a [`BlindedPaymentPath`]. */ -typedef struct MUST_USE_STRUCT LDKReceiveTlvs { +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. */ - LDKnativeReceiveTlvs *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; -} LDKReceiveTlvs; +} LDKBlindedPayInfo; /** - * The contents of CResult_ReceiveTlvsDecodeErrorZ + * The contents of CResult_BlindedPayInfoDecodeErrorZ */ -typedef union LDKCResult_ReceiveTlvsDecodeErrorZPtr { +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 LDKReceiveTlvs *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_ReceiveTlvsDecodeErrorZPtr; +} LDKCResult_BlindedPayInfoDecodeErrorZPtr; + +/** + * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::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_BlindedPayInfoDecodeErrorZ { + /** + * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPayInfoDecodeErrorZ; + +/** + * The contents of CResult_BlindedPaymentPathNoneZ + */ +typedef union LDKCResult_BlindedPaymentPathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedPaymentPath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_BlindedPaymentPathNoneZPtr; /** - * A CResult_ReceiveTlvsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::ReceiveTlvs on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_BlindedPaymentPathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::BlindedPaymentPath on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ReceiveTlvsDecodeErrorZ { +typedef struct LDKCResult_BlindedPaymentPathNoneZ { /** - * The contents of this CResult_ReceiveTlvsDecodeErrorZ, accessible via either + * The contents of this CResult_BlindedPaymentPathNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ReceiveTlvsDecodeErrorZPtr contents; + union LDKCResult_BlindedPaymentPathNoneZPtr contents; /** - * Whether this CResult_ReceiveTlvsDecodeErrorZ represents a success state. + * Whether this CResult_BlindedPaymentPathNoneZ represents a success state. */ bool result_ok; -} LDKCResult_ReceiveTlvsDecodeErrorZ; +} LDKCResult_BlindedPaymentPathNoneZ; + + + +/** + * An intermediate node, its outbound channel, and relay parameters. + */ +typedef struct MUST_USE_STRUCT LDKPaymentForwardNode { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePaymentForwardNode *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; +} LDKPaymentForwardNode; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::payment::PaymentForwardNodes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PaymentForwardNodeZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPaymentForwardNode *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PaymentForwardNodeZ; @@ -16779,252 +21893,201 @@ typedef struct LDKCResult_PaymentConstraintsDecodeErrorZ { } LDKCResult_PaymentConstraintsDecodeErrorZ; /** - * An error that may occur when making a payment. - */ -typedef enum LDKPaymentError_Tag { - /** - * An error resulting from the provided [`Bolt11Invoice`] or payment hash. - */ - LDKPaymentError_Invoice, - /** - * An error occurring when sending a payment. - */ - LDKPaymentError_Sending, - /** - * Must be last for serialization purposes - */ - LDKPaymentError_Sentinel, -} LDKPaymentError_Tag; - -typedef struct MUST_USE_STRUCT LDKPaymentError { - LDKPaymentError_Tag tag; - union { - struct { - struct LDKStr invoice; - }; - struct { - enum LDKRetryableSendFailure sending; - }; - }; -} LDKPaymentError; - -/** - * The contents of CResult_ThirtyTwoBytesPaymentErrorZ + * The contents of CResult_PaymentContextDecodeErrorZ */ -typedef union LDKCResult_ThirtyTwoBytesPaymentErrorZPtr { +typedef union LDKCResult_PaymentContextDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKPaymentContext *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentError *err; -} LDKCResult_ThirtyTwoBytesPaymentErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_PaymentContextDecodeErrorZPtr; /** - * A CResult_ThirtyTwoBytesPaymentErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. + * A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentContext 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_ThirtyTwoBytesPaymentErrorZ { +typedef struct LDKCResult_PaymentContextDecodeErrorZ { /** - * The contents of this CResult_ThirtyTwoBytesPaymentErrorZ, accessible via either + * The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ThirtyTwoBytesPaymentErrorZPtr contents; + union LDKCResult_PaymentContextDecodeErrorZPtr contents; /** - * Whether this CResult_ThirtyTwoBytesPaymentErrorZ represents a success state. + * Whether this CResult_PaymentContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ThirtyTwoBytesPaymentErrorZ; +} LDKCResult_PaymentContextDecodeErrorZ; /** - * The contents of CResult_NonePaymentErrorZ + * The contents of CResult_UnknownPaymentContextDecodeErrorZ */ -typedef union LDKCResult_NonePaymentErrorZPtr { +typedef union LDKCResult_UnknownPaymentContextDecodeErrorZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKUnknownPaymentContext *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentError *err; -} LDKCResult_NonePaymentErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_UnknownPaymentContextDecodeErrorZPtr; /** - * A CResult_NonePaymentErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure. + * A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NonePaymentErrorZ { +typedef struct LDKCResult_UnknownPaymentContextDecodeErrorZ { /** - * The contents of this CResult_NonePaymentErrorZ, accessible via either + * The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentErrorZPtr contents; + union LDKCResult_UnknownPaymentContextDecodeErrorZPtr contents; /** - * Whether this CResult_NonePaymentErrorZ represents a success state. + * Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentErrorZ; +} LDKCResult_UnknownPaymentContextDecodeErrorZ; /** - * An error that may occur when sending a payment probe. + * The contents of CResult_Bolt12OfferContextDecodeErrorZ */ -typedef enum LDKProbingError_Tag { - /** - * An error resulting from the provided [`Bolt11Invoice`]. - */ - LDKProbingError_Invoice, - /** - * An error occurring when sending a payment probe. - */ - LDKProbingError_Sending, - /** - * Must be last for serialization purposes - */ - LDKProbingError_Sentinel, -} LDKProbingError_Tag; - -typedef struct MUST_USE_STRUCT LDKProbingError { - LDKProbingError_Tag tag; - union { - struct { - struct LDKStr invoice; - }; - struct { - struct LDKProbeSendFailure sending; - }; - }; -} LDKProbingError; - -/** - * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ - */ -typedef union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr { +typedef union LDKCResult_Bolt12OfferContextDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *result; + struct LDKBolt12OfferContext *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKProbingError *err; -} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_Bolt12OfferContextDecodeErrorZPtr; /** - * A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning_invoice::payment::ProbingError on failure. + * A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ { +typedef struct LDKCResult_Bolt12OfferContextDecodeErrorZ { /** - * The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ, accessible via either + * The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZPtr contents; + union LDKCResult_Bolt12OfferContextDecodeErrorZPtr contents; /** - * Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ represents a success state. + * Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ; +} LDKCResult_Bolt12OfferContextDecodeErrorZ; /** - * The contents of CResult_StrSecp256k1ErrorZ + * The contents of CResult_Bolt12RefundContextDecodeErrorZ */ -typedef union LDKCResult_StrSecp256k1ErrorZPtr { +typedef union LDKCResult_Bolt12RefundContextDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKStr *result; + struct LDKBolt12RefundContext *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_StrSecp256k1ErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_Bolt12RefundContextDecodeErrorZPtr; /** - * A CResult_StrSecp256k1ErrorZ represents the result of a fallible operation, - * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. + * A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::Bolt12RefundContext 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_StrSecp256k1ErrorZ { +typedef struct LDKCResult_Bolt12RefundContextDecodeErrorZ { /** - * The contents of this CResult_StrSecp256k1ErrorZ, accessible via either + * The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_StrSecp256k1ErrorZPtr contents; + union LDKCResult_Bolt12RefundContextDecodeErrorZPtr contents; /** - * Whether this CResult_StrSecp256k1ErrorZ represents a success state. + * Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_StrSecp256k1ErrorZ; - - +} LDKCResult_Bolt12RefundContextDecodeErrorZ; /** - * A path for sending an [`OnionMessage`]. + * The contents of CResult_ResponderDecodeErrorZ */ -typedef struct MUST_USE_STRUCT LDKOnionMessagePath { +typedef union LDKCResult_ResponderDecodeErrorZPtr { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKnativeOnionMessagePath *inner; + struct LDKResponder *result; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool is_owned; -} LDKOnionMessagePath; + struct LDKDecodeError *err; +} LDKCResult_ResponderDecodeErrorZPtr; /** - * The contents of CResult_OnionMessagePathNoneZ + * A CResult_ResponderDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::Responder 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 union LDKCResult_OnionMessagePathNoneZPtr { +typedef struct LDKCResult_ResponderDecodeErrorZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The contents of this CResult_ResponderDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKOnionMessagePath *result; + union LDKCResult_ResponderDecodeErrorZPtr contents; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Whether this CResult_ResponderDecodeErrorZ represents a success state. */ - void *err; -} LDKCResult_OnionMessagePathNoneZPtr; + bool result_ok; +} LDKCResult_ResponderDecodeErrorZ; /** - * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not */ -typedef struct LDKCResult_OnionMessagePathNoneZ { +typedef enum LDKCOption_MessageContextZ_Tag { /** - * The contents of this CResult_OnionMessagePathNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_MessageContextZ contains a crate::lightning::blinded_path::message::MessageContext */ - union LDKCResult_OnionMessagePathNoneZPtr contents; + LDKCOption_MessageContextZ_Some, /** - * Whether this CResult_OnionMessagePathNoneZ represents a success state. + * When we're in this state, this COption_MessageContextZ contains nothing */ - bool result_ok; -} LDKCResult_OnionMessagePathNoneZ; + LDKCOption_MessageContextZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_MessageContextZ_Sentinel, +} LDKCOption_MessageContextZ_Tag; + +typedef struct LDKCOption_MessageContextZ { + LDKCOption_MessageContextZ_Tag tag; + union { + struct { + struct LDKMessageContext some; + }; + }; +} LDKCOption_MessageContextZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_PublicKeyOnionMessageZ { +typedef struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { /** * The element at position 0 */ @@ -17033,7 +22096,11 @@ typedef struct LDKC2Tuple_PublicKeyOnionMessageZ { * The element at position 1 */ struct LDKOnionMessage b; -} LDKC2Tuple_PublicKeyOnionMessageZ; + /** + * The element at position 2 + */ + struct LDKCOption_CVec_SocketAddressZZ c; +} LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ; /** * Errors that may occur when [sending an onion message]. @@ -17051,14 +22118,22 @@ typedef enum LDKSendError_Tag { */ LDKSendError_TooBigPacket, /** - * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded - * hops. + * The provided [`Destination`] was an invalid [`BlindedMessagePath`] due to not having any + * blinded hops. */ LDKSendError_TooFewBlindedHops, /** - * Our next-hop peer was offline or does not support onion message forwarding. + * The first hop is not a peer and doesn't have a known [`SocketAddress`]. */ LDKSendError_InvalidFirstHop, + /** + * Indicates that a path could not be found by the [`MessageRouter`]. + * + * This occurs when either: + * - No path from the sender to the destination was found to send the onion message + * - No reply path to the sender could be created when responding to an onion message + */ + LDKSendError_PathNotFound, /** * Onion message contents must have a TLV type >= 64. */ @@ -17073,6 +22148,12 @@ typedef enum LDKSendError_Tag { * [`NodeSigner`]: crate::sign::NodeSigner */ LDKSendError_GetNodeIdFailed, + /** + * The provided [`Destination`] has a blinded path with an unresolved introduction node. An + * attempt to resolve it in the [`MessageRouter`] when finding an [`OnionMessagePath`] likely + * failed. + */ + LDKSendError_UnresolvedIntroductionNode, /** * 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 @@ -17092,41 +22173,76 @@ typedef struct MUST_USE_STRUCT LDKSendError { struct { enum LDKSecp256k1Error secp256k1; }; + struct { + struct LDKPublicKey invalid_first_hop; + }; }; } LDKSendError; /** - * The contents of CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ + * The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ */ -typedef union LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr { +typedef union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PublicKeyOnionMessageZ *result; + struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKSendError *err; -} LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr; /** - * A CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PublicKeyOnionMessageZ on success and a crate::lightning::onion_message::messenger::SendError on failure. + * A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ { +typedef struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { /** - * The contents of this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ, accessible via either + * The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZPtr contents; + union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr contents; /** - * Whether this CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ represents a success state. + * Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ; + +/** + * The next hop to forward an onion message along its path. + * + * Note that payment blinded paths always specify their next hop using an explicit node id. + */ +typedef enum LDKNextMessageHop_Tag { + /** + * The node id of the next hop. + */ + LDKNextMessageHop_NodeId, + /** + * The short channel id leading to the next hop. + */ + LDKNextMessageHop_ShortChannelId, + /** + * Must be last for serialization purposes + */ + LDKNextMessageHop_Sentinel, +} LDKNextMessageHop_Tag; + +typedef struct MUST_USE_STRUCT LDKNextMessageHop { + LDKNextMessageHop_Tag tag; + union { + struct { + struct LDKPublicKey node_id; + }; + struct { + uint64_t short_channel_id; + }; + }; +} LDKNextMessageHop; /** * The contents of an [`OnionMessage`] as read from the wire. @@ -17170,7 +22286,7 @@ typedef enum LDKPeeledOnion_Tag { */ LDKPeeledOnion_Forward, /** - * Received onion message, with decrypted contents, path_id, and reply path + * Received onion message, with decrypted contents, context, and reply path */ LDKPeeledOnion_Receive, /** @@ -17180,22 +22296,18 @@ typedef enum LDKPeeledOnion_Tag { } LDKPeeledOnion_Tag; typedef struct LDKPeeledOnion_LDKForward_Body { - struct LDKPublicKey _0; + struct LDKNextMessageHop _0; struct LDKOnionMessage _1; } LDKPeeledOnion_LDKForward_Body; typedef struct LDKPeeledOnion_LDKReceive_Body { struct LDKParsedOnionMessageContents _0; + struct LDKCOption_MessageContextZ _1; /** * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKThirtyTwoBytes _1; - /** - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKBlindedPath _2; + struct LDKBlindedMessagePath _2; } LDKPeeledOnion_LDKReceive_Body; typedef struct MUST_USE_STRUCT LDKPeeledOnion { @@ -17238,6 +22350,70 @@ typedef struct LDKCResult_PeeledOnionNoneZ { bool result_ok; } LDKCResult_PeeledOnionNoneZ; +/** + * Result of successfully [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message + */ +typedef enum LDKSendSuccess_Tag { + /** + * The message was buffered and will be sent once it is processed by + * [`OnionMessageHandler::next_onion_message_for_peer`]. + */ + LDKSendSuccess_Buffered, + /** + * The message was buffered and will be sent once the node is connected as a peer and it is + * processed by [`OnionMessageHandler::next_onion_message_for_peer`]. + */ + LDKSendSuccess_BufferedAwaitingConnection, + /** + * Must be last for serialization purposes + */ + LDKSendSuccess_Sentinel, +} LDKSendSuccess_Tag; + +typedef struct MUST_USE_STRUCT LDKSendSuccess { + LDKSendSuccess_Tag tag; + union { + struct { + struct LDKPublicKey buffered_awaiting_connection; + }; + }; +} LDKSendSuccess; + +/** + * The contents of CResult_SendSuccessSendErrorZ + */ +typedef union LDKCResult_SendSuccessSendErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSendSuccess *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKSendError *err; +} LDKCResult_SendSuccessSendErrorZPtr; + +/** + * A CResult_SendSuccessSendErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SendSuccessSendErrorZ { + /** + * The contents of this CResult_SendSuccessSendErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SendSuccessSendErrorZPtr contents; + /** + * Whether this CResult_SendSuccessSendErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_SendSuccessSendErrorZ; + /** * The contents of CResult_NoneSendErrorZ */ @@ -17271,167 +22447,311 @@ typedef struct LDKCResult_NoneSendErrorZ { } LDKCResult_NoneSendErrorZ; /** - * The contents of CResult_BlindedPathNoneZ + * The contents of CResult_BlindedHopDecodeErrorZ */ -typedef union LDKCResult_BlindedPathNoneZPtr { +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 LDKBlindedPath *result; + struct LDKBlindedHop *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_BlindedPathNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_BlindedHopDecodeErrorZPtr; /** - * A CResult_BlindedPathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure. + * 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_BlindedPathNoneZ { +typedef struct LDKCResult_BlindedHopDecodeErrorZ { /** - * The contents of this CResult_BlindedPathNoneZ, accessible via either + * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedPathNoneZPtr contents; + union LDKCResult_BlindedHopDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedPathNoneZ represents a success state. + * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedPathNoneZ; +} LDKCResult_BlindedHopDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PhantomRouteHintsZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPhantomRouteHints *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PhantomRouteHintsZ; + +/** + * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`] + * may occur. + */ +typedef enum LDKSignOrCreationError_Tag { + /** + * An error occurred during signing + */ + LDKSignOrCreationError_SignError, + /** + * An error occurred while building the transaction + */ + LDKSignOrCreationError_CreationError, + /** + * Must be last for serialization purposes + */ + LDKSignOrCreationError_Sentinel, +} LDKSignOrCreationError_Tag; + +typedef struct MUST_USE_STRUCT LDKSignOrCreationError { + LDKSignOrCreationError_Tag tag; + union { + struct { + enum LDKCreationError creation_error; + }; + }; +} LDKSignOrCreationError; /** - * The contents of CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ + * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ */ -typedef union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr { +typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *result; + struct LDKBolt11Invoice *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr; + struct LDKSignOrCreationError *err; +} LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr; /** - * A CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZ on success and a () on failure. + * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ { +typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ { /** - * The contents of this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ, accessible via either + * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZPtr contents; + union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ represents a success state. + * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ; +} LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; /** - * The contents of CResult_BlindedPathDecodeErrorZ + * The contents of CResult_InvoiceErrorDecodeErrorZ */ -typedef union LDKCResult_BlindedPathDecodeErrorZPtr { +typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedPath *result; + struct LDKInvoiceError *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; +} LDKCResult_InvoiceErrorDecodeErrorZPtr; /** - * 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. + * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_error::InvoiceError 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 { +typedef struct LDKCResult_InvoiceErrorDecodeErrorZ { /** - * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either + * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedPathDecodeErrorZPtr contents; + union LDKCResult_InvoiceErrorDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedPathDecodeErrorZ represents a success state. + * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedPathDecodeErrorZ; +} LDKCResult_InvoiceErrorDecodeErrorZ; + + /** - * The contents of CResult_BlindedHopDecodeErrorZ + * The state of a spendable output currently tracked by an [`OutputSweeper`]. */ -typedef union LDKCResult_BlindedHopDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKTrackedSpendableOutput { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeTrackedSpendableOutput *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; +} LDKTrackedSpendableOutput; + +/** + * The contents of CResult_TrackedSpendableOutputDecodeErrorZ + */ +typedef union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr { /** * 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 LDKTrackedSpendableOutput *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_TrackedSpendableOutputDecodeErrorZPtr; /** - * 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. + * A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::sweep::TrackedSpendableOutput 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_TrackedSpendableOutputDecodeErrorZ { /** - * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either + * The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedHopDecodeErrorZPtr contents; + union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + * Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedHopDecodeErrorZ; +} LDKCResult_TrackedSpendableOutputDecodeErrorZ; /** - * The contents of CResult_InvoiceErrorDecodeErrorZ + * The current status of the output spend. */ -typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr { +typedef enum LDKOutputSpendStatus_Tag { + /** + * The output is tracked but an initial spending transaction hasn't been generated and + * broadcasted yet. + */ + LDKOutputSpendStatus_PendingInitialBroadcast, + /** + * A transaction spending the output has been broadcasted but is pending its first confirmation on-chain. + */ + LDKOutputSpendStatus_PendingFirstConfirmation, + /** + * A transaction spending the output has been confirmed on-chain but will be tracked until it + * reaches [`ANTI_REORG_DELAY`] confirmations. + */ + LDKOutputSpendStatus_PendingThresholdConfirmations, + /** + * Must be last for serialization purposes + */ + LDKOutputSpendStatus_Sentinel, +} LDKOutputSpendStatus_Tag; + +typedef struct LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body { + /** + * The height at which we will first generate and broadcast a spending transaction. + */ + struct LDKCOption_u32Z delayed_until_height; +} LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body; + +typedef struct LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body { + /** + * The hash of the chain tip when we first broadcast a transaction spending this output. + */ + struct LDKThirtyTwoBytes first_broadcast_hash; + /** + * The best height when we last broadcast a transaction spending this output. + */ + uint32_t latest_broadcast_height; + /** + * The transaction spending this output we last broadcasted. + */ + struct LDKTransaction latest_spending_tx; +} LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body; + +typedef struct LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body { + /** + * The hash of the chain tip when we first broadcast a transaction spending this output. + */ + struct LDKThirtyTwoBytes first_broadcast_hash; + /** + * The best height when we last broadcast a transaction spending this output. + */ + uint32_t latest_broadcast_height; + /** + * The transaction spending this output we saw confirmed on-chain. + */ + struct LDKTransaction latest_spending_tx; + /** + * The height at which the spending transaction was confirmed. + */ + uint32_t confirmation_height; + /** + * The hash of the block in which the spending transaction was confirmed. + */ + struct LDKThirtyTwoBytes confirmation_hash; +} LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body; + +typedef struct MUST_USE_STRUCT LDKOutputSpendStatus { + LDKOutputSpendStatus_Tag tag; + union { + LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body pending_initial_broadcast; + LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body pending_first_confirmation; + LDKOutputSpendStatus_LDKPendingThresholdConfirmations_Body pending_threshold_confirmations; + }; +} LDKOutputSpendStatus; + +/** + * The contents of CResult_OutputSpendStatusDecodeErrorZ + */ +typedef union LDKCResult_OutputSpendStatusDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoiceError *result; + struct LDKOutputSpendStatus *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_InvoiceErrorDecodeErrorZPtr; +} LDKCResult_OutputSpendStatusDecodeErrorZPtr; /** - * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_OutputSpendStatusDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::sweep::OutputSpendStatus 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_InvoiceErrorDecodeErrorZ { +typedef struct LDKCResult_OutputSpendStatusDecodeErrorZ { /** - * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either + * The contents of this CResult_OutputSpendStatusDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceErrorDecodeErrorZPtr contents; + union LDKCResult_OutputSpendStatusDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state. + * Whether this CResult_OutputSpendStatusDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceErrorDecodeErrorZ; +} LDKCResult_OutputSpendStatusDecodeErrorZ; @@ -17445,6 +22765,9 @@ typedef struct LDKCResult_InvoiceErrorDecodeErrorZ { * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and * may have been spent there. See [`Filter::register_output`] for details. * + * Depending on your block source, you may need one or both of either [`Self::outpoint`] or + * [`Self::script_pubkey`]. + * * [`ChannelMonitor`]: channelmonitor::ChannelMonitor * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected */ @@ -17494,6 +22817,11 @@ typedef struct LDKFilter { /** * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as * a spending condition. + * + * This may be used, for example, to monitor for when a funding transaction confirms. + * + * The `script_pubkey` is provided for informational purposes and may be useful for block + * sources which only support filtering on scripts. */ void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey); /** @@ -17503,6 +22831,9 @@ typedef struct LDKFilter { * to ensure that also dependent output spents within an already connected block are correctly * handled, e.g., by re-scanning the block in question whenever new outputs have been * registered mid-processing. + * + * This may be used, for example, to monitor for when a funding output is spent (by any + * transaction). */ void (*register_output)(const void *this_arg, struct LDKWatchedOutput output); /** @@ -17539,142 +22870,46 @@ typedef struct LDKCOption_FilterZ { }; } LDKCOption_FilterZ; - - -/** - * A read-only reference to a current ChannelMonitor. - * - * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is - * released. - */ -typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeLockedChannelMonitor *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKLockedChannelMonitor; - -/** - * The contents of CResult_LockedChannelMonitorNoneZ - */ -typedef union LDKCResult_LockedChannelMonitorNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKLockedChannelMonitor *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_LockedChannelMonitorNoneZPtr; - -/** - * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation, - * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_LockedChannelMonitorNoneZ { - /** - * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_LockedChannelMonitorNoneZPtr contents; - /** - * Whether this CResult_LockedChannelMonitorNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_LockedChannelMonitorNoneZ; - -/** - * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_OutPointZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKOutPoint *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_OutPointZ; - - - -/** - * An opaque identifier describing a specific [`Persist`] method call. - */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMonitorUpdateId *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKMonitorUpdateId; - /** - * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size. + * A dynamically-allocated array of crate::lightning::util::sweep::TrackedSpendableOutputs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_MonitorUpdateIdZ { +typedef struct LDKCVec_TrackedSpendableOutputZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKMonitorUpdateId *data; + struct LDKTrackedSpendableOutput *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_MonitorUpdateIdZ; +} LDKCVec_TrackedSpendableOutputZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A helper trait that describes an on-chain wallet capable of returning a (change) destination + * script. */ -typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; +typedef struct LDKChangeDestinationSource { /** - * The element at position 1 + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - struct LDKCVec_MonitorUpdateIdZ b; -} LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + void *this_arg; /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Returns a script pubkey which can be used as a change destination for + * [`OutputSpender::spend_spendable_outputs`]. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds controlled to the same user. */ - struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data; + struct LDKCResult_CVec_u8ZNoneZ (*get_change_destination_script)(const void *this_arg); /** - * The number of elements pointed to by `data`. + * 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. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; + void (*free)(void *this_arg); +} LDKChangeDestinationSource; /** * Provides an interface that allows storage and retrieval of persisted values that are associated @@ -17756,28434 +22991,37130 @@ typedef struct LDKKVStore { } LDKKVStore; /** - * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. + * A trait that describes a wallet capable of creating a spending [`Transaction`] from a set of + * [`SpendableOutputDescriptor`]s. */ -typedef struct LDKPersister { +typedef struct LDKOutputSpender { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. - */ - struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); - /** - * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. - */ - struct LDKCResult_NoneIOErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); - /** - * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. + * 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. + * + * The `locktime` argument is used to set the transaction's locktime. If `None`, the + * transaction will have a locktime of 0. It it recommended to set this to the current block + * height to avoid fee sniping, unless you have some specific reason to use a different + * locktime. + * + * 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. */ - struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); + struct LDKCResult_TransactionNoneZ (*spend_spendable_outputs)(const void *this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** * 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); -} LDKPersister; +} LDKOutputSpender; /** - * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and - * [`ChannelMonitorUpdate`]s. - * - * # Overview - * - * The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased - * I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and - * deleting) and complexity. This is because it writes channel monitor differential updates, - * whereas the other (default) implementation rewrites the entire monitor on each update. For - * routing nodes, updates can happen many times per second to a channel, and monitors can be tens - * of megabytes (or more). Updates can be as small as a few hundred bytes. - * - * Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with - * the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence, - * [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other - * persisters. This is because monitors written by this struct _may_ have unapplied updates. In - * order to downgrade, you must ensure that all updates are applied to the monitor, and remove the - * sentinel bytes. - * - * # Storing monitors - * - * Monitors are stored by implementing the [`Persist`] trait, which has two functions: - * - * - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s. - * - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`] - * - * Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`], - * using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`). - * - * Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows: - * - * - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`] - * - secondary namespace: [the monitor's encoded outpoint name] - * - * Under that secondary namespace, each update is stored with a number string, like `21`, which - * represents its `update_id` value. - * - * For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]: - * - * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` - * - Index: `1` - * - * Full channel monitors would be stored at a single key: - * - * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` - * - * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): - * - * ```text - * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1 - * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2 - * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3 - * ``` - * ... and so on. - * - * # Reading channel state from storage - * - * Channel state can be reconstructed by calling - * [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can - * list channel monitors themselves and load channels individually using - * [`MonitorUpdatingPersister::read_channel_monitor_with_updates`]. + * A utility that keeps track of [`SpendableOutputDescriptor`]s, persists them in a given + * [`KVStore`] and regularly retries sweeping them based on a callback given to the constructor + * methods. * - * ## EXTREMELY IMPORTANT - * - * It is extremely important that your [`KVStore::read`] implementation uses the - * [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in - * that circumstance (not when there is really a permissions error, for example). This is because - * neither channel monitor reading function lists updates. Instead, either reads the monitor, and - * using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until - * one is not found. All _other_ errors will be bubbled up in the function's [`Result`]. + * Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s received via [`Event::SpendableOutputs`]. * - * # Pruning stale channel updates + * This needs to be notified of chain state changes either via its [`Listen`] or [`Confirm`] + * implementation and hence has to be connected with the utilized chain data sources. * - * Stale updates are pruned when a full monitor is written. The old monitor is first read, and if - * that succeeds, updates in the range between the old and new monitors are deleted. The `lazy` - * flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions - * will complete. However, stale updates are not a problem for data integrity, since updates are - * only read that are higher than the stored [`ChannelMonitor`]'s `update_id`. + * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users are + * required to give their chain data sources (i.e., [`Filter`] implementation) to the respective + * constructor. * - * If you have many stale updates stored (such as after a crash with pending lazy deletes), and - * would like to get rid of them, consider using the - * [`MonitorUpdatingPersister::cleanup_stale_updates`] function. + * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister { +typedef struct MUST_USE_STRUCT LDKOutputSweeper { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMonitorUpdatingPersister *inner; + LDKnativeOutputSweeper *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMonitorUpdatingPersister; +} LDKOutputSweeper; /** - * `Persist` defines behavior for persisting channel monitors: this could mean - * writing once to disk, and/or uploading to one or more backup services. - * - * Persistence can happen in one of two ways - synchronously completing before the trait method - * calls return or asynchronously in the background. - * - * # For those implementing synchronous persistence - * - * * If persistence completes fully (including any relevant `fsync()` calls), the implementation - * should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation - * should continue. - * - * * If persistence fails for some reason, implementations should consider returning - * [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in - * the background with [`ChainMonitor::list_pending_monitor_updates`] and - * [`ChainMonitor::get_monitor`]. - * - * Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can - * be marked as complete via [`ChainMonitor::channel_monitor_updated`]. - * - * If at some point no further progress can be made towards persisting the pending updates, the - * node should simply shut down. - * - * * If the persistence has failed and cannot be retried further (e.g. because of an outage), - * [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in - * an immediate panic and future operations in LDK generally failing. - * - * # For those implementing asynchronous persistence - * - * All calls should generally spawn a background task and immediately return - * [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes, - * [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding - * [`MonitorUpdateId`]. - * - * Note that unlike the direct [`chain::Watch`] interface, - * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. - * - * If at some point no further progress can be made towards persisting a pending update, the node - * should simply shut down. Until then, the background task should either loop indefinitely, or - * persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`] - * and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending - * monitor updates may be marked completed). - * - * # Using remote watchtowers - * - * Watchtowers may be updated as a part of an implementation of this trait, utilizing the async - * update process described above while the watchtower is being updated. The following methods are - * provided for bulding transactions for a watchtower: - * [`ChannelMonitor::initial_counterparty_commitment_tx`], - * [`ChannelMonitor::counterparty_commitment_txs_from_update`], - * [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`], - * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]. - * - * [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index - * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx + * The contents of CResult_OutputSweeperDecodeErrorZ */ -typedef struct LDKPersist { +typedef union LDKCResult_OutputSweeperDecodeErrorZPtr { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *this_arg; + struct LDKOutputSweeper *result; /** - * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is - * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. - * - * The data can be stored any way you want, but the identifier provided by LDK is the - * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint - * and the stored channel data). Note that you **must** persist every new monitor to disk. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` - * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`Writeable::write`]: crate::util::ser::Writeable::write + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); - /** - * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given - * update. - * - * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the - * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more - * details. - * - * During blockchain synchronization operations, and in some rare cases, this may be called with - * no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. - * Note that after the full [`ChannelMonitor`] is persisted any previous - * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be - * applied to the persisted [`ChannelMonitor`] as they were already applied. - * - * If an implementer chooses to persist the updates only, they need to make - * sure that all the updates are applied to the `ChannelMonitors` *before* - * the set of channel monitors is given to the `ChannelManager` - * deserialization routine. See [`ChannelMonitor::update_monitor`] for - * applying a monitor update to a monitor. If full `ChannelMonitors` are - * persisted, then there is no need to persist individual updates. - * - * Note that there could be a performance tradeoff between persisting complete - * channel monitors on every update vs. persisting only updates and applying - * them in batches. The size of each monitor grows `O(number of state updates)` - * whereas updates are small and `O(1)`. - * - * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`], - * if you return [`ChannelMonitorUpdateStatus::InProgress`]. - * - * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, - * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and - * [`ChannelMonitorUpdateStatus`] for requirements when returning errors. - * - * [`Writeable::write`]: crate::util::ser::Writeable::write - * - * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None + struct LDKDecodeError *err; +} LDKCResult_OutputSweeperDecodeErrorZPtr; + +/** + * A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::sweep::OutputSweeper 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_OutputSweeperDecodeErrorZ { + /** + * The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - 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); + union LDKCResult_OutputSweeperDecodeErrorZPtr 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_OutputSweeperDecodeErrorZ represents a success state. */ - void (*free)(void *this_arg); -} LDKPersist; - - + bool result_ok; +} LDKCResult_OutputSweeperDecodeErrorZ; /** - * A string that displays only printable characters, replacing control characters with - * [`core::char::REPLACEMENT_CHARACTER`]. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKPrintableString { +typedef struct LDKC2Tuple_BestBlockOutputSweeperZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The element at position 0 */ - LDKnativePrintableString *inner; + struct LDKBestBlock a; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The element at position 1 */ - bool is_owned; -} LDKPrintableString; + struct LDKOutputSweeper b; +} LDKC2Tuple_BestBlockOutputSweeperZ; /** - * A callback which is called when a [`Future`] completes. - * - * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be - * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`] - * instead. - * - * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule - * futures when they receive a wake, rather than immediately executing them. + * The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ */ -typedef struct LDKFutureCallback { +typedef union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *this_arg; + struct LDKC2Tuple_BestBlockOutputSweeperZ *result; /** - * The method which is called. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*call)(const void *this_arg); + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr; + +/** + * A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { /** - * 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 contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*free)(void *this_arg); -} LDKFutureCallback; + union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr contents; + /** + * Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ; /** - * A struct which can be used to select across many [`Future`]s at once without relying on a full - * async context. + * Base key used in conjunction with a `per_commitment_point` to generate a [`DelayedPaymentKey`]. + * + * The delayed payment key is used to pay the commitment state broadcaster their + * non-HTLC-encumbered funds after a delay to give their counterparty a chance to punish if the + * state broadcasted was previously revoked. */ -typedef struct MUST_USE_STRUCT LDKSleeper { +typedef struct MUST_USE_STRUCT LDKDelayedPaymentBasepoint { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeSleeper *inner; + LDKnativeDelayedPaymentBasepoint *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKSleeper; - +} LDKDelayedPaymentBasepoint; +/** + * The contents of CResult_DelayedPaymentBasepointDecodeErrorZ + */ +typedef union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDelayedPaymentBasepoint *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr; /** - * Configuration we set when applicable. - * - * Default::default() provides sane defaults. + * A CResult_DelayedPaymentBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::DelayedPaymentBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { +typedef struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_DelayedPaymentBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeChannelHandshakeConfig *inner; + union LDKCResult_DelayedPaymentBasepointDecodeErrorZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_DelayedPaymentBasepointDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKChannelHandshakeConfig; + bool result_ok; +} LDKCResult_DelayedPaymentBasepointDecodeErrorZ; /** - * Optional channel limits which are applied during channel creation. - * - * These limits are only applied to our counterparty's limits, not our own. + * A derived key built from a [`DelayedPaymentBasepoint`] and `per_commitment_point`. * - * Use 0/`::max_value()` as appropriate to skip checking. + * The delayed payment key is used to pay the commitment state broadcaster their + * non-HTLC-encumbered funds after a delay. This delay gives their counterparty a chance to + * punish and claim all the channel funds if the state broadcasted was previously revoked. * - * Provides sane defaults for most configurations. - * - * Most additional limits are disabled except those with which specify a default in individual - * field documentation. Note that this may result in barely-usable channels, but since they - * are applied mostly only to incoming channels that's not much of a problem. + * [See the BOLT specs] + * + * for more information on key derivation details. */ -typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { +typedef struct MUST_USE_STRUCT LDKDelayedPaymentKey { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelHandshakeLimits *inner; + LDKnativeDelayedPaymentKey *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelHandshakeLimits; - - +} LDKDelayedPaymentKey; /** - * A parallel struct to [`ChannelConfig`] to define partial updates. + * The contents of CResult_DelayedPaymentKeyDecodeErrorZ */ -typedef struct MUST_USE_STRUCT LDKChannelConfigUpdate { +typedef union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKnativeChannelConfigUpdate *inner; + struct LDKDelayedPaymentKey *result; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool is_owned; -} LDKChannelConfigUpdate; - - + struct LDKDecodeError *err; +} LDKCResult_DelayedPaymentKeyDecodeErrorZPtr; /** - * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. - * - * Default::default() provides sane defaults for most configurations - * (but currently with 0 relay fees!) + * A CResult_DelayedPaymentKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::DelayedPaymentKey on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKUserConfig { +typedef struct LDKCResult_DelayedPaymentKeyDecodeErrorZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The contents of this CResult_DelayedPaymentKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeUserConfig *inner; + union LDKCResult_DelayedPaymentKeyDecodeErrorZPtr contents; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Whether this CResult_DelayedPaymentKeyDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKUserConfig; + bool result_ok; +} LDKCResult_DelayedPaymentKeyDecodeErrorZ; /** - * The best known block as identified by its hash and height. + * Base key used in conjunction with a `per_commitment_point` to generate an [`HtlcKey`]. + * + * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC + * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out. + * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script. */ -typedef struct MUST_USE_STRUCT LDKBestBlock { +typedef struct MUST_USE_STRUCT LDKHtlcBasepoint { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBestBlock *inner; + LDKnativeHtlcBasepoint *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKBestBlock; +} LDKHtlcBasepoint; /** - * The `Listen` trait is used to notify when blocks have been connected or disconnected from the - * chain. - * - * Useful when needing to replay chain data upon startup or as new chain events occur. Clients - * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`]. - * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers - * when needed. - * - * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the - * entire header chain and only blocks with matching transaction data using BIP 157 filters or - * other similar filtering. + * The contents of CResult_HtlcBasepointDecodeErrorZ */ -typedef struct LDKListen { +typedef union LDKCResult_HtlcBasepointDecodeErrorZPtr { /** - * 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; - /** - * Notifies the listener that a block was added at the given height, with the transaction data - * possibly filtered. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); + struct LDKHtlcBasepoint *result; /** - * Notifies the listener that a block was added at the given height. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height); + struct LDKDecodeError *err; +} LDKCResult_HtlcBasepointDecodeErrorZPtr; + +/** + * A CResult_HtlcBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::HtlcBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_HtlcBasepointDecodeErrorZ { /** - * Notifies the listener that a block was removed at the given height. + * The contents of this CResult_HtlcBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); + union LDKCResult_HtlcBasepointDecodeErrorZPtr 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_HtlcBasepointDecodeErrorZ represents a success state. */ - void (*free)(void *this_arg); -} LDKListen; + bool result_ok; +} LDKCResult_HtlcBasepointDecodeErrorZ; + + /** - * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on - * chain or unconfirmed during a chain reorganization. - * - * Clients sourcing chain data using a transaction-oriented API should prefer this interface over - * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement - * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for - * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes - * with reference to the confirmation status of the monitored objects. - * - * # Use - * The intended use is as follows: - * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or - * outputs are, respectively, confirmed or spent on chain. - * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by - * [`get_relevant_txids`] is no longer confirmed in the block with the given block hash. - * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available. - * - * # Order - * - * Clients must call these methods in chain order. Specifically: - * - Transactions which are confirmed in a particular block must be given before transactions - * confirmed in a later block. - * - Dependent transactions within the same block must be given in topological order, possibly in - * separate calls. - * - All unconfirmed transactions must be given after the original confirmations and before *any* - * reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should - * never be interleaved, but always conduced *en bloc*. - * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed - * in regard to the new block. + * A derived key built from a [`HtlcBasepoint`] and `per_commitment_point`. * - * See individual method documentation for further details. + * HTLC keys are used to ensure only the recipient of an HTLC can claim it on-chain with the HTLC + * preimage and that only the sender of an HTLC can claim it on-chain after it has timed out. + * Thus, both channel counterparties' HTLC keys will appears in each HTLC output's script. * - * [`transactions_confirmed`]: Self::transactions_confirmed - * [`transaction_unconfirmed`]: Self::transaction_unconfirmed - * [`best_block_updated`]: Self::best_block_updated - * [`get_relevant_txids`]: Self::get_relevant_txids + * [See the BOLT specs] + * + * for more information on key derivation details. */ -typedef struct LDKConfirm { +typedef struct MUST_USE_STRUCT LDKHtlcKey { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - void *this_arg; + LDKnativeHtlcKey *inner; /** - * Notifies LDK of transactions confirmed in a block with a given header and height. - * - * Must be called for any transactions registered by [`Filter::register_tx`] or any - * transactions spending an output registered by [`Filter::register_output`]. Such transactions - * appearing in the same block do not need to be included in the same call; instead, multiple - * calls with additional transactions may be made so long as they are made in [chain order]. - * - * May be called before or after [`best_block_updated`] for the corresponding block. However, - * in the event of a chain reorganization, it must not be called with a `header` that is no - * longer in the chain as of the last call to [`best_block_updated`]. - * - * [chain order]: Confirm#order - * [`best_block_updated`]: Self::best_block_updated + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); + bool is_owned; +} LDKHtlcKey; + +/** + * The contents of CResult_HtlcKeyDecodeErrorZ + */ +typedef union LDKCResult_HtlcKeyDecodeErrorZPtr { /** - * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. - * - * Must be called for any transaction returned by [`get_relevant_txids`] if it has been - * reorganized out of the best chain or if it is no longer confirmed in the block with the - * given block hash. Once called, the given transaction will not be returned - * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`]. - * - * [`get_relevant_txids`]: Self::get_relevant_txids - * [`transactions_confirmed`]: Self::transactions_confirmed + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]); + struct LDKHtlcKey *result; /** - * Notifies LDK of an update to the best header connected at the given height. - * - * Must be called whenever a new chain tip becomes available. May be skipped for intermediary - * blocks. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); + struct LDKDecodeError *err; +} LDKCResult_HtlcKeyDecodeErrorZPtr; + +/** + * A CResult_HtlcKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::HtlcKey on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_HtlcKeyDecodeErrorZ { /** - * 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. - * - * Must be called to determine the subset of transactions that must be monitored for - * reorganization. Will be idempotent between calls but may change as a result of calls to the - * other interface methods. Thus, this is useful to determine which transactions must be - * given to [`transaction_unconfirmed`]. - * - * If any of the returned transactions are confirmed in a block other than the one with the - * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and - * [`transactions_confirmed`], respectively. - * - * [`transactions_confirmed`]: Self::transactions_confirmed - * [`transaction_unconfirmed`]: Self::transaction_unconfirmed + * The contents of this CResult_HtlcKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ (*get_relevant_txids)(const void *this_arg); + union LDKCResult_HtlcKeyDecodeErrorZPtr 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_HtlcKeyDecodeErrorZ represents a success state. */ - void (*free)(void *this_arg); -} LDKConfirm; + bool result_ok; +} LDKCResult_HtlcKeyDecodeErrorZ; /** - * An implementation of [`chain::Watch`] for monitoring channels. - * - * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by - * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally - * or used independently to monitor channels remotely. See the [module-level documentation] for - * details. - * - * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from - * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, - * detecting substantial mempool feerate changes between blocks, and ensuring reliability if - * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an - * environment with spotty connections, like on mobile. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [module-level documentation]: crate::chain::chainmonitor - * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims + * Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel. + * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions. */ -typedef struct MUST_USE_STRUCT LDKChainMonitor { +typedef struct MUST_USE_STRUCT LDKRevocationBasepoint { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChainMonitor *inner; + LDKnativeRevocationBasepoint *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChainMonitor; +} LDKRevocationBasepoint; /** - * 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_RevocationBasepointDecodeErrorZ */ -typedef struct LDKEventHandler { +typedef union LDKCResult_RevocationBasepointDecodeErrorZPtr { /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *this_arg; + struct LDKRevocationBasepoint *result; /** - * Handles the given [`Event`]. - * - * See [`EventsProvider`] for details that must be considered when implementing this method. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*handle_event)(const void *this_arg, struct LDKEvent event); + struct LDKDecodeError *err; +} LDKCResult_RevocationBasepointDecodeErrorZPtr; + +/** + * A CResult_RevocationBasepointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::RevocationBasepoint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RevocationBasepointDecodeErrorZ { /** - * 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 contents of this CResult_RevocationBasepointDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*free)(void *this_arg); -} LDKEventHandler; + union LDKCResult_RevocationBasepointDecodeErrorZPtr contents; + /** + * Whether this CResult_RevocationBasepointDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RevocationBasepointDecodeErrorZ; + + /** - * 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. + * The revocation key is used to allow a channel party to revoke their state - giving their + * counterparty the required material to claim all of their funds if they broadcast that state. * - * 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). + * Each commitment transaction has a revocation key based on the basepoint and + * per_commitment_point which is used in both commitment and HTLC transactions. * - * [`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 + * See [the BOLT spec for derivation details] + * */ -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 MUST_USE_STRUCT LDKRevocationKey { /** - * Processes any events generated since the last call using the given event handler. - * - * See the trait-level documentation for requirements. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); + LDKnativeRevocationKey *inner; /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - void (*free)(void *this_arg); -} LDKEventsProvider; + bool is_owned; +} LDKRevocationKey; /** - * 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 . + * The contents of CResult_RevocationKeyDecodeErrorZ */ -typedef enum LDKFailureCode_Tag { - /** - * We had a temporary error processing the payment. Useful if no other error codes fit - * and you want to indicate that the payer may want to retry. - */ - LDKFailureCode_TemporaryNodeFailure, +typedef union LDKCResult_RevocationKeyDecodeErrorZPtr { /** - * 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. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKFailureCode_RequiredNodeFeatureMissing, + struct LDKRevocationKey *result; /** - * 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`]. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKFailureCode_IncorrectOrUnknownPaymentDetails, + struct LDKDecodeError *err; +} LDKCResult_RevocationKeyDecodeErrorZPtr; + +/** + * A CResult_RevocationKeyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channel_keys::RevocationKey on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RevocationKeyDecodeErrorZ { /** - * We failed to process the payload after the onion was decrypted. You may wish to - * use this when receiving custom HTLC TLVs with even type numbers that you don't recognize. - * - * If available, the tuple data may include the type number and byte offset in the - * decrypted byte stream where the failure occurred. + * The contents of this CResult_RevocationKeyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKFailureCode_InvalidOnionPayload, + union LDKCResult_RevocationKeyDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_RevocationKeyDecodeErrorZ represents a success state. */ - LDKFailureCode_Sentinel, -} LDKFailureCode_Tag; - -typedef struct MUST_USE_STRUCT LDKFailureCode { - LDKFailureCode_Tag tag; - union { - struct { - struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload; - }; - }; -} LDKFailureCode; + bool result_ok; +} LDKCResult_RevocationKeyDecodeErrorZ; /** - * Chain-related parameters used to construct a new `ChannelManager`. + * A read-only reference to a current ChannelMonitor. * - * Typically, the block-specific parameters are derived from the best block hash for the network, - * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters - * are not needed when deserializing a previously constructed `ChannelManager`. + * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is + * released. */ -typedef struct MUST_USE_STRUCT LDKChainParameters { +typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChainParameters *inner; + LDKnativeLockedChannelMonitor *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChainParameters; +} LDKLockedChannelMonitor; /** - * A trait indicating an object may generate message send events + * The contents of CResult_LockedChannelMonitorNoneZ */ -typedef struct LDKMessageSendEventsProvider { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef union LDKCResult_LockedChannelMonitorNoneZPtr { /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg); + struct LDKLockedChannelMonitor *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. + * Note that this value is always NULL, as there are no contents in the Err variant */ - void (*free)(void *this_arg); -} LDKMessageSendEventsProvider; + void *err; +} LDKCResult_LockedChannelMonitorNoneZPtr; /** - * 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`. - */ -typedef struct LDKChannelMessageHandler { - /** - * 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; - /** - * Handle an incoming `open_channel` message from the given peer. - */ - void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); - /** - * Handle an incoming `open_channel2` message from the given peer. - */ - void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); - /** - * Handle an incoming `accept_channel` message from the given peer. - */ - void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); - /** - * Handle an incoming `accept_channel2` message from the given peer. - */ - void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg); - /** - * 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. - */ - 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. - */ - 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. - */ - 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. - */ - void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); - /** - * Handle an incoming `tx_add_input message` from the given peer. - */ - void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg); + * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation, + * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_LockedChannelMonitorNoneZ { /** - * Handle an incoming `tx_add_output` message from the given peer. + * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg); + union LDKCResult_LockedChannelMonitorNoneZPtr contents; /** - * Handle an incoming `tx_remove_input` message from the given peer. + * Whether this CResult_LockedChannelMonitorNoneZ represents a success state. */ - void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg); + bool result_ok; +} LDKCResult_LockedChannelMonitorNoneZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OutPointChannelIdZ { /** - * Handle an incoming `tx_remove_output` message from the given peer. + * The element at position 0 */ - void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg); + struct LDKOutPoint a; /** - * Handle an incoming `tx_complete message` from the given peer. + * The element at position 1 */ - void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg); + struct LDKChannelId b; +} LDKC2Tuple_OutPointChannelIdZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_OutPointChannelIdZZ { /** - * Handle an incoming `tx_signatures` message from the given peer. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg); + struct LDKC2Tuple_OutPointChannelIdZ *data; /** - * Handle an incoming `tx_init_rbf` message from the given peer. + * The number of elements pointed to by `data`. */ - void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg); + uintptr_t datalen; +} LDKCVec_C2Tuple_OutPointChannelIdZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OutPointCVec_u64ZZ { /** - * Handle an incoming `tx_ack_rbf` message from the given peer. + * The element at position 0 */ - void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg); + struct LDKOutPoint a; /** - * Handle an incoming `tx_abort message` from the given peer. + * The element at position 1 */ - void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg); + struct LDKCVec_u64Z b; +} LDKC2Tuple_OutPointCVec_u64ZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_u64ZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ { /** - * Handle an incoming `update_add_htlc` message from the given peer. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); + struct LDKC2Tuple_OutPointCVec_u64ZZ *data; /** - * Handle an incoming `update_fulfill_htlc` message from the given peer. + * The number of elements pointed to by `data`. */ - void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); + uintptr_t datalen; +} LDKCVec_C2Tuple_OutPointCVec_u64ZZZ; + +/** + * The contents of CResult_BlindedMessagePathDecodeErrorZ + */ +typedef union LDKCResult_BlindedMessagePathDecodeErrorZPtr { /** - * Handle an incoming `update_fail_htlc` message from the given peer. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); + struct LDKBlindedMessagePath *result; /** - * Handle an incoming `update_fail_malformed_htlc` message from the given peer. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); + struct LDKDecodeError *err; +} LDKCResult_BlindedMessagePathDecodeErrorZPtr; + +/** + * A CResult_BlindedMessagePathDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::BlindedMessagePath 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_BlindedMessagePathDecodeErrorZ { /** - * Handle an incoming `commitment_signed` message from the given peer. + * The contents of this CResult_BlindedMessagePathDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); + union LDKCResult_BlindedMessagePathDecodeErrorZPtr contents; /** - * Handle an incoming `revoke_and_ack` message from the given peer. + * Whether this CResult_BlindedMessagePathDecodeErrorZ represents a success state. */ - void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); + bool result_ok; +} LDKCResult_BlindedMessagePathDecodeErrorZ; + +/** + * The contents of CResult_BlindedMessagePathNoneZ + */ +typedef union LDKCResult_BlindedMessagePathNoneZPtr { /** - * Handle an incoming `update_fee` message from the given peer. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); + struct LDKBlindedMessagePath *result; /** - * Handle an incoming `announcement_signatures` message from the given peer. + * Note that this value is always NULL, as there are no contents in the Err variant */ - void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); + void *err; +} LDKCResult_BlindedMessagePathNoneZPtr; + +/** + * A CResult_BlindedMessagePathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::BlindedMessagePath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedMessagePathNoneZ { /** - * Indicates a connection to the peer failed/an existing connection was lost. + * The contents of this CResult_BlindedMessagePathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + union LDKCResult_BlindedMessagePathNoneZPtr contents; /** - * 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. + * Whether this CResult_BlindedMessagePathNoneZ represents a success state. */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); + bool result_ok; +} LDKCResult_BlindedMessagePathNoneZ; + +/** + * The contents of CResult_MessageContextDecodeErrorZ + */ +typedef union LDKCResult_MessageContextDecodeErrorZPtr { /** - * Handle an incoming `channel_reestablish` message from the given peer. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg); + struct LDKMessageContext *result; /** - * Handle an incoming `channel_update` message from the given peer. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); + struct LDKDecodeError *err; +} LDKCResult_MessageContextDecodeErrorZPtr; + +/** + * A CResult_MessageContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::MessageContext 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_MessageContextDecodeErrorZ { /** - * Handle an incoming `error` message from the given peer. + * The contents of this CResult_MessageContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); + union LDKCResult_MessageContextDecodeErrorZPtr contents; /** - * 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`] - * which are broadcasted in our [`NodeAnnouncement`] message. + * Whether this CResult_MessageContextDecodeErrorZ represents a success state. */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + bool result_ok; +} LDKCResult_MessageContextDecodeErrorZ; + +/** + * The contents of CResult_OffersContextDecodeErrorZ + */ +typedef union LDKCResult_OffersContextDecodeErrorZPtr { /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + struct LDKOffersContext *result; /** - * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. - * - * If it's `None`, then no particular network chain hash compatibility will be enforced when - * connecting to peers. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); + struct LDKDecodeError *err; +} LDKCResult_OffersContextDecodeErrorZPtr; + +/** + * A CResult_OffersContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::OffersContext 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_OffersContextDecodeErrorZ { /** - * Implementation of MessageSendEventsProvider for this object. + * The contents of this CResult_OffersContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKMessageSendEventsProvider MessageSendEventsProvider; + union LDKCResult_OffersContextDecodeErrorZPtr 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_OffersContextDecodeErrorZ represents a success state. */ - void (*free)(void *this_arg); -} LDKChannelMessageHandler; + bool result_ok; +} LDKCResult_OffersContextDecodeErrorZ; /** - * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. + * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -typedef struct LDKOffersMessageHandler { +typedef struct LDKPersister { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, - * or replying with an error. - * - * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. * - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - struct LDKCOption_OffersMessageZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message); + struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); /** - * Releases any [`OffersMessage`]s that need to be sent. - * - * Typically, this is used for messages initiating a payment flow rather than in response to - * another message. The latter should use the return value of [`Self::handle_message`]. + * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. + */ + struct LDKCResult_NoneIOErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + /** + * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ - struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ (*release_pending_messages)(const void *this_arg); + struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKOffersMessageHandler; +} LDKPersister; /** - * Arguments for the creation of a ChannelManager that are not deserialized. + * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and + * [`ChannelMonitorUpdate`]s. * - * At a high-level, the process for deserializing a ChannelManager and resuming normal operation - * is: - * 1) Deserialize all stored [`ChannelMonitor`]s. - * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling: - * `<(BlockHash, ChannelManager)>::read(reader, args)` - * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored - * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted. - * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the - * same way you would handle a [`chain::Filter`] call using - * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. - * 4) Reconnect blocks on your [`ChannelMonitor`]s. - * 5) Disconnect/connect blocks on the [`ChannelManager`]. - * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. - * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you - * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in - * the next step. - * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a - * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. + * # Overview * - * Note that the ordering of #4-7 is not of importance, however all four must occur before you - * call any other methods on the newly-deserialized [`ChannelManager`]. + * The main benefit this provides over the [`KVStore`]'s [`Persist`] implementation is decreased + * I/O bandwidth and storage churn, at the expense of more IOPS (including listing, reading, and + * deleting) and complexity. This is because it writes channel monitor differential updates, + * whereas the other (default) implementation rewrites the entire monitor on each update. For + * routing nodes, updates can happen many times per second to a channel, and monitors can be tens + * of megabytes (or more). Updates can be as small as a few hundred bytes. * - * Note that because some channels may be closed during deserialization, it is critical that you - * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to - * you. If you deserialize an old ChannelManager (during which force-closure transactions may be - * broadcast), and then later deserialize a newer version of the same ChannelManager (which will - * not force-close the same channels but consider them live), you may end up revoking a state for - * which you've already broadcasted the transaction. + * Note that monitors written with `MonitorUpdatingPersister` are _not_ backward-compatible with + * the default [`KVStore`]'s [`Persist`] implementation. They have a prepended byte sequence, + * [`MONITOR_UPDATING_PERSISTER_PREPEND_SENTINEL`], applied to prevent deserialization with other + * persisters. This is because monitors written by this struct _may_ have unapplied updates. In + * order to downgrade, you must ensure that all updates are applied to the monitor, and remove the + * sentinel bytes. * - * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor + * # Storing monitors + * + * Monitors are stored by implementing the [`Persist`] trait, which has two functions: + * + * - [`Persist::persist_new_channel`], which persists whole [`ChannelMonitor`]s. + * - [`Persist::update_persisted_channel`], which persists only a [`ChannelMonitorUpdate`] + * + * Whole [`ChannelMonitor`]s are stored in the [`CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE`], + * using the familiar encoding of an [`OutPoint`] (for example, `[SOME-64-CHAR-HEX-STRING]_1`). + * + * Each [`ChannelMonitorUpdate`] is stored in a dynamic secondary namespace, as follows: + * + * - primary namespace: [`CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE`] + * - secondary namespace: [the monitor's encoded outpoint name] + * + * Under that secondary namespace, each update is stored with a number string, like `21`, which + * represents its `update_id` value. + * + * For example, consider this channel, named for its transaction ID and index, or [`OutPoint`]: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * Full channel monitors would be stored at a single key: + * + * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): + * + * ```text + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/1 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/2 + * [CHANNEL_MONITOR_UPDATE_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1/3 + * ``` + * ... and so on. + * + * # Reading channel state from storage + * + * Channel state can be reconstructed by calling + * [`MonitorUpdatingPersister::read_all_channel_monitors_with_updates`]. Alternatively, users can + * list channel monitors themselves and load channels individually using + * [`MonitorUpdatingPersister::read_channel_monitor_with_updates`]. + * + * ## EXTREMELY IMPORTANT + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly: that is, when a file is not found, and _only_ in + * that circumstance (not when there is really a permissions error, for example). This is because + * neither channel monitor reading function lists updates. Instead, either reads the monitor, and + * using its stored `update_id`, synthesizes update storage keys, and tries them in sequence until + * one is not found. All _other_ errors will be bubbled up in the function's [`Result`]. + * + * # Pruning stale channel updates + * + * Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`. + * Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates` + * are deleted. + * The `lazy` flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions + * will complete. However, stale updates are not a problem for data integrity, since updates are + * only read that are higher than the stored [`ChannelMonitor`]'s `update_id`. + * + * If you have many stale updates stored (such as after a crash with pending lazy deletes), and + * would like to get rid of them, consider using the + * [`MonitorUpdatingPersister::cleanup_stale_updates`] function. */ -typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { +typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelManagerReadArgs *inner; + LDKnativeMonitorUpdatingPersister *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelManagerReadArgs; - - +} LDKMonitorUpdatingPersister; /** - * A set of keys that were HKDF-expanded from an initial call to - * [`NodeSigner::get_inbound_payment_key_material`]. + * `Persist` defines behavior for persisting channel monitors: this could mean + * writing once to disk, and/or uploading to one or more backup services. * - * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material + * Persistence can happen in one of two ways - synchronously completing before the trait method + * calls return or asynchronously in the background. + * + * # For those implementing synchronous persistence + * + * * If persistence completes fully (including any relevant `fsync()` calls), the implementation + * should return [`ChannelMonitorUpdateStatus::Completed`], indicating normal channel operation + * should continue. + * + * * If persistence fails for some reason, implementations should consider returning + * [`ChannelMonitorUpdateStatus::InProgress`] and retry all pending persistence operations in + * the background with [`ChainMonitor::list_pending_monitor_updates`] and + * [`ChainMonitor::get_monitor`]. + * + * Once a full [`ChannelMonitor`] has been persisted, all pending updates for that channel can + * be marked as complete via [`ChainMonitor::channel_monitor_updated`]. + * + * If at some point no further progress can be made towards persisting the pending updates, the + * node should simply shut down. + * + * * If the persistence has failed and cannot be retried further (e.g. because of an outage), + * [`ChannelMonitorUpdateStatus::UnrecoverableError`] can be used, though this will result in + * an immediate panic and future operations in LDK generally failing. + * + * # For those implementing asynchronous persistence + * + * All calls should generally spawn a background task and immediately return + * [`ChannelMonitorUpdateStatus::InProgress`]. Once the update completes, + * [`ChainMonitor::channel_monitor_updated`] should be called with the corresponding + * [`ChannelMonitor::get_latest_update_id`] or [`ChannelMonitorUpdate::update_id`]. + * + * Note that unlike the direct [`chain::Watch`] interface, + * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs. + * + * If at some point no further progress can be made towards persisting a pending update, the node + * should simply shut down. Until then, the background task should either loop indefinitely, or + * persistence should be regularly retried with [`ChainMonitor::list_pending_monitor_updates`] + * and [`ChainMonitor::get_monitor`] (note that if a full monitor is persisted all pending + * monitor updates may be marked completed). + * + * # Using remote watchtowers + * + * Watchtowers may be updated as a part of an implementation of this trait, utilizing the async + * update process described above while the watchtower is being updated. The following methods are + * provided for bulding transactions for a watchtower: + * [`ChannelMonitor::initial_counterparty_commitment_tx`], + * [`ChannelMonitor::counterparty_commitment_txs_from_update`], + * [`ChannelMonitor::sign_to_local_justice_tx`], [`TrustedCommitmentTransaction::revokeable_output_index`], + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]. + * + * [`TrustedCommitmentTransaction::revokeable_output_index`]: crate::ln::chan_utils::TrustedCommitmentTransaction::revokeable_output_index + * [`TrustedCommitmentTransaction::build_to_local_justice_tx`]: crate::ln::chan_utils::TrustedCommitmentTransaction::build_to_local_justice_tx */ -typedef struct MUST_USE_STRUCT LDKExpandedKey { +typedef struct LDKPersist { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeExpandedKey *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup. + * + * The data can be stored any way you want, but the identifier provided by LDK is the + * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint + * and the stored channel data). Note that you **must** persist every new monitor to disk. + * + * The [`ChannelMonitor::get_latest_update_id`] uniquely links this call to [`ChainMonitor::channel_monitor_updated`]. + * For [`Persist::persist_new_channel`], it is only necessary to call [`ChainMonitor::channel_monitor_updated`] + * when you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` + * and [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`Writeable::write`]: crate::util::ser::Writeable::write */ - bool is_owned; -} LDKExpandedKey; - - - -/** - * Packet of hop data for next peer - */ -typedef struct MUST_USE_STRUCT LDKPacket { + enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given + * update. + * + * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the + * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more + * details. + * + * During blockchain synchronization operations, and in some rare cases, this may be called with + * no [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted. + * Note that after the full [`ChannelMonitor`] is persisted any previous + * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be + * applied to the persisted [`ChannelMonitor`] as they were already applied. + * + * If an implementer chooses to persist the updates only, they need to make + * sure that all the updates are applied to the `ChannelMonitors` *before* + * the set of channel monitors is given to the `ChannelManager` + * deserialization routine. If there are any gaps in the persisted [`ChannelMonitorUpdate`]s, + * implementer can safely ignore [`ChannelMonitorUpdate`]s after the gap and load without them. + * See [`ChannelMonitor::update_monitor`] for + * applying a monitor update to a monitor. If full `ChannelMonitors` are + * persisted, then there is no need to persist individual updates. + * + * Note that there could be a performance tradeoff between persisting complete + * channel monitors on every update vs. persisting only updates and applying + * them in batches. The size of each monitor grows `O(number of state updates)` + * whereas updates are small and `O(1)`. + * + * The [`ChannelMonitorUpdate::update_id`] or [`ChannelMonitor::get_latest_update_id`] uniquely + * links this call to [`ChainMonitor::channel_monitor_updated`]. + * For [`Persist::update_persisted_channel`], it is only necessary to call [`ChainMonitor::channel_monitor_updated`] + * when a [`ChannelMonitorUpdate`] is provided and when you return [`ChannelMonitorUpdateStatus::InProgress`]. + * + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, + * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and + * [`ChannelMonitorUpdateStatus`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write + * + * Note that monitor_update (or a relevant inner pointer) may be NULL or all-0s to represent None */ - LDKnativePacket *inner; + enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Prevents the channel monitor from being loaded on startup. + * + * Archiving the data in a backup location (rather than deleting it fully) is useful for + * hedging against data loss in case of unexpected failure. */ - bool is_owned; -} LDKPacket; - -/** - * A 3-byte byte array. - */ -typedef struct LDKThreeBytes { + void (*archive_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint); /** - * The three bytes + * 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. */ - uint8_t data[3]; -} LDKThreeBytes; + void (*free)(void *this_arg); +} LDKPersist; /** - * A trait to describe an object which can receive routing messages. + * The `Listen` trait is used to notify when blocks have been connected or disconnected from the + * chain. * - * # Implementor DoS Warnings + * Useful when needing to replay chain data upon startup or as new chain events occur. Clients + * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`]. + * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers + * when needed. * - * 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. + * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the + * entire header chain and only blocks with matching transaction data using BIP 157 filters or + * other similar filtering. */ -typedef struct LDKRoutingMessageHandler { +typedef struct LDKListen { /** * 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; /** - * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, - * `false` or returning an `Err` otherwise. + * Notifies the listener that a block was added at the given height, with the transaction data + * possibly filtered. */ - struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** - * 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. - */ - 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 - * 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. - * - * 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 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 - * implementor. - * - * 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 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 - * replies to a single query. - */ - struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg); - /** - * Handles the reply of a query we initiated asking for routing gossip - * messages for a list of channels. We should receive this message when - * a node has completed its best effort to send us the pertaining routing - * gossip messages. - */ - 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_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_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`] - * which are broadcasted in our [`NodeAnnouncement`] message. - */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. + * Notifies the listener that a block was added at the given height. */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height); /** - * Implementation of MessageSendEventsProvider for this object. + * Notifies the listener that a block was removed at the given height. */ - struct LDKMessageSendEventsProvider MessageSendEventsProvider; + void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); /** * 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); -} LDKRoutingMessageHandler; +} LDKListen; /** - * A handler for received [`OnionMessage`]s and for providing generated ones to send. + * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on + * chain or unconfirmed during a chain reorganization. + * + * Clients sourcing chain data using a transaction-oriented API should prefer this interface over + * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement + * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for + * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes + * with reference to the confirmation status of the monitored objects. + * + * # Use + * The intended use is as follows: + * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or + * outputs are, respectively, confirmed or spent on chain. + * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by + * [`get_relevant_txids`] is no longer confirmed in the block with the given block hash. + * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available. + * + * # Order + * + * Clients must call these methods in chain order. Specifically: + * - Transactions which are confirmed in a particular block must be given before transactions + * confirmed in a later block. + * - Dependent transactions within the same block must be given in topological order, possibly in + * separate calls. + * - All unconfirmed transactions must be given after the original confirmations and before *any* + * reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should + * never be interleaved, but always conduced *en bloc*. + * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed + * in regard to the new block. + * + * See individual method documentation for further details. + * + * [`transactions_confirmed`]: Self::transactions_confirmed + * [`transaction_unconfirmed`]: Self::transaction_unconfirmed + * [`best_block_updated`]: Self::best_block_updated + * [`get_relevant_txids`]: Self::get_relevant_txids */ -typedef struct LDKOnionMessageHandler { +typedef struct LDKConfirm { /** * 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; /** - * Handle an incoming `onion_message` message from the given peer. - */ - void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); - /** - * Returns the next pending onion message for the peer with the given node id. + * Notifies LDK of transactions confirmed in a block with a given header and height. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); - /** - * Called when a connection is established with a peer. Can be used to track which peers - * advertise onion message support and are online. + * Must be called for any transactions registered by [`Filter::register_tx`] or any + * transactions spending an output registered by [`Filter::register_output`]. Such transactions + * appearing in the same block do not need to be included in the same call; instead, multiple + * calls with additional transactions may be made so long as they are made in [chain order]. * - * 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. + * May be called before or after [`best_block_updated`] for the corresponding block. However, + * in the event of a chain reorganization, it must not be called with a `header` that is no + * longer in the chain as of the last call to [`best_block_updated`]. + * + * [chain order]: Confirm#order + * [`best_block_updated`]: Self::best_block_updated */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); + void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** - * 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. + * Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. + * + * Must be called for any transaction returned by [`get_relevant_txids`] if it has been + * reorganized out of the best chain or if it is no longer confirmed in the block with the + * given block hash. Once called, the given transaction will not be returned + * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`]. + * + * [`get_relevant_txids`]: Self::get_relevant_txids + * [`transactions_confirmed`]: Self::transactions_confirmed */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]); /** - * 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`] - * which are broadcasted in our [`NodeAnnouncement`] message. + * Notifies LDK of an update to the best header connected at the given height. + * + * Must be called whenever a new chain tip becomes available. May be skipped for intermediary + * blocks. */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. + * Returns transactions that must be monitored for reorganization out of the chain along + * with the height and the hash of the block as part of which it had been previously confirmed. * - * Note that this method is called before [`Self::peer_connected`]. + * 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. + * + * Must be called to determine the subset of transactions that must be monitored for + * reorganization. Will be idempotent between calls but may change as a result of calls to the + * other interface methods. Thus, this is useful to determine which transactions must be + * given to [`transaction_unconfirmed`]. + * + * If any of the returned transactions are confirmed in a block other than the one with the + * given hash at the given height, they need to be unconfirmed and reconfirmed via + * [`transaction_unconfirmed`] and [`transactions_confirmed`], respectively. + * + * [`transactions_confirmed`]: Self::transactions_confirmed + * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ (*get_relevant_txids)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKOnionMessageHandler; +} LDKConfirm; /** - * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) - * decoders. + * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a + * future block height is reached. */ -typedef struct LDKCustomMessageReader { +typedef enum LDKSpendingDelay_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. + * A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks` + * is reached. */ - void *this_arg; + LDKSpendingDelay_Relative, /** - * Decodes a custom message to `CustomMessageType`. If the given message type is known to the - * implementation and the message could be decoded, must return `Ok(Some(message))`. If the - * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error - * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. + * An absolute delay indicating we shouldn't spend the output before `height` is reached. */ - struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer); + LDKSpendingDelay_Absolute, /** - * 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); -} LDKCustomMessageReader; + LDKSpendingDelay_Sentinel, +} LDKSpendingDelay_Tag; -/** - * 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 { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Handles the given message 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); - /** - * 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); - /** - * 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`] - * which are broadcasted in our [`NodeAnnouncement`] message. - * - * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement - */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * [`Init`]: crate::ln::msgs::Init - */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Implementation of CustomMessageReader for this object. - */ - struct LDKCustomMessageReader CustomMessageReader; +typedef struct LDKSpendingDelay_LDKRelative_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 number of blocks until we'll generate and broadcast the spending transaction. */ - void (*free)(void *this_arg); -} LDKCustomMessageHandler; - + uint32_t num_blocks; +} LDKSpendingDelay_LDKRelative_Body; - -/** - * A dummy struct which implements `RoutingMessageHandler` without storing any routing information - * or doing any processing. You can provide one of these as the route_handler in a MessageHandler. - */ -typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler { +typedef struct LDKSpendingDelay_LDKAbsolute_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. - */ - LDKnativeIgnoringMessageHandler *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. + * The height at which we'll generate and broadcast the spending transaction. */ - bool is_owned; -} LDKIgnoringMessageHandler; + uint32_t height; +} LDKSpendingDelay_LDKAbsolute_Body; + +typedef struct MUST_USE_STRUCT LDKSpendingDelay { + LDKSpendingDelay_Tag tag; + union { + LDKSpendingDelay_LDKRelative_Body relative; + LDKSpendingDelay_LDKAbsolute_Body absolute; + }; +} LDKSpendingDelay; /** - * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`], - * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages, - * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom - * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported - * message types. + * A callback which is called when a [`Future`] completes. * - * See [`OnionMessenger`] for example usage. + * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be + * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`] + * instead. * - * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler - * [`CustomMessage`]: Self::CustomMessage + * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule + * futures when they receive a wake, rather than immediately executing them. */ -typedef struct LDKCustomOnionMessageHandler { +typedef struct LDKFutureCallback { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Called with the custom message that was received, returning a response to send, if any. - * - * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. - */ - struct LDKCOption_OnionMessageContentsZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents msg); - /** - * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the - * message type is unknown. - */ - struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); - /** - * Releases any [`Self::CustomMessage`]s that need to be sent. - * - * Typically, this is used for messages initiating a message flow rather than in response to - * another message. The latter should use the return value of [`Self::handle_custom_message`]. + * The method which is called. */ - struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ (*release_pending_custom_messages)(const void *this_arg); + void (*call)(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); -} LDKCustomOnionMessageHandler; +} LDKFutureCallback; /** - * A dummy struct which implements `ChannelMessageHandler` without having any channels. - * You can provide one of these as the route_handler in a MessageHandler. + * 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 LDKErroringMessageHandler { +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. */ - LDKnativeErroringMessageHandler *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; -} LDKErroringMessageHandler; +} LDKSleeper; /** - * Provides references to trait impls which handle different types of messages. + * Configuration we set when applicable. + * + * `Default::default()` provides sane defaults. */ -typedef struct MUST_USE_STRUCT LDKMessageHandler { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMessageHandler *inner; + LDKnativeChannelHandshakeConfig *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; -} LDKMessageHandler; - -/** - * Provides an object which can be used to send data to and which uniquely identifies a connection - * 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. - * - * 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 - * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no - * further calls to the [`PeerManager`] related to the original socket occur. This allows you to - * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish - * to simply use another value which is guaranteed to be globally unique instead. - */ -typedef struct LDKSocketDescriptor { - /** - * 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; - /** - * Attempts to send some data from the given slice to the peer. - * - * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. - * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be - * called and further write attempts may occur until that time. - * - * If the returned size is smaller than `data.len()`, a - * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be - * written. Additionally, until a `send_data` event completes fully, no further - * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to - * prevent denial-of-service issues, you should not read or buffer any data from the socket - * until then. - * - * If a [`PeerManager::read_event`] call on this descriptor had previously returned true - * (indicating that read events should be paused to prevent DoS in the send buffer), - * `resume_read` may be set indicating that read events on this descriptor should resume. A - * `resume_read` of false carries no meaning, and should not cause any action. - */ - uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read); - /** - * Disconnect the socket pointed to by this SocketDescriptor. - * - * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this - * call (doing so is a noop). - */ - void (*disconnect_socket)(void *this_arg); - /** - * Checks if two objects are equal given this object's this_arg pointer and another object. - */ - bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); - /** - * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. - * This is used, for example, for inclusion of this object in a hash map. - */ - uint64_t (*hash)(const void *this_arg); - /** - * Called, if set, after this SocketDescriptor has been cloned into a duplicate object. - * The new SocketDescriptor is provided, and should be mutated as needed to perform a - * deep copy of the object pointed to by this_arg or avoid any double-freeing. - */ - void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor); - /** - * 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); -} LDKSocketDescriptor; +} LDKChannelHandshakeConfig; /** - * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls - * socket events into messages which it passes on to its [`MessageHandler`]. + * Optional channel limits which are applied during channel creation. * - * Locks are taken internally, so you must never assume that reentrancy from a - * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock. + * These limits are only applied to our counterparty's limits, not our own. * - * Calls to [`read_event`] will decode relevant messages and pass them to the - * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of - * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any - * [`PeerManager`] functions related to the same connection must occur only in serial, making new - * calls only after previous ones have returned. + * Use `0` or `::max_value()` as appropriate to skip checking. * - * 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. + * Provides sane defaults for most configurations. * - * [`read_event`]: PeerManager::read_event + * Most additional limits are disabled except those with which specify a default in individual + * field documentation. Note that this may result in barely-usable channels, but since they + * are applied mostly only to incoming channels that's not much of a problem. */ -typedef struct MUST_USE_STRUCT LDKPeerManager { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePeerManager *inner; + LDKnativeChannelHandshakeLimits *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; -} LDKPeerManager; +} LDKChannelHandshakeLimits; /** - * Static channel fields used to build transactions given per-commitment fields, organized by - * broadcaster/countersignatory. - * - * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the - * as_holder_broadcastable and as_counterparty_broadcastable functions. + * A parallel struct to [`ChannelConfig`] to define partial updates. */ -typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKChannelConfigUpdate { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDirectedChannelTransactionParameters *inner; + LDKnativeChannelConfigUpdate *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; -} LDKDirectedChannelTransactionParameters; +} LDKChannelConfigUpdate; /** - * Features used within an `offer`. + * Top-level config which holds ChannelHandshakeLimits and ChannelConfig. + * + * `Default::default()` provides sane defaults for most configurations + * (but currently with zero relay fees!) */ -typedef struct MUST_USE_STRUCT LDKOfferFeatures { +typedef struct MUST_USE_STRUCT LDKUserConfig { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeUserConfig *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; +} LDKUserConfig; /** - * Features used within an `invoice_request`. + * An implementation of [`chain::Watch`] for monitoring channels. + * + * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by + * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally + * or used independently to monitor channels remotely. See the [module-level documentation] for + * details. + * + * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from + * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, + * detecting substantial mempool feerate changes between blocks, and ensuring reliability if + * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an + * environment with spotty connections, like on mobile. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [module-level documentation]: crate::chain::chainmonitor + * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { +typedef struct MUST_USE_STRUCT LDKChainMonitor { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoiceRequestFeatures *inner; + LDKnativeChainMonitor *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvoiceRequestFeatures; - -/** - * Integer in the range `0..=16` - */ -typedef struct LDKWitnessVersion { - uint8_t _0; -} LDKWitnessVersion; - - +} LDKChainMonitor; /** - * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or - * another currency. + * 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 MUST_USE_STRUCT LDKAmount { +typedef struct LDKEventHandler { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeAmount *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handles the given [`Event`]. + * + * See [`EventsProvider`] for details that must be considered when implementing this method. */ - bool is_owned; -} LDKAmount; - - + struct LDKCResult_NoneReplayEventZ (*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; /** - * Quantity of items supported by an [`Offer`]. + * 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 `Ok(())`, thus handlers MUST fully handle [`Event`]s and + * persist any relevant changes to disk *before* returning `Ok(())`. In case of an error (e.g., + * persistence failure) implementors should return `Err(ReplayEvent())`, signalling to the + * [`EventsProvider`] to replay unhandled events on the next invocation (generally immediately). + * Note that some events might not be replayed, please refer to the documentation for + * the individual [`Event`] variants for more detail. + * + * 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 MUST_USE_STRUCT LDKQuantity { +typedef struct LDKEventsProvider { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeQuantity *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Processes any events generated since the last call using the given event handler. + * + * See the trait-level documentation for requirements. */ - bool is_owned; -} LDKQuantity; - - + 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; /** - * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340] - * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12]. + * 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`]. * - * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki - * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation + * For more info on failure codes, see . */ -typedef struct MUST_USE_STRUCT LDKTaggedHash { +typedef enum LDKFailureCode_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. + * 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. */ - LDKnativeTaggedHash *inner; + LDKFailureCode_TemporaryNodeFailure, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * 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. */ - bool is_owned; -} LDKTaggedHash; + LDKFailureCode_RequiredNodeFeatureMissing, + /** + * You may wish to use this when a `payment_preimage` is unknown, or the CLTV expiry of + * the HTLC is too close to the current block height for safe handling. + * Using this failure code in [`ChannelManager::fail_htlc_backwards_with_reason`] is + * equivalent to calling [`ChannelManager::fail_htlc_backwards`]. + */ + LDKFailureCode_IncorrectOrUnknownPaymentDetails, + /** + * We failed to process the payload after the onion was decrypted. You may wish to + * use this when receiving custom HTLC TLVs with even type numbers that you don't recognize. + * + * If available, the tuple data may include the type number and byte offset in the + * decrypted byte stream where the failure occurred. + */ + LDKFailureCode_InvalidOnionPayload, + /** + * Must be last for serialization purposes + */ + LDKFailureCode_Sentinel, +} LDKFailureCode_Tag; + +typedef struct MUST_USE_STRUCT LDKFailureCode { + LDKFailureCode_Tag tag; + union { + struct { + struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload; + }; + }; +} LDKFailureCode; /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * Chain-related parameters used to construct a new `ChannelManager`. * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Typically, the block-specific parameters are derived from the best block hash for the network, + * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters + * are not needed when deserializing a previously constructed `ChannelManager`. */ -typedef struct MUST_USE_STRUCT LDKErroneousField { +typedef struct MUST_USE_STRUCT LDKChainParameters { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeErroneousField *inner; + LDKnativeChainParameters *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKErroneousField; - - +} LDKChainParameters; /** - * Receives and validates network updates from peers, - * stores authentic and relevant data as a network graph. - * This network graph is then used for routing payments. - * Provides interface to help with initial routing sync by - * serving historical announcements. + * A trait indicating an object may generate message send events */ -typedef struct MUST_USE_STRUCT LDKP2PGossipSync { +typedef struct LDKMessageSendEventsProvider { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeP2PGossipSync *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. */ - bool is_owned; -} LDKP2PGossipSync; - - + 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 read-only view of [`NetworkGraph`]. + * 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`. */ -typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { +typedef struct LDKChannelMessageHandler { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeReadOnlyNetworkGraph *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle an incoming `open_channel` message from the given peer. */ - bool is_owned; -} LDKReadOnlyNetworkGraph; - - - -/** - * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a - * source node to a target node. - */ -typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo { + void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Handle an incoming `open_channel2` message from the given peer. */ - LDKnativeDirectedChannelInfo *inner; + void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle an incoming `accept_channel` message from the given peer. */ - bool is_owned; -} LDKDirectedChannelInfo; - -/** - * The effective capacity of a channel for routing purposes. - * - * While this may be smaller than the actual channel capacity, amounts greater than - * [`Self::as_msat`] should not be routed through the channel. - */ -typedef enum LDKEffectiveCapacity_Tag { + void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); /** - * The available liquidity in the channel known from being a channel counterparty, and thus a - * direct hop. + * Handle an incoming `accept_channel2` message from the given peer. */ - LDKEffectiveCapacity_ExactLiquidity, + void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg); /** - * The maximum HTLC amount in one direction as advertised on the gossip network. + * Handle an incoming `funding_created` message from the given peer. */ - LDKEffectiveCapacity_AdvertisedMaxHTLC, + void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); /** - * The total capacity of the channel as determined by the funding transaction. + * Handle an incoming `funding_signed` message from the given peer. */ - LDKEffectiveCapacity_Total, + void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); /** - * A capacity sufficient to route any payment, typically used for private channels provided by - * an invoice. + * Handle an incoming `channel_ready` message from the given peer. */ - LDKEffectiveCapacity_Infinite, + void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); /** - * The maximum HTLC amount as provided by an invoice route hint. + * Handle an incoming `shutdown` message from the given peer. */ - LDKEffectiveCapacity_HintMaxHTLC, + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); /** - * A capacity that is unknown possibly because either the chain state is unavailable to know - * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. + * Handle an incoming `closing_signed` message from the given peer. */ - LDKEffectiveCapacity_Unknown, + void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); /** - * Must be last for serialization purposes + * Handle an incoming `stfu` message from the given peer. */ - LDKEffectiveCapacity_Sentinel, -} LDKEffectiveCapacity_Tag; - -typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body { + void (*handle_stfu)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg); /** - * Either the inbound or outbound liquidity depending on the direction, denominated in - * millisatoshi. + * Handle an incoming `tx_add_input message` from the given peer. */ - uint64_t liquidity_msat; -} LDKEffectiveCapacity_LDKExactLiquidity_Body; - -typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body { + void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg); /** - * The maximum HTLC amount denominated in millisatoshi. + * Handle an incoming `tx_add_output` message from the given peer. */ - uint64_t amount_msat; -} LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body; - -typedef struct LDKEffectiveCapacity_LDKTotal_Body { + void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg); /** - * The funding amount denominated in millisatoshi. + * Handle an incoming `tx_remove_input` message from the given peer. */ - uint64_t capacity_msat; + void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg); /** - * The maximum HTLC amount denominated in millisatoshi. + * Handle an incoming `tx_remove_output` message from the given peer. */ - uint64_t htlc_maximum_msat; -} LDKEffectiveCapacity_LDKTotal_Body; - -typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body { + void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg); /** - * The maximum HTLC amount denominated in millisatoshi. + * Handle an incoming `tx_complete message` from the given peer. */ - uint64_t amount_msat; -} LDKEffectiveCapacity_LDKHintMaxHTLC_Body; - -typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { - LDKEffectiveCapacity_Tag tag; - union { - LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity; - LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc; - LDKEffectiveCapacity_LDKTotal_Body total; - LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc; - }; -} LDKEffectiveCapacity; - - - -/** - * A [`Router`] implemented using [`find_route`]. - */ -typedef struct MUST_USE_STRUCT LDKDefaultRouter { + void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg); /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Handle an incoming `tx_signatures` message from the given peer. */ - LDKnativeDefaultRouter *inner; + void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg); /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle an incoming `tx_init_rbf` message from the given peer. */ - bool is_owned; -} LDKDefaultRouter; - - - -/** - * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. - * - * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling - * [`find_route`]. - * - * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp - */ -typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { + void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg); /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Handle an incoming `tx_ack_rbf` message from the given peer. */ - LDKnativeScorerAccountingForInFlightHtlcs *inner; + void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg); /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle an incoming `tx_abort message` from the given peer. */ - bool is_owned; -} LDKScorerAccountingForInFlightHtlcs; - -/** - * The recipient of a payment, differing based on whether they've hidden their identity with route - * blinding. - */ -typedef enum LDKPayee_Tag { + void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg); /** - * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves - * will be included in the final [`Route`]. + * Handle an incoming `update_add_htlc` message from the given peer. */ - LDKPayee_Blinded, + void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); /** - * The recipient included these route hints in their BOLT11 invoice. + * Handle an incoming `update_fulfill_htlc` message from the given peer. */ - LDKPayee_Clear, + void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); /** - * Must be last for serialization purposes + * Handle an incoming `update_fail_htlc` message from the given peer. */ - LDKPayee_Sentinel, -} LDKPayee_Tag; - -typedef struct LDKPayee_LDKBlinded_Body { + void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); /** - * Aggregated routing info and blinded paths, for routing to the payee without knowing their - * node id. + * Handle an incoming `update_fail_malformed_htlc` message from the given peer. */ - struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints; + void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); /** - * Features supported by the payee. - * - * May be set from the payee's invoice. May be `None` if the invoice does not contain any - * features. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * Handle an incoming `commitment_signed` message from the given peer. */ - struct LDKBolt12InvoiceFeatures features; -} LDKPayee_LDKBlinded_Body; - -typedef struct LDKPayee_LDKClear_Body { + void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); /** - * The node id of the payee. + * Handle an incoming `revoke_and_ack` message from the given peer. */ - struct LDKPublicKey node_id; + void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. + * Handle an incoming `update_fee` message from the given peer. */ - struct LDKCVec_RouteHintZ route_hints; + void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); /** - * Features supported by the payee. + * 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. + */ + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. + * 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, bool inbound); + /** + * 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` 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. + */ + void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); + /** + * 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`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. * - * [`for_keysend`]: PaymentParameters::for_keysend + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * If it's `None`, then no particular network chain hash compatibility will be enforced when + * connecting to peers. */ - struct LDKBolt11InvoiceFeatures features; + struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); /** - * The minimum CLTV delta at the end of the route. This value must not be zero. + * Implementation of MessageSendEventsProvider for this object. */ - uint32_t final_cltv_expiry_delta; -} LDKPayee_LDKClear_Body; - -typedef struct MUST_USE_STRUCT LDKPayee { - LDKPayee_Tag tag; - union { - LDKPayee_LDKBlinded_Body blinded; - LDKPayee_LDKClear_Body clear; - }; -} LDKPayee; + struct LDKMessageSendEventsProvider MessageSendEventsProvider; + /** + * 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); +} LDKChannelMessageHandler; /** - * A trait which can both lookup and update routing channel penalty scores. - * - * This is used in places where both bounds are required and implemented for all types which - * implement [`ScoreLookUp`] and [`ScoreUpdate`]. + * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. * - * Bindings users may need to manually implement this for their custom scoring implementations. + * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ -typedef struct LDKScore { +typedef struct LDKOffersMessageHandler { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Implementation of ScoreLookUp for this object. - */ - struct LDKScoreLookUp ScoreLookUp; - /** - * Implementation of ScoreUpdate for this object. + * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, + * or replying with an error. + * + * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKScoreUpdate ScoreUpdate; + struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); /** - * Serialize the object into a byte array + * Releases any [`OffersMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a payment flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_message`]. */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKScore; - - +} LDKOffersMessageHandler; /** - * A concrete implementation of [`LockableScore`] which supports multi-threading. + * A handler for an [`OnionMessage`] containing an async payments message as its payload. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { +typedef struct LDKAsyncPaymentsMessageHandler { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeMultiThreadedLockableScore *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release + * the held funds. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - bool is_owned; -} LDKMultiThreadedLockableScore; - - - -/** - * A locked `MultiThreadedLockableScore`. - */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockRead { + struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ (*held_htlc_available)(const void *this_arg, struct LDKHeldHtlcAvailable message, struct LDKResponder responder); /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC + * should be released to the corresponding payee. */ - LDKnativeMultiThreadedScoreLockRead *inner; + void (*release_held_htlc)(const void *this_arg, struct LDKReleaseHeldHtlc message); /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Release any [`AsyncPaymentsMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating an async payment flow rather than in response + * to another message. */ - bool is_owned; -} LDKMultiThreadedScoreLockRead; - - + struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKAsyncPaymentsMessageHandler; /** - * A locked `MultiThreadedLockableScore`. + * An interface for looking up the node id of a channel counterparty for the purpose of forwarding + * an [`OnionMessage`]. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockWrite { +typedef struct LDKNodeIdLookUp { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeMultiThreadedScoreLockWrite *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Returns the node id of the forwarding node's channel counterparty with `short_channel_id`. + * + * Here, the forwarding node is referring to the node of the [`OnionMessenger`] parameterized + * by the [`NodeIdLookUp`] and the counterparty to one of that node's peers. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - bool is_owned; -} LDKMultiThreadedScoreLockWrite; + struct LDKPublicKey (*next_node_id)(const void *this_arg, uint64_t short_channel_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKNodeIdLookUp; /** - * Parameters for configuring [`ProbabilisticScorer`]. + * Arguments for the creation of a ChannelManager that are not deserialized. * - * Used to configure decay parameters that are static throughout the lifetime of the scorer. - * these decay parameters affect the score of the channel penalty and are not changed on a - * per-route penalty cost call. + * At a high-level, the process for deserializing a ChannelManager and resuming normal operation + * is: + * 1) Deserialize all stored [`ChannelMonitor`]s. + * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling: + * `<(BlockHash, ChannelManager)>::read(reader, args)` + * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored + * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted. + * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the + * same way you would handle a [`chain::Filter`] call using + * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. + * 4) Reconnect blocks on your [`ChannelMonitor`]s. + * 5) Disconnect/connect blocks on the [`ChannelManager`]. + * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. + * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you + * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in + * the next step. + * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a + * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. + * + * Note that the ordering of #4-7 is not of importance, however all four must occur before you + * call any other methods on the newly-deserialized [`ChannelManager`]. + * + * Note that because some channels may be closed during deserialization, it is critical that you + * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to + * you. If you deserialize an old ChannelManager (during which force-closure transactions may be + * broadcast), and then later deserialize a newer version of the same ChannelManager (which will + * not force-close the same channels but consider them live), you may end up revoking a state for + * which you've already broadcasted the transaction. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters { +typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeProbabilisticScoringDecayParameters *inner; + LDKnativeChannelManagerReadArgs *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; -} LDKProbabilisticScoringDecayParameters; +} LDKChannelManagerReadArgs; /** - * 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'. - * Cooperative closes may use seed/2'. - * The two close keys may be needed to claim on-chain funds! - * - * This struct cannot be used for nodes that wish to support receiving phantom payments; - * [`PhantomKeysManager`] must be used instead. + * A set of keys that were HKDF-expanded from an initial call to + * [`NodeSigner::get_inbound_payment_key_material`]. * - * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any - * previously issued invoices and attempts to pay previous invoices will fail. + * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material */ -typedef struct MUST_USE_STRUCT LDKKeysManager { +typedef struct MUST_USE_STRUCT LDKExpandedKey { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeKeysManager *inner; + LDKnativeExpandedKey *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; -} LDKKeysManager; +} LDKExpandedKey; /** - * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node - * payments. - * - * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be - * paid to one of multiple nodes. This works because we encode the invoice route hints such that - * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment - * itself without ever needing to forward to this fake node. - * - * Phantom node payments are useful for load balancing between multiple LDK nodes. They also - * provide some fault tolerance, because payers will automatically retry paying other provided - * nodes in the case that one node goes down. + * Contains fields that are both common to [`open_channel`] and `open_channel2` messages. * - * Note that multi-path payments are not supported in phantom invoices for security reasons. - * Switching between this struct and [`KeysManager`] will invalidate any previously issued - * invoices and attempts to pay previous invoices will fail. + * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message */ -typedef struct MUST_USE_STRUCT LDKPhantomKeysManager { +typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePhantomKeysManager *inner; + LDKnativeCommonOpenChannelFields *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; -} LDKPhantomKeysManager; - -/** - * A trait defining behavior for routing an [`OnionMessage`]. - */ -typedef struct LDKMessageRouter { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. - */ - struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKMessageRouter; +} LDKCommonOpenChannelFields; /** - * A sender, receiver and forwarder of [`OnionMessage`]s. - * - * # Handling Messages - * - * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding - * messages to peers or delegating to the appropriate handler for the message type. Currently, the - * available handlers are: - * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s - * * [`CustomOnionMessageHandler`], for handling user-defined message types - * - * # Sending Messages - * - * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling - * a message, the matched handler may return a response message which `OnionMessenger` will send - * on its behalf. - * - * # Example - * - * ``` - * # extern crate bitcoin; - * # use bitcoin::hashes::_export::_core::time::Duration; - * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; - * # use lightning::blinded_path::BlindedPath; - * # use lightning::sign::KeysManager; - * # use lightning::ln::peer_handler::IgnoringMessageHandler; - * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath}; - * # use lightning::onion_message::packet::OnionMessageContents; - * # use lightning::util::logger::{Logger, Record}; - * # use lightning::util::ser::{Writeable, Writer}; - * # use lightning::io; - * # use std::sync::Arc; - * # struct FakeLogger; - * # impl Logger for FakeLogger { - * # fn log(&self, record: &Record) { unimplemented!() } - * # } - * # struct FakeMessageRouter {} - * # impl MessageRouter for FakeMessageRouter { - * # fn find_path(&self, sender: PublicKey, peers: Vec, destination: Destination) -> Result { - * # unimplemented!() - * # } - * # } - * # let seed = [42u8; 32]; - * # let time = Duration::from_secs(123456); - * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); - * # let logger = Arc::new(FakeLogger {}); - * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); - * # let secp_ctx = Secp256k1::new(); - * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); - * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, hop_node_id1); - * # let destination_node_id = hop_node_id1; - * # let message_router = Arc::new(FakeMessageRouter {}); - * # let custom_message_handler = IgnoringMessageHandler {}; - * # let offers_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, &keys_manager, logger, message_router, &offers_message_handler, - * &custom_message_handler - * ); - * - * # #[derive(Clone)] - * # struct YourCustomMessage {} - * impl Writeable for YourCustomMessage { - * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { - * \t\t# Ok(()) - * \t\t// Write your custom onion message to `w` - * \t} - * } - * impl OnionMessageContents for YourCustomMessage { - * \tfn tlv_type(&self) -> u64 { - * \t\t# let your_custom_message_type = 42; - * \t\tyour_custom_message_type - * \t} - * } - * // Send a custom onion message to a node id. - * let path = OnionMessagePath { - * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2], - * \tdestination: Destination::Node(destination_node_id), - * }; - * let reply_path = None; - * # let message = YourCustomMessage {}; - * onion_messenger.send_onion_message(path, message, reply_path); - * - * // 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_for_message(&hops, &keys_manager, &secp_ctx).unwrap(); - * - * // Send a custom onion message to a blinded path. - * let path = OnionMessagePath { - * \tintermediate_nodes: vec![hop_node_id1, hop_node_id2], - * \tdestination: Destination::BlindedPath(blinded_path), - * }; - * let reply_path = None; - * # let message = YourCustomMessage {}; - * onion_messenger.send_onion_message(path, message, reply_path); - * ``` + * Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages. * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message */ -typedef struct MUST_USE_STRUCT LDKOnionMessenger { +typedef struct MUST_USE_STRUCT LDKCommonAcceptChannelFields { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeOnionMessenger *inner; + LDKnativeCommonAcceptChannelFields *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; -} LDKOnionMessenger; +} LDKCommonAcceptChannelFields; /** - * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. + * Packet of hop data for next peer */ -typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { +typedef struct MUST_USE_STRUCT LDKPacket { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDefaultMessageRouter *inner; + LDKnativePacket *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKDefaultMessageRouter; - +} LDKPacket; +/** + * A trait to describe an object which can receive routing messages. + * + * # Implementor DoS Warnings + * + * 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 { + /** + * 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; + /** + * 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. + */ + 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. + */ + 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 + * 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. + * + * 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 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 + * implementor. + * + * 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 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 + * replies to a single query. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg); + /** + * Handles the reply of a query we initiated asking for routing gossip + * messages for a list of channels. We should receive this message when + * a node has completed its best effort to send us the pertaining routing + * gossip messages. + */ + 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_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_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`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Implementation of MessageSendEventsProvider for this object. + */ + struct LDKMessageSendEventsProvider MessageSendEventsProvider; + /** + * 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); +} LDKRoutingMessageHandler; /** - * An intermediate node, its outbound channel, and relay parameters. + * A handler for received [`OnionMessage`]s and for providing generated ones to send. */ -typedef struct MUST_USE_STRUCT LDKForwardNode { +typedef struct LDKOnionMessageHandler { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. */ - LDKnativeForwardNode *inner; + void *this_arg; /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Handle an incoming `onion_message` message from the given peer. */ - bool is_owned; -} LDKForwardNode; + void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); + /** + * Returns the next pending onion message for the peer with the given node id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); + /** + * Called when a connection is established with a peer. Can be used to track which peers + * advertise onion message support and are online. + * + * 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 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. + */ + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Performs actions that should happen roughly every ten seconds after startup. Allows handlers + * to drop any buffered onion messages intended for prospective peers. + */ + void (*timer_tick_occurred)(const void *this_arg); + /** + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_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); +} LDKOnionMessageHandler; /** - * Data to construct a [`BlindedHop`] for forwarding a payment. + * BOLT 4 onion packet including hop data for the next peer. */ -typedef struct MUST_USE_STRUCT LDKForwardTlvs { +typedef struct MUST_USE_STRUCT LDKTrampolineOnionPacket { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeForwardTlvs *inner; + LDKnativeTrampolineOnionPacket *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; -} LDKForwardTlvs; +} LDKTrampolineOnionPacket; /** - * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can - * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, - * which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`], - * which can provide a default implementation of this trait when used with [`Wallet`]. + * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) + * decoders. */ -typedef struct LDKCoinSelectionSource { +typedef struct LDKCustomMessageReader { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are - * available to spend. Implementations are free to pick their coin selection algorithm of - * choice, as long as the following requirements are met: - * - * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction - * throughout coin selection, but must not be returned as part of the result. - * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction - * throughout coin selection. In some cases, like when funding an anchor transaction, this - * set is empty. Implementations should ensure they handle this correctly on their end, - * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be - * provided, in which case a zero-value empty OP_RETURN output can be used instead. - * 3. Enough inputs must be selected/contributed for the resulting transaction (including the - * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. - * - * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of - * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require - * providing the full input weight. Failing to do so may lead to underestimating fee bumps and - * delaying block inclusion. - * - * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they - * can be re-used within new fee-bumped iterations of the original claiming transaction, - * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a - * transaction associated with it, and all of the available UTXOs have already been assigned to - * other claims, implementations must be willing to double spend their UTXOs. The choice of - * which UTXOs to double spend is left to the implementation, but it must strive to keep the - * set of other claims being double spent to a minimum. - */ - struct LDKCResult_CoinSelectionNoneZ (*select_confirmed_utxos)(const void *this_arg, struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight); - /** - * Signs and provides the full witness for all inputs within the transaction known to the - * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). + * Decodes a custom message to `CustomMessageType`. If the given message type is known to the + * implementation and the message could be decoded, must return `Ok(Some(message))`. If the + * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error + * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. */ - struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx); + struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKCoinSelectionSource; +} LDKCustomMessageReader; /** - * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to - * provide a default implementation to [`CoinSelectionSource`]. + * 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 LDKWalletSource { +typedef struct LDKCustomMessageHandler { /** * An opaque pointer which is passed to your function implementations as an argument. * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; /** - * Returns all UTXOs, with at least 1 confirmation each, that are available to spend. + * 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_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg); + struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id); /** - * Returns a script to use for change above dust resulting from a successful coin selection - * attempt. + * 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 LDKCResult_CVec_u8ZNoneZ (*get_change_script)(const void *this_arg); + struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg); /** - * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within - * the transaction known to the wallet (i.e., any provided via - * [`WalletSource::list_confirmed_utxos`]). + * Indicates a peer disconnected. + */ + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Handle a peer connecting. + * + * 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, bool inbound); + /** + * 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`] + * which are broadcasted in our [`NodeAnnouncement`] message. + * + * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * [`Init`]: crate::ln::msgs::Init + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Implementation of CustomMessageReader for this object. */ - struct LDKCResult_TransactionNoneZ (*sign_tx)(const void *this_arg, struct LDKTransaction tx); + struct LDKCustomMessageReader CustomMessageReader; /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. */ void (*free)(void *this_arg); -} LDKWalletSource; +} LDKCustomMessageHandler; /** - * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would - * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double - * spends may happen. + * A dummy struct which implements `RoutingMessageHandler` without storing any routing information + * or doing any processing. You can provide one of these as the route_handler in a MessageHandler. */ -typedef struct MUST_USE_STRUCT LDKWallet { +typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeWallet *inner; + LDKnativeIgnoringMessageHandler *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; -} LDKWallet; - - +} LDKIgnoringMessageHandler; /** - * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a - * [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or - * Replace-By-Fee (RBF). + * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`], + * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages, + * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom + * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported + * message types. * - * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction + * See [`OnionMessenger`] for example usage. + * + * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler + * [`CustomMessage`]: Self::CustomMessage */ -typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler { +typedef struct LDKCustomOnionMessageHandler { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Called with the custom message that was received, returning a response to send, if any. + * + * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents message, struct LDKCOption_CVec_u8ZZ context, struct LDKResponder responder); + /** + * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the + * message type is unknown. + */ + struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); + /** + * Releases any [`Self::CustomMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a message flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_custom_message`]. + */ + struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ (*release_pending_custom_messages)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKCustomOnionMessageHandler; + + + +/** + * A dummy struct which implements `ChannelMessageHandler` without having any channels. + * You can provide one of these as the route_handler in a MessageHandler. + */ +typedef struct MUST_USE_STRUCT LDKErroringMessageHandler { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBumpTransactionEventHandler *inner; + LDKnativeErroringMessageHandler *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; -} LDKBumpTransactionEventHandler; +} LDKErroringMessageHandler; /** - * A [`KVStore`] implementation that writes to and reads from the file system. + * Provides references to trait impls which handle different types of messages. */ -typedef struct MUST_USE_STRUCT LDKFilesystemStore { +typedef struct MUST_USE_STRUCT LDKMessageHandler { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeFilesystemStore *inner; + LDKnativeMessageHandler *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; -} LDKFilesystemStore; +} LDKMessageHandler; + +/** + * Provides an object which can be used to send data to and which uniquely identifies a connection + * 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. + * + * 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 + * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no + * further calls to the [`PeerManager`] related to the original socket occur. This allows you to + * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish + * to simply use another value which is guaranteed to be globally unique instead. + */ +typedef struct LDKSocketDescriptor { + /** + * 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; + /** + * Attempts to send some data from the given slice to the peer. + * + * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. + * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be + * called and further write attempts may occur until that time. + * + * If the returned size is smaller than `data.len()`, a + * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be + * written. Additionally, until a `send_data` event completes fully, no further + * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to + * prevent denial-of-service issues, you should not read or buffer any data from the socket + * until then. + * + * If a [`PeerManager::read_event`] call on this descriptor had previously returned true + * (indicating that read events should be paused to prevent DoS in the send buffer), + * `resume_read` may be set indicating that read events on this descriptor should resume. A + * `resume_read` of false carries no meaning, and should not cause any action. + */ + uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read); + /** + * Disconnect the socket pointed to by this SocketDescriptor. + * + * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this + * call (doing so is a noop). + */ + void (*disconnect_socket)(void *this_arg); + /** + * Checks if two objects are equal given this object's this_arg pointer and another object. + */ + bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); + /** + * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. + * This is used, for example, for inclusion of this object in a hash map. + */ + uint64_t (*hash)(const void *this_arg); + /** + * Called, if set, after this SocketDescriptor has been cloned into a duplicate object. + * The new SocketDescriptor is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. + */ + void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor); + /** + * 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); +} LDKSocketDescriptor; /** - * `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`]). + * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls + * socket events into messages which it passes on to its [`MessageHandler`]. * - * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied - * upon as doing so may result in high latency. + * Locks are taken internally, so you must never assume that reentrancy from a + * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock. * - * # Note + * Calls to [`read_event`] will decode relevant messages and pass them to the + * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of + * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any + * [`PeerManager`] functions related to the same connection must occur only in serial, making new + * calls only after previous ones have returned. * - * 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. + * 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. * - * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor - * [`Event`]: lightning::events::Event - * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred - * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events - *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. + * [`read_event`]: PeerManager::read_event */ -typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { +typedef struct MUST_USE_STRUCT LDKPeerManager { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativePeerManager *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; +} LDKPeerManager; + +/** + * 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 main Rapid Gossip Sync object. - * - * See [crate-level documentation] for usage. + * Static channel fields used to build transactions given per-commitment fields, organized by + * broadcaster/countersignatory. * - * [crate-level documentation]: crate + * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the + * as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKRapidGossipSync { +typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeDirectedChannelTransactionParameters *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; +} LDKDirectedChannelTransactionParameters; + + /** - * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + * SHA-256 hash */ -typedef enum LDKGossipSync_Tag { +typedef struct MUST_USE_STRUCT LDKSha256 { /** - * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKGossipSync_P2P, + LDKnativeSha256 *inner; /** - * Rapid gossip sync from a trusted server. + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKGossipSync_Rapid, + bool is_owned; +} LDKSha256; + +/** + * An error when attempting to pay a [`Bolt12Invoice`]. + */ +typedef enum LDKBolt12PaymentError_Tag { /** - * No gossip sync. + * The invoice was not requested. */ - LDKGossipSync_None, + LDKBolt12PaymentError_UnexpectedInvoice, + /** + * Payment for an invoice with the corresponding [`PaymentId`] was already initiated. + */ + LDKBolt12PaymentError_DuplicateInvoice, + /** + * The invoice was valid for the corresponding [`PaymentId`], but required unknown features. + */ + LDKBolt12PaymentError_UnknownRequiredFeatures, + /** + * The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. + */ + LDKBolt12PaymentError_SendingFailed, /** * Must be last for serialization purposes */ - LDKGossipSync_Sentinel, -} LDKGossipSync_Tag; + LDKBolt12PaymentError_Sentinel, +} LDKBolt12PaymentError_Tag; -typedef struct MUST_USE_STRUCT LDKGossipSync { - LDKGossipSync_Tag tag; +typedef struct MUST_USE_STRUCT LDKBolt12PaymentError { + LDKBolt12PaymentError_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; + enum LDKRetryableSendFailure sending_failed; }; }; -} LDKGossipSync; +} LDKBolt12PaymentError; /** - * Data of the [`RawBolt11Invoice`] that is encoded in the data part + * Builds an [`Offer`] for the \"offer to be paid\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self */ -typedef struct MUST_USE_STRUCT LDKRawDataPart { +typedef struct MUST_USE_STRUCT LDKOfferWithExplicitMetadataBuilder { /** * A pointer to the opaque Rust object. * Nearly everywhere, 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; + LDKnativeOfferWithExplicitMetadataBuilder *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; +} LDKOfferWithExplicitMetadataBuilder; /** - * SHA-256 hash + * A string that displays only printable characters, replacing control characters with + * [`core::char::REPLACEMENT_CHARACTER`]. */ -typedef struct MUST_USE_STRUCT LDKSha256 { +typedef struct MUST_USE_STRUCT LDKPrintableString { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeSha256 *inner; + LDKnativePrintableString *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKSha256; +} LDKPrintableString; /** - * Positive duration that defines when (relatively to the timestamp) in the future the invoice - * expires + * Features used within an `offer`. */ -typedef struct MUST_USE_STRUCT LDKExpiryTime { +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. */ - LDKnativeExpiryTime *inner; + 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; -} LDKExpiryTime; +} LDKOfferFeatures; + +/** + * Represents a tweaked X-only public key as required for BIP 340 (Taproot). + */ +typedef struct LDKTweakedPublicKey { + /** + * The bytes of the public key X coordinate + */ + uint8_t x_coordinate[32]; +} LDKTweakedPublicKey; + +/** + * A function for signing an [`UnsignedBolt12Invoice`]. + */ +typedef struct LDKSignBolt12InvoiceFn { + /** + * 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; + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR message); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKSignBolt12InvoiceFn; /** - * `min_final_cltv_expiry_delta` to use for the last HTLC in the route + * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340] + * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12]. + * + * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki + * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta { +typedef struct MUST_USE_STRUCT LDKTaggedHash { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMinFinalCltvExpiryDelta *inner; + LDKnativeTaggedHash *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMinFinalCltvExpiryDelta; +} LDKTaggedHash; + + /** - * A 20-byte byte array. + * Features used within an `invoice_request`. */ -typedef struct LDKTwentyBytes { +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { /** - * The twenty bytes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - uint8_t data[20]; -} LDKTwentyBytes; + 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; + + /** - * Fallback address in case no LN payment is possible + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -typedef enum LDKFallback_Tag { - LDKFallback_SegWitProgram, - LDKFallback_PubKeyHash, - LDKFallback_ScriptHash, +typedef struct MUST_USE_STRUCT LDKErroneousField { /** - * 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. */ - LDKFallback_Sentinel, -} LDKFallback_Tag; + LDKnativeErroneousField *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKErroneousField; -typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKWitnessVersion version; - struct LDKCVec_u8Z program; -} LDKFallback_LDKSegWitProgram_Body; +/** + * A function for signing an [`UnsignedInvoiceRequest`]. + */ +typedef struct LDKSignInvoiceRequestFn { + /** + * 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; + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKSignInvoiceRequestFn; -typedef struct MUST_USE_STRUCT LDKFallback { - LDKFallback_Tag tag; +/** + * Error when signing messages. + */ +typedef enum LDKSignError_Tag { + /** + * User-defined error when signing the message. + */ + LDKSignError_Signing, + /** + * Error when verifying the produced signature using the given pubkey. + */ + LDKSignError_Verification, + /** + * Must be last for serialization purposes + */ + LDKSignError_Sentinel, +} LDKSignError_Tag; + +typedef struct MUST_USE_STRUCT LDKSignError { + LDKSignError_Tag tag; union { - LDKFallback_LDKSegWitProgram_Body seg_wit_program; struct { - struct LDKTwentyBytes pub_key_hash; - }; - struct { - struct LDKTwentyBytes script_hash; + enum LDKSecp256k1Error verification; }; }; -} LDKFallback; - -extern const uintptr_t MAX_BUF_SIZE; - -extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; - -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; - -extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; - -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 uint64_t ANCHOR_INPUT_WITNESS_WEIGHT; - -extern const uint64_t HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT; - -extern const uint64_t HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_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; +} LDKSignError; -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 + * Receives and validates network updates from peers, + * stores authentic and relevant data as a network graph. + * This network graph is then used for routing payments. + * Provides interface to help with initial routing sync by + * serving historical announcements. */ -struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); +typedef struct MUST_USE_STRUCT LDKP2PGossipSync { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeP2PGossipSync *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; +} LDKP2PGossipSync; -/** - * 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` + * A read-only view of [`NetworkGraph`]. */ -struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); +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; -/** - * 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); /** - * Creates a new Witness which has the same data as `orig` but with a new buffer. + * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a + * source node to a target node. */ -struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig); - -/** - * Frees the data pointed to by data +typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDirectedChannelInfo *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; +} LDKDirectedChannelInfo; + +/** + * The effective capacity of a channel for routing purposes. + * + * While this may be smaller than the actual channel capacity, amounts greater than + * [`Self::as_msat`] should not be routed through the channel. + */ +typedef enum LDKEffectiveCapacity_Tag { + /** + * The available liquidity in the channel known from being a channel counterparty, and thus a + * direct hop. + */ + LDKEffectiveCapacity_ExactLiquidity, + /** + * The maximum HTLC amount in one direction as advertised on the gossip network. + */ + LDKEffectiveCapacity_AdvertisedMaxHTLC, + /** + * The total capacity of the channel as determined by the funding transaction. + */ + LDKEffectiveCapacity_Total, + /** + * A capacity sufficient to route any payment, typically used for private channels provided by + * an invoice. + */ + LDKEffectiveCapacity_Infinite, + /** + * The maximum HTLC amount as provided by an invoice route hint. + */ + LDKEffectiveCapacity_HintMaxHTLC, + /** + * A capacity that is unknown possibly because either the chain state is unavailable to know + * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. + */ + LDKEffectiveCapacity_Unknown, + /** + * Must be last for serialization purposes + */ + LDKEffectiveCapacity_Sentinel, +} LDKEffectiveCapacity_Tag; + +typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body { + /** + * Either the inbound or outbound liquidity depending on the direction, denominated in + * millisatoshi. + */ + uint64_t liquidity_msat; +} LDKEffectiveCapacity_LDKExactLiquidity_Body; + +typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t amount_msat; +} LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body; + +typedef struct LDKEffectiveCapacity_LDKTotal_Body { + /** + * The funding amount denominated in millisatoshi. + */ + uint64_t capacity_msat; + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t htlc_maximum_msat; +} LDKEffectiveCapacity_LDKTotal_Body; + +typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t amount_msat; +} LDKEffectiveCapacity_LDKHintMaxHTLC_Body; + +typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { + LDKEffectiveCapacity_Tag tag; + union { + LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity; + LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc; + LDKEffectiveCapacity_LDKTotal_Body total; + LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc; + }; +} LDKEffectiveCapacity; + + + +/** + * A [`Router`] implemented using [`find_route`]. + * + * # Privacy + * + * Implements [`MessageRouter`] by delegating to [`DefaultMessageRouter`]. See those docs for + * privacy implications. + */ +typedef struct MUST_USE_STRUCT LDKDefaultRouter { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDefaultRouter *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDefaultRouter; + + + +/** + * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. + * + * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling + * [`find_route`]. + * + * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp + */ +typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeScorerAccountingForInFlightHtlcs *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKScorerAccountingForInFlightHtlcs; + +/** + * The recipient of a payment, differing based on whether they've hidden their identity with route + * blinding. + */ +typedef enum LDKPayee_Tag { + /** + * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves + * will be included in the final [`Route`]. + */ + LDKPayee_Blinded, + /** + * The recipient included these route hints in their BOLT11 invoice. + */ + LDKPayee_Clear, + /** + * Must be last for serialization purposes + */ + LDKPayee_Sentinel, +} LDKPayee_Tag; + +typedef struct LDKPayee_LDKBlinded_Body { + /** + * Aggregated routing info and blinded paths, for routing to the payee without knowing their + * node id. + */ + struct LDKCVec_BlindedPaymentPathZ route_hints; + /** + * Features supported by the payee. + * + * May be set from the payee's invoice. May be `None` if the invoice does not contain any + * features. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBolt12InvoiceFeatures features; +} LDKPayee_LDKBlinded_Body; + +typedef struct LDKPayee_LDKClear_Body { + /** + * The node id of the payee. + */ + struct LDKPublicKey node_id; + /** + * Hints for routing to the payee, containing channels connecting the payee to public nodes. + */ + struct LDKCVec_RouteHintZ route_hints; + /** + * 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`]: PaymentParameters::for_keysend + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBolt11InvoiceFeatures features; + /** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ + uint32_t final_cltv_expiry_delta; +} LDKPayee_LDKClear_Body; + +typedef struct MUST_USE_STRUCT LDKPayee { + LDKPayee_Tag tag; + union { + LDKPayee_LDKBlinded_Body blinded; + LDKPayee_LDKClear_Body clear; + }; +} LDKPayee; + +/** + * A trait which can both lookup and update routing channel penalty scores. + * + * This is used in places where both bounds are required and implemented for all types which + * implement [`ScoreLookUp`] and [`ScoreUpdate`]. + * + * Bindings users may need to manually implement this for their custom scoring implementations. + */ +typedef struct LDKScore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Implementation of ScoreLookUp for this object. + */ + struct LDKScoreLookUp ScoreLookUp; + /** + * Implementation of ScoreUpdate for this object. + */ + struct LDKScoreUpdate ScoreUpdate; + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKScore; + + + +/** + * A concrete implementation of [`LockableScore`] which supports multi-threading. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMultiThreadedLockableScore *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMultiThreadedLockableScore; + + + +/** + * A locked `MultiThreadedLockableScore`. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockRead { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMultiThreadedScoreLockRead *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMultiThreadedScoreLockRead; + + + +/** + * A locked `MultiThreadedLockableScore`. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLockWrite { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMultiThreadedScoreLockWrite *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMultiThreadedScoreLockWrite; + + + +/** + * Parameters for configuring [`ProbabilisticScorer`]. + * + * Used to configure decay parameters that are static throughout the lifetime of the scorer. + * these decay parameters affect the score of the channel penalty and are not changed on a + * per-route penalty cost call. + */ +typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeProbabilisticScoringDecayParameters *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; +} LDKProbabilisticScoringDecayParameters; + + + +/** + * 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'. + * Cooperative closes may use seed/2'. + * The two close keys may be needed to claim on-chain funds! + * + * This struct cannot be used for nodes that wish to support receiving phantom payments; + * [`PhantomKeysManager`] must be used instead. + * + * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any + * previously issued invoices and attempts to pay previous invoices will fail. + */ +typedef struct MUST_USE_STRUCT LDKKeysManager { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeKeysManager *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; +} LDKKeysManager; + + + +/** + * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node + * payments. + * + * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be + * paid to one of multiple nodes. This works because we encode the invoice route hints such that + * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment + * itself without ever needing to forward to this fake node. + * + * Phantom node payments are useful for load balancing between multiple LDK nodes. They also + * provide some fault tolerance, because payers will automatically retry paying other provided + * nodes in the case that one node goes down. + * + * Note that multi-path payments are not supported in phantom invoices for security reasons. + * Switching between this struct and [`KeysManager`] will invalidate any previously issued + * invoices and attempts to pay previous invoices will fail. + */ +typedef struct MUST_USE_STRUCT LDKPhantomKeysManager { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePhantomKeysManager *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; +} LDKPhantomKeysManager; + + + +/** + * An implementation of [`EntropySource`] using ChaCha20. + */ +typedef struct MUST_USE_STRUCT LDKRandomBytes { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRandomBytes *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; +} LDKRandomBytes; + + + +/** + * A sender, receiver and forwarder of [`OnionMessage`]s. + * + * # Handling Messages + * + * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding + * messages to peers or delegating to the appropriate handler for the message type. Currently, the + * available handlers are: + * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s + * * [`CustomOnionMessageHandler`], for handling user-defined message types + * + * # Sending Messages + * + * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling + * a message, the matched handler may return a response message which `OnionMessenger` will send + * on its behalf. + * + * # Example + * + * ``` + * # extern crate bitcoin; + * # use bitcoin::hashes::_export::_core::time::Duration; + * # use bitcoin::hex::FromHex; + * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey, self}; + * # use lightning::blinded_path::EmptyNodeIdLookUp; + * # use lightning::blinded_path::message::{BlindedMessagePath, MessageForwardNode, MessageContext}; + * # use lightning::sign::{EntropySource, KeysManager}; + * # use lightning::ln::peer_handler::IgnoringMessageHandler; + * # use lightning::onion_message::messenger::{Destination, MessageRouter, MessageSendInstructions, OnionMessagePath, OnionMessenger}; + * # use lightning::onion_message::packet::OnionMessageContents; + * # use lightning::util::logger::{Logger, Record}; + * # use lightning::util::ser::{Writeable, Writer}; + * # use lightning::io; + * # use std::sync::Arc; + * # struct FakeLogger; + * # impl Logger for FakeLogger { + * # fn log(&self, record: Record) { println!(\"{:?}\" , record); } + * # } + * # struct FakeMessageRouter {} + * # impl MessageRouter for FakeMessageRouter { + * # fn find_path(&self, sender: PublicKey, peers: Vec, destination: Destination) -> Result { + * # let secp_ctx = Secp256k1::new(); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let hop_node_id2 = hop_node_id1; + * # Ok(OnionMessagePath { + * # intermediate_nodes: vec![hop_node_id1, hop_node_id2], + * # destination, + * # first_node_addresses: None, + * # }) + * # } + * # fn create_blinded_paths( + * # &self, _recipient: PublicKey, _context: MessageContext, _peers: Vec, _secp_ctx: &Secp256k1 + * # ) -> Result, ()> { + * # unreachable!() + * # } + * # } + * # let seed = [42u8; 32]; + * # let time = Duration::from_secs(123456); + * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); + * # let logger = Arc::new(FakeLogger {}); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let secp_ctx = Secp256k1::new(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let (hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1); + * # let destination_node_id = hop_node_id1; + * # let node_id_lookup = EmptyNodeIdLookUp {}; + * # let message_router = Arc::new(FakeMessageRouter {}); + * # let custom_message_handler = IgnoringMessageHandler {}; + * # let offers_message_handler = IgnoringMessageHandler {}; + * # let async_payments_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, &keys_manager, logger, &node_id_lookup, message_router, + * &offers_message_handler, &async_payments_message_handler, &custom_message_handler + * ); + * + * # #[derive(Debug, Clone)] + * # struct YourCustomMessage {} + * impl Writeable for YourCustomMessage { + * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { + * \t\t# Ok(()) + * \t\t// Write your custom onion message to `w` + * \t} + * } + * impl OnionMessageContents for YourCustomMessage { + * \tfn tlv_type(&self) -> u64 { + * \t\t# let your_custom_message_type = 42; + * \t\tyour_custom_message_type + * \t} + * \tfn msg_type(&self) -> &'static str { \"YourCustomMessageType\" } + * } + * // Send a custom onion message to a node id. + * let destination = Destination::Node(destination_node_id); + * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, instructions); + * + * // Create a blinded path to yourself, for someone to send an onion message to. + * # let your_node_id = hop_node_id1; + * let hops = [ + * \tMessageForwardNode { node_id: hop_node_id3, short_channel_id: None }, + * \tMessageForwardNode { node_id: hop_node_id4, short_channel_id: None }, + * ]; + * let context = MessageContext::Custom(Vec::new()); + * let blinded_path = BlindedMessagePath::new(&hops, your_node_id, context, &keys_manager, &secp_ctx).unwrap(); + * + * // Send a custom onion message to a blinded path. + * let destination = Destination::BlindedPath(blinded_path); + * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, instructions); + * ``` + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +typedef struct MUST_USE_STRUCT LDKOnionMessenger { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOnionMessenger *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; +} LDKOnionMessenger; + + + +/** + * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. + * + * # Privacy + * + * Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, + * it will create a one-hop path using the recipient as the introduction node if it is a announced + * node. Otherwise, there is no way to find a path to the introduction node in order to send a + * message, and thus an `Err` is returned. + */ +typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDefaultMessageRouter *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; +} LDKDefaultMessageRouter; + +/** + * The unblinded node in a blinded path. + */ +typedef enum LDKIntroductionNode_Tag { + /** + * The node id of the introduction node. + */ + LDKIntroductionNode_NodeId, + /** + * The short channel id of the channel leading to the introduction node. The [`Direction`] + * identifies which side of the channel is the introduction node. + */ + LDKIntroductionNode_DirectedShortChannelId, + /** + * Must be last for serialization purposes + */ + LDKIntroductionNode_Sentinel, +} LDKIntroductionNode_Tag; + +typedef struct LDKIntroductionNode_LDKDirectedShortChannelId_Body { + enum LDKDirection _0; + uint64_t _1; +} LDKIntroductionNode_LDKDirectedShortChannelId_Body; + +typedef struct MUST_USE_STRUCT LDKIntroductionNode { + LDKIntroductionNode_Tag tag; + union { + struct { + struct LDKPublicKey node_id; + }; + LDKIntroductionNode_LDKDirectedShortChannelId_Body directed_short_channel_id; + }; +} LDKIntroductionNode; + + + +/** + * A [`NodeIdLookUp`] that always returns `None`. + */ +typedef struct MUST_USE_STRUCT LDKEmptyNodeIdLookUp { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeEmptyNodeIdLookUp *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; +} LDKEmptyNodeIdLookUp; + + + +/** + * Data to construct a [`BlindedHop`] for forwarding a payment. + */ +typedef struct MUST_USE_STRUCT LDKForwardTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeForwardTlvs *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKForwardTlvs; + +/** + * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can + * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, + * which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`], + * which can provide a default implementation of this trait when used with [`Wallet`]. + */ +typedef struct LDKCoinSelectionSource { + /** + * 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; + /** + * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are + * available to spend. Implementations are free to pick their coin selection algorithm of + * choice, as long as the following requirements are met: + * + * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction + * throughout coin selection, but must not be returned as part of the result. + * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction + * throughout coin selection. In some cases, like when funding an anchor transaction, this + * set is empty. Implementations should ensure they handle this correctly on their end, + * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be + * provided, in which case a zero-value empty OP_RETURN output can be used instead. + * 3. Enough inputs must be selected/contributed for the resulting transaction (including the + * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. + * + * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of + * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require + * providing the full input weight. Failing to do so may lead to underestimating fee bumps and + * delaying block inclusion. + * + * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they + * can be re-used within new fee-bumped iterations of the original claiming transaction, + * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a + * transaction associated with it, and all of the available UTXOs have already been assigned to + * other claims, implementations must be willing to double spend their UTXOs. The choice of + * which UTXOs to double spend is left to the implementation, but it must strive to keep the + * set of other claims being double spent to a minimum. + */ + struct LDKCResult_CoinSelectionNoneZ (*select_confirmed_utxos)(const void *this_arg, struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight); + /** + * Signs and provides the full witness for all inputs within the transaction known to the + * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. + */ + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKCoinSelectionSource; + +/** + * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to + * provide a default implementation to [`CoinSelectionSource`]. + */ +typedef struct LDKWalletSource { + /** + * 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 all UTXOs, with at least 1 confirmation each, that are available to spend. + */ + struct LDKCResult_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg); + /** + * Returns a script to use for change above dust resulting from a successful coin selection + * attempt. + */ + struct LDKCResult_CVec_u8ZNoneZ (*get_change_script)(const void *this_arg); + /** + * Signs and provides the full [`TxIn::script_sig`] and [`TxIn::witness`] for all inputs within + * the transaction known to the wallet (i.e., any provided via + * [`WalletSource::list_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. + */ + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKWalletSource; + + + +/** + * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would + * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double + * spends may happen. + */ +typedef struct MUST_USE_STRUCT LDKWallet { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeWallet *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; +} LDKWallet; + + + +/** + * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a + * [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or + * Replace-By-Fee (RBF). + * + * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction + */ +typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBumpTransactionEventHandler *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; +} LDKBumpTransactionEventHandler; + + + +/** + * A [`KVStore`] implementation that writes to and reads from the file system. + */ +typedef struct MUST_USE_STRUCT LDKFilesystemStore { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeFilesystemStore *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKFilesystemStore; + + + +/** + * `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. + * + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * [`ChannelManager::timer_tick_occurred`]: lightning::ln::channelmanager::ChannelManager::timer_tick_occurred + * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor + * [`Event`]: lightning::events::Event + * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred + * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events + *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 [`RawBolt11Invoice`] 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; + + + +/** + * 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 uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; + +extern const uint64_t MAX_SCID_BLOCK; + +extern const uint64_t MAX_SCID_TX_INDEX; + +extern const uint64_t MAX_SCID_VOUT_INDEX; + +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 uint64_t ANCHOR_INPUT_WITNESS_WEIGHT; + +extern const uint64_t HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT; + +extern const uint64_t HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT; + +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + +extern const uintptr_t PAYER_NOTE_LIMIT; + +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 uint8_t MAX_PATH_LENGTH_ESTIMATE; + +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); + +/** + * Constructs a new WitnessProgram given a version and program bytes. + * + * The program MUST be at least 2 bytes and no longer than 40 bytes long. + * Further, if the version is 0, the program MUST be either exactly 20 or exactly 32 bytes long. + */ +struct LDKWitnessProgram WitnessProgram_new(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); + +/** + * Gets the `WitnessVersion` of the given `WitnessProgram` + */ +struct LDKWitnessVersion WitnessProgram_get_version(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Gets the witness program bytes of the given `WitnessProgram` + */ +struct LDKu8slice WitnessProgram_get_program(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Creates a new WitnessProgram which has the same data as `orig` + */ +struct LDKWitnessProgram WitnessProgram_clone(const struct LDKWitnessProgram *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `WitnessProgram` (which is currently none) + */ +void WitnessProgram_free(struct LDKWitnessProgram o); + +/** + * Convenience function for constructing a new BigEndianScalar + */ +struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); + +/** + * Creates a new BigEndianScalar which has the same data as `orig` + */ +struct LDKBigEndianScalar BigEndianScalar_clone(const struct LDKBigEndianScalar *NONNULL_PTR orig); + +/** + * 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); + +/** + * Creates a new Witness which has the same data as `orig` but with a new buffer. + */ +struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig); + +/** + * Frees the data pointed to by data + */ +void Witness_free(struct LDKWitness _res); + +/** + * Convenience function for constructing a new TxIn + */ +struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); + +/** + * Gets the `witness` in the given `TxIn`. + */ +struct LDKWitness TxIn_get_witness(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the `script_sig` in the given `TxIn`. + */ +struct LDKu8slice TxIn_get_script_sig(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the `sequence` in the given `TxIn`. + */ +uint32_t TxIn_get_sequence(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the previous outpoint txid in the given `TxIn`. + */ +struct LDKThirtyTwoBytes TxIn_get_previous_txid(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the previout outpoint index in the given `TxIn`. + */ +uint32_t TxIn_get_previous_vout(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Frees the witness and script_sig in a TxIn + */ +void TxIn_free(struct LDKTxIn _res); + +/** + * Convenience function for constructing a new TxOut + */ +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); + +/** + * Gets the `script_pubkey` in the given `TxOut`. + */ +struct LDKu8slice TxOut_get_script_pubkey(const struct LDKTxOut *NONNULL_PTR txout); + +/** + * Gets the value in the given `TxOut`. + */ +uint64_t TxOut_get_value(const struct LDKTxOut *NONNULL_PTR txout); + +/** + * 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 + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_u8Z_free(struct LDKCVec_u8Z _res); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKRefundMaybeWithDerivedMetadataBuilder o); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ. + */ +void CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundBolt12SemanticErrorZ. + */ +void CResult_RefundBolt12SemanticErrorZ_free(struct LDKCResult_RefundBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_u64Z containing a u64 + */ +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); + +/** + * Constructs a new COption_u64Z containing nothing + */ +struct LDKCOption_u64Z COption_u64Z_none(void); + +/** + * Frees any resources associated with the u64, if we are in the Some state + */ +void COption_u64Z_free(struct LDKCOption_u64Z _res); + +/** + * Creates a new COption_u64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedMessagePathZ_free(struct LDKCVec_BlindedMessagePathZ _res); + +/** + * Creates a new CResult_RefundDecodeErrorZ in the success state. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundDecodeErrorZ in the error state. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundDecodeErrorZ_is_ok(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundDecodeErrorZ. + */ +void CResult_RefundDecodeErrorZ_free(struct LDKCResult_RefundDecodeErrorZ _res); + +/** + * Creates a new CResult_RefundDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_clone(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. + */ +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. + */ +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundBolt12ParseErrorZ. + */ +void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RetryDecodeErrorZ in the success state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); + +/** + * Creates a new CResult_RetryDecodeErrorZ in the error state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RetryDecodeErrorZ. + */ +void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); + +/** + * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NoneAPIErrorZ in the success state. + */ +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); + +/** + * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes + */ +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); + +/** + * Constructs a new COption_ThirtyTwoBytesZ containing nothing + */ +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + */ +void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); + +/** + * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); + +/** + * 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); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. + */ +struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b); + +/** + * Frees any resources used by the C2Tuple_u64CVec_u8ZZ. + */ +void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. + */ +void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKUnsignedBolt12Invoice o); + +/** + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ. + */ +void CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKBolt12Invoice o); + +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ. + */ +void CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SchnorrSignatureNoneZ in the success state. + */ +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); + +/** + * Creates a new CResult_SchnorrSignatureNoneZ in the error state. + */ +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SchnorrSignatureNoneZ. + */ +void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); + +/** + * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_StrZ_free(struct LDKCVec_StrZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o); + +/** + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state + */ +void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res); + +/** + * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_clone(const struct LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount + */ +struct LDKCOption_AmountZ COption_AmountZ_some(struct LDKAmount o); + +/** + * Constructs a new COption_AmountZ containing nothing + */ +struct LDKCOption_AmountZ COption_AmountZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state + */ +void COption_AmountZ_free(struct LDKCOption_AmountZ _res); + +/** + * Creates a new COption_AmountZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_AmountZ COption_AmountZ_clone(const struct LDKCOption_AmountZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity + */ +struct LDKCOption_QuantityZ COption_QuantityZ_some(struct LDKQuantity o); + +/** + * Constructs a new COption_QuantityZ containing nothing + */ +struct LDKCOption_QuantityZ COption_QuantityZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state + */ +void COption_QuantityZ_free(struct LDKCOption_QuantityZ _res); + +/** + * Creates a new COption_QuantityZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_QuantityZ COption_QuantityZ_clone(const struct LDKCOption_QuantityZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. + */ +void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the success state. + */ +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_ok(struct LDKBolt12Invoice o); + +/** + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt12InvoiceDecodeErrorZ. + */ +void CResult_Bolt12InvoiceDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); + +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. + */ +void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); + +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); + +/** + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + */ +void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); + +/** + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); + +/** + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + */ +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); + +/** + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); + +/** + * Constructs a new COption_u32Z containing a u32 + */ +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); + +/** + * Constructs a new COption_u32Z containing nothing + */ +struct LDKCOption_u32Z COption_u32Z_none(void); + +/** + * Frees any resources associated with the u32, if we are in the Some state + */ +void COption_u32Z_free(struct LDKCOption_u32Z _res); + +/** + * Creates a new COption_u32Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_clone(const struct LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. + */ +struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_new(struct LDKCVec_u8Z a, uint64_t b); + +/** + * Frees any resources used by the C2Tuple_CVec_u8Zu64Z. + */ +void C2Tuple_CVec_u8Zu64Z_free(struct LDKC2Tuple_CVec_u8Zu64Z _res); + +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu64Z o); + +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. + */ +void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); + +/** + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. + */ +void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); + +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. + */ +void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); + +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PublicKeyNoneZ in the success state. + */ +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); + +/** + * Creates a new CResult_PublicKeyNoneZ in the error state. + */ +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PublicKeyNoneZ. + */ +void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); + +/** + * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult__u832NoneZ in the success state. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult__u832NoneZ in the error state. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult__u832NoneZ_is_ok(const struct LDKCResult__u832NoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult__u832NoneZ. + */ +void CResult__u832NoneZ_free(struct LDKCResult__u832NoneZ _res); + +/** + * Creates a new CResult__u832NoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_clone(const struct LDKCResult__u832NoneZ *NONNULL_PTR orig); + +/** + * 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); + +/** + * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar + */ +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); + +/** + * Constructs a new COption_BigEndianScalarZ containing nothing + */ +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state + */ +void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); + +/** + * Creates a new COption_BigEndianScalarZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + */ +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); + +/** + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + */ +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + */ +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); + +/** + * Creates a new CResult_RecoverableSignatureNoneZ 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); + +/** + * Creates a new CResult_ECDSASignatureNoneZ in the success state. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); + +/** + * Creates a new CResult_ECDSASignatureNoneZ in the error state. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ECDSASignatureNoneZ. + */ +void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); + +/** + * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TransactionNoneZ in the success state. + */ +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); + +/** + * Creates a new CResult_TransactionNoneZ in the error state. + */ +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TransactionNoneZ. + */ +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); + +/** + * Creates a new CResult_TransactionNoneZ 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); + +/** + * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the success state. + */ +struct LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_ok(struct LDKEcdsaChannelSigner o); + +/** + * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the error state. + */ +struct LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_EcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_EcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_EcdsaChannelSignerDecodeErrorZ. + */ +void CResult_EcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_EcdsaChannelSignerDecodeErrorZ _res); + +/** + * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_EcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_u8ZNoneZ in the success state. + */ +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZNoneZ in the error state. + */ +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZNoneZ. + */ +void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); + +/** + * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownScriptNoneZ in the success state. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o); + +/** + * Creates a new CResult_ShutdownScriptNoneZ in the error state. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptNoneZ. + */ +void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res); + +/** + * Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_u16Z containing a u16 + */ +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); + +/** + * Constructs a new COption_u16Z containing nothing + */ +struct LDKCOption_u16Z COption_u16Z_none(void); + +/** + * Frees any resources associated with the u16, if we are in the Some state + */ +void COption_u16Z_free(struct LDKCOption_u16Z _res); + +/** + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); + +/** + * Constructs a new COption_boolZ containing a bool + */ +struct LDKCOption_boolZ COption_boolZ_some(bool o); + +/** + * Constructs a new COption_boolZ containing nothing + */ +struct LDKCOption_boolZ COption_boolZ_none(void); + +/** + * Frees any resources associated with the bool, if we are in the Some state + */ +void COption_boolZ_free(struct LDKCOption_boolZ _res); + +/** + * Creates a new COption_boolZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_boolZ COption_boolZ_clone(const struct LDKCOption_boolZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_WitnessNoneZ in the success state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_ok(struct LDKWitness o); + +/** + * Creates a new CResult_WitnessNoneZ in the error state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_WitnessNoneZ_is_ok(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_WitnessNoneZ. + */ +void CResult_WitnessNoneZ_free(struct LDKCResult_WitnessNoneZ _res); + +/** + * Creates a new CResult_WitnessNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_clone(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. + */ +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); + +/** + * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. + */ +void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); + +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); + +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. + */ +void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + */ +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); + +/** + * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. + */ +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + */ +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); + +/** + * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); + +/** + * 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_NoneIOErrorZ in the success state. + */ +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); + +/** + * Creates a new CResult_NoneIOErrorZ in the error state. + */ +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneIOErrorZ. + */ +void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); + +/** + * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. + */ +struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(struct LDKThirtyTwoBytes a, struct LDKRecipientOnionFields b, struct LDKRouteParameters c); + +/** + * Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. + */ +void C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res); + +/** + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. + */ +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o); + +/** + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. + */ +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. + */ +void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res); + +/** + * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedPaymentPathZ_free(struct LDKCVec_BlindedPaymentPathZ _res); + +/** + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. + */ +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_ok(struct LDKCVec_BlindedPaymentPathZ o); + +/** + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the error state. + */ +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_BlindedPaymentPathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_BlindedPaymentPathZNoneZ. + */ +void CResult_CVec_BlindedPaymentPathZNoneZ_free(struct LDKCResult_CVec_BlindedPaymentPathZNoneZ _res); + +/** + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +/** + * Creates a new CResult_OnionMessagePathNoneZ in the success state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); + +/** + * Creates a new CResult_OnionMessagePathNoneZ in the error state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionMessagePathNoneZ. + */ +void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); + +/** + * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_ok(struct LDKCVec_BlindedMessagePathZ o); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_BlindedMessagePathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. + */ +void CResult_CVec_BlindedMessagePathZNoneZ_free(struct LDKCResult_CVec_BlindedMessagePathZNoneZ _res); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_clone(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MessageForwardNodeZ_free(struct LDKCVec_MessageForwardNodeZ _res); + +/** + * 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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _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); + +/** + * 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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); + +/** + * 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 C2Tuple_Z from the contained elements. + */ +struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); + +/** + * Frees any resources used by the C2Tuple_Z. + */ +void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); + +/** + * Creates a new C2Tuple__u1632_u1632Z from the contained elements. + */ +struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); + +/** + * Frees any resources used by the C2Tuple__u1632_u1632Z. + */ +void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res); + +/** + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z + */ +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); + +/** + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing + */ +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state + */ +void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); + +/** + * Constructs a new COption_f64Z containing a f64 + */ +struct LDKCOption_f64Z COption_f64Z_some(double o); + +/** + * Constructs a new COption_f64Z containing nothing + */ +struct LDKCOption_f64Z COption_f64Z_none(void); + +/** + * Frees any resources associated with the f64, if we are in the Some state + */ +void COption_f64Z_free(struct LDKCOption_f64Z _res); + +/** + * Creates a new COption_f64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); + +/** + * 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_BestBlockDecodeErrorZ in the success state. + */ +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_ok(struct LDKBestBlock o); + +/** + * Creates a new CResult_BestBlockDecodeErrorZ in the error state. + */ +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BestBlockDecodeErrorZ_is_ok(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BestBlockDecodeErrorZ. + */ +void CResult_BestBlockDecodeErrorZ_free(struct LDKCResult_BestBlockDecodeErrorZ _res); + +/** + * Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_clone(const struct LDKCResult_BestBlockDecodeErrorZ *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_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 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. + */ +struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, uint32_t b, struct LDKCOption_ThirtyTwoBytesZ c); + +/** + * Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. + */ +void C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); + +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. + */ +void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +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 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); + +/** + * Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements. + */ +struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKChannelId b, struct LDKCVec_MonitorEventZ c, struct LDKPublicKey d); + +/** + * Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ. + */ +void C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _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_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); + +/** + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. + */ +void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. + */ +void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); + +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * 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); + +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + */ +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); + +/** + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + */ +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_OfferIdDecodeErrorZ in the success state. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_ok(struct LDKOfferId o); + +/** + * Creates a new CResult_OfferIdDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferIdDecodeErrorZ_is_ok(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferIdDecodeErrorZ. + */ +void CResult_OfferIdDecodeErrorZ_free(struct LDKCResult_OfferIdDecodeErrorZ _res); + +/** + * Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_clone(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); + +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. + */ +void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_ok(struct LDKOffer o); + +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferBolt12SemanticErrorZ. + */ +void CResult_OfferBolt12SemanticErrorZ_free(struct LDKCResult_OfferBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerIdBuilder o); + +/** + * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ. + */ +void CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithExplicitPayerIdBuilder o); + +/** + * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ. + */ +void CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_OfferDecodeErrorZ in the success state. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_ok(struct LDKOffer o); + +/** + * Creates a new CResult_OfferDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferDecodeErrorZ_is_ok(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferDecodeErrorZ. + */ +void CResult_OfferDecodeErrorZ_free(struct LDKCResult_OfferDecodeErrorZ _res); + +/** + * Creates a new CResult_OfferDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_clone(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. + */ +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o); + +/** + * Creates a new CResult_OfferBolt12ParseErrorZ in the error state. + */ +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferBolt12ParseErrorZ. + */ +void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res); + +/** + * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *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); + +/** + * Frees any resources used by the CResult_NodeIdDecodeErrorZ. + */ +void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. + */ +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); + +/** + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. + */ +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. + */ +void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); + +/** + * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + */ +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); + +/** + * Constructs a new COption_NetworkUpdateZ containing nothing + */ +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + */ +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); + +/** + * Creates a new COption_NetworkUpdateZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + */ +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup + */ +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); + +/** + * Constructs a new COption_UtxoLookupZ containing nothing + */ +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state + */ +void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); + +/** + * Creates a new CResult_NoneLightningErrorZ in the success state. + */ +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); + +/** + * Creates a new CResult_NoneLightningErrorZ in the error state. + */ +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneLightningErrorZ. + */ +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); + +/** + * Creates a new CResult_NoneLightningErrorZ 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_boolLightningErrorZ in the success state. + */ +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); + +/** + * Creates a new CResult_boolLightningErrorZ in the error state. + */ +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_boolLightningErrorZ. + */ +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); + +/** + * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. + */ +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); + +/** + * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + */ +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); + +/** + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + */ +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); + +/** + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing + */ +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); + +/** + * 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 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); + +/** + * 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_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. + */ +void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ 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); + +/** + * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); + +/** + * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + */ +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelInfoDecodeErrorZ 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); + +/** + * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. + */ +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); + +/** + * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + */ +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + */ +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); + +/** + * Creates a new CResult_RoutingFeesDecodeErrorZ 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_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); + +/** + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); + +/** + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + */ +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ 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); + +/** + * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); + +/** + * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. + */ +void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo + */ +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_some(struct LDKNodeAnnouncementInfo o); + +/** + * Constructs a new COption_NodeAnnouncementInfoZ containing nothing + */ +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state + */ +void COption_NodeAnnouncementInfoZ_free(struct LDKCOption_NodeAnnouncementInfoZ _res); + +/** + * Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_clone(const struct LDKCOption_NodeAnnouncementInfoZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); + +/** + * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + */ +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeInfoDecodeErrorZ 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); + +/** + * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + */ +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); + +/** + * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + */ +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. + */ +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); + +/** + * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ + */ +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); + +/** + * Constructs a new COption_CVec_SocketAddressZZ containing nothing + */ +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state + */ +void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); + +/** + * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_u64ShortChannelIdErrorZ in the success state. + */ +struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_ok(uint64_t o); + +/** + * Creates a new CResult_u64ShortChannelIdErrorZ in the error state. + */ +struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_err(enum LDKShortChannelIdError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_u64ShortChannelIdErrorZ_is_ok(const struct LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_u64ShortChannelIdErrorZ. + */ +void CResult_u64ShortChannelIdErrorZ_free(struct LDKCResult_u64ShortChannelIdErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. + */ +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_ok(struct LDKPendingHTLCInfo o); + +/** + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. + */ +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_err(struct LDKInboundHTLCErr e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. + */ +void CResult_PendingHTLCInfoInboundHTLCErrZ_free(struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res); + +/** + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_clone(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res); + +/** + * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut + */ +struct LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o); + +/** + * Constructs a new COption_TxOutZ containing nothing + */ +struct LDKCOption_TxOutZ COption_TxOutZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state + */ +void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res); + +/** + * Creates a new COption_TxOutZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_InputZ_free(struct LDKCVec_InputZ _res); + +/** + * Creates a new CResult_CoinSelectionNoneZ in the success state. + */ +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o); + +/** + * Creates a new CResult_CoinSelectionNoneZ in the error state. + */ +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CoinSelectionNoneZ. + */ +void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res); + +/** + * Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_UtxoZNoneZ in the success state. + */ +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o); + +/** + * Creates a new CResult_CVec_UtxoZNoneZ in the error state. + */ +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_UtxoZNoneZ. + */ +void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); + +/** + * Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext + */ +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_some(struct LDKPaymentContext o); + +/** + * Constructs a new COption_PaymentContextZ containing nothing + */ +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state + */ +void COption_PaymentContextZ_free(struct LDKCOption_PaymentContextZ _res); + +/** + * Creates a new COption_PaymentContextZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_clone(const struct LDKCOption_PaymentContextZ *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_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u64u16Z from the contained elements. + */ +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); + +/** + * Frees any resources used by the C2Tuple_u64u16Z. + */ +void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); + +/** + * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z + */ +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); + +/** + * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing + */ +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state + */ +void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); + +/** + * Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelIdAPIErrorZ in the success state. + */ +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_ok(struct LDKChannelId o); + +/** + * Creates a new CResult_ChannelIdAPIErrorZ in the error state. + */ +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_err(struct LDKAPIError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelIdAPIErrorZ_is_ok(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelIdAPIErrorZ. + */ +void CResult_ChannelIdAPIErrorZ_free(struct LDKCResult_ChannelIdAPIErrorZ _res); + +/** + * Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_clone(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); + +/** + * Creates a new CResult_NonePaymentSendFailureZ in the success state. + */ +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); + +/** + * Creates a new CResult_NonePaymentSendFailureZ in the error state. + */ +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NonePaymentSendFailureZ. + */ +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); + +/** + * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NoneRetryableSendFailureZ in the success state. + */ +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); + +/** + * Creates a new CResult_NoneRetryableSendFailureZ in the error state. + */ +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneRetryableSendFailureZ. + */ +void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); + +/** + * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. + */ +void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. + */ +void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. + */ +void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b); + +/** + * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. + */ +void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. + */ +void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_StrZ containing a crate::c_types::Str + */ +struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); + +/** + * Constructs a new COption_StrZ containing nothing + */ +struct LDKCOption_StrZ COption_StrZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::Str, if we are in the Some state + */ +void COption_StrZ_free(struct LDKCOption_StrZ _res); + +/** + * Creates a new COption_StrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. + */ +void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext + */ +struct LDKCOption_OffersContextZ COption_OffersContextZ_some(struct LDKOffersContext o); + +/** + * Constructs a new COption_OffersContextZ containing nothing + */ +struct LDKCOption_OffersContextZ COption_OffersContextZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state + */ +void COption_OffersContextZ_free(struct LDKCOption_OffersContextZ _res); + +/** + * Creates a new COption_OffersContextZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_OffersContextZ COption_OffersContextZ_clone(const struct LDKCOption_OffersContextZ *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_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_clone(const struct LDKC2Tuple_OffersMessageResponseInstructionZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OffersMessageResponseInstructionZ from the contained elements. + */ +struct LDKC2Tuple_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_new(struct LDKOffersMessage a, struct LDKResponseInstruction b); + +/** + * Frees any resources used by the C2Tuple_OffersMessageResponseInstructionZ. + */ +void C2Tuple_OffersMessageResponseInstructionZ_free(struct LDKC2Tuple_OffersMessageResponseInstructionZ _res); + +/** + * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ + */ +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_some(struct LDKC2Tuple_OffersMessageResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_OffersMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_OffersMessageResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ *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_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OffersMessageMessageSendInstructionsZ from the contained elements. + */ +struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_new(struct LDKOffersMessage a, struct LDKMessageSendInstructions b); + +/** + * Frees any resources used by the C2Tuple_OffersMessageMessageSendInstructionsZ. + */ +void C2Tuple_OffersMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_clone(const struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ReleaseHeldHtlcResponseInstructionZ from the contained elements. + */ +struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_new(struct LDKReleaseHeldHtlc a, struct LDKResponseInstruction b); + +/** + * Frees any resources used by the C2Tuple_ReleaseHeldHtlcResponseInstructionZ. + */ +void C2Tuple_ReleaseHeldHtlcResponseInstructionZ_free(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ _res); + +/** + * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ + */ +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_some(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ *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_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ from the contained elements. + */ +struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_new(struct LDKAsyncPaymentsMessage a, struct LDKMessageSendInstructions b); + +/** + * Frees any resources used by the C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ. + */ +void C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ _res); + +/** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + */ +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); + +/** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + */ +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. + */ +void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); + +/** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ 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); + +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_ok(struct LDKBlindedForward o); + +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedForwardDecodeErrorZ_is_ok(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. + */ +void CResult_BlindedForwardDecodeErrorZ_free(struct LDKCResult_BlindedForwardDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_clone(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_ok(struct LDKPendingHTLCRouting o); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. + */ +void CResult_PendingHTLCRoutingDecodeErrorZ_free(struct LDKCResult_PendingHTLCRoutingDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_ok(struct LDKPendingHTLCInfo o); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PendingHTLCInfoDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. + */ +void CResult_PendingHTLCInfoDecodeErrorZ_free(struct LDKCResult_PendingHTLCInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_ok(enum LDKBlindedFailure o); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedFailureDecodeErrorZ_is_ok(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. + */ +void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. + */ +void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); + +/** + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. + */ +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o); + +/** + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. + */ +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. + */ +void CResult_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res); + +/** + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); + +/** + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. + */ +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelConfigDecodeErrorZ 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); + +/** + * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure + */ +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o); + +/** + * Constructs a new COption_MaxDustHTLCExposureZ containing nothing + */ +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state + */ +void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res); + +/** + * Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); + +/** + * Constructs a new COption_APIErrorZ containing nothing + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state + */ +void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); + +/** + * Creates a new COption_APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. + */ +void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); + +/** + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + */ +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ 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); + +/** + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + */ +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); + +/** + * Constructs a new COption_MonitorEventZ containing nothing + */ +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + */ +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); + +/** + * Creates a new COption_MonitorEventZ 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); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + */ +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); + +/** + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + */ +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + */ +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_HTLCUpdateDecodeErrorZ 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); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. + */ +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); + +/** + * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. + */ +void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. + */ +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); + +/** + * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. + */ +void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. + */ +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res); + +/** + * Creates a new CResult_NoneReplayEventZ in the success state. + */ +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_ok(void); + +/** + * Creates a new CResult_NoneReplayEventZ in the error state. + */ +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_err(struct LDKReplayEvent e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneReplayEventZ_is_ok(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneReplayEventZ. + */ +void CResult_NoneReplayEventZ_free(struct LDKCResult_NoneReplayEventZ _res); + +/** + * Creates a new CResult_NoneReplayEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_clone(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_u32TxOutZ from the contained elements. + */ +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); + +/** + * Frees any resources used by the C2Tuple_u32TxOutZ. + */ +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. + */ +void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. + */ +void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + */ +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); + +/** + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + */ +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_clone(const struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. + */ +struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_new(struct LDKOnionMessageContents a, struct LDKResponseInstruction b); + +/** + * Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. + */ +void C2Tuple_OnionMessageContentsResponseInstructionZ_free(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ _res); + +/** + * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ + */ +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents + */ +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); + +/** + * Constructs a new COption_OnionMessageContentsZ containing nothing + */ +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state + */ +void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); + +/** + * Creates a new COption_OnionMessageContentsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); + +/** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. + */ +void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. + */ +struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(struct LDKOnionMessageContents a, struct LDKMessageSendInstructions b); + +/** + * Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. + */ +void C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ _res); + +/** + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + */ +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); + +/** + * Constructs a new COption_TypeZ containing nothing + */ +struct LDKCOption_TypeZ COption_TypeZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + */ +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); + +/** + * Creates a new COption_TypeZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); + +/** + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + */ +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress + */ +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); + +/** + * Constructs a new COption_SocketAddressZ containing nothing + */ +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state + */ +void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); + +/** + * Creates a new COption_SocketAddressZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PeerDetailsZ_free(struct LDKCVec_PeerDetailsZ _res); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + */ +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + */ +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + */ +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ 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); + +/** + * Creates a new CResult_NonePeerHandleErrorZ in the success state. + */ +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); + +/** + * Creates a new CResult_NonePeerHandleErrorZ in the error state. + */ +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NonePeerHandleErrorZ. + */ +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); + +/** + * Creates a new CResult_NonePeerHandleErrorZ 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); + +/** + * Creates a new CResult_boolPeerHandleErrorZ in the success state. + */ +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); + +/** + * Creates a new CResult_boolPeerHandleErrorZ in the error state. + */ +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_boolPeerHandleErrorZ. + */ +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); + +/** + * Creates a new CResult_boolPeerHandleErrorZ 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); + +/** + * Creates a new CResult_u32GraphSyncErrorZ in the success state. + */ +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); + +/** + * Creates a new CResult_u32GraphSyncErrorZ in the error state. + */ +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_u32GraphSyncErrorZ. + */ +void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); + +/** + * Creates a new CResult_CVec_u8ZIOErrorZ in the success state. + */ +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. + */ +void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_StrZIOErrorZ in the success state. + */ +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o); + +/** + * Creates a new CResult_CVec_StrZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_StrZIOErrorZ. + */ +void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(struct LDKUnsignedInvoiceRequest o); + +/** + * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ. + */ +void CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_ok(struct LDKInvoiceRequest o); + +/** + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. + */ +void CResult_InvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithExplicitSigningPubkeyBuilder o); + +/** + * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. + */ +void CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. + */ +void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); + +/** + * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithDerivedSigningPubkeyBuilder o); + +/** + * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. + */ +void CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_ok(struct LDKInvoiceRequestFields o); + +/** + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. + */ +void CResult_InvoiceRequestFieldsDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res); + +/** + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res); + +/** + * Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature + */ +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_some(struct LDKECDSASignature o); + +/** + * Constructs a new COption_ECDSASignatureZ containing nothing + */ +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state + */ +void COption_ECDSASignatureZ_free(struct LDKCOption_ECDSASignatureZ _res); + +/** + * Creates a new COption_ECDSASignatureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_clone(const struct LDKCOption_ECDSASignatureZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_i64Z containing a i64 + */ +struct LDKCOption_i64Z COption_i64Z_some(int64_t o); + +/** + * Constructs a new COption_i64Z containing nothing + */ +struct LDKCOption_i64Z COption_i64Z_none(void); + +/** + * Frees any resources associated with the i64, if we are in the Some state + */ +void COption_i64Z_free(struct LDKCOption_i64Z _res); + +/** + * Creates a new COption_i64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); + +/** + * Creates a new CResult_SocketAddressDecodeErrorZ in the success state. + */ +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); + +/** + * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. + */ +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. + */ +void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); + +/** + * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); + +/** + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. + */ +void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); + +/** + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); + +/** + * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. + */ +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); + +/** + * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. + */ +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. + */ +void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); + +/** + * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. + */ +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o); + +/** + * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. + */ +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. + */ +void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res); + +/** + * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_StfuDecodeErrorZ in the success state. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_ok(struct LDKStfu o); + +/** + * Creates a new CResult_StfuDecodeErrorZ in the error state. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_StfuDecodeErrorZ_is_ok(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_StfuDecodeErrorZ. + */ +void CResult_StfuDecodeErrorZ_free(struct LDKCResult_StfuDecodeErrorZ _res); + +/** + * Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_clone(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceInitDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_ok(struct LDKSpliceInit o); + +/** + * Creates a new CResult_SpliceInitDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceInitDecodeErrorZ_is_ok(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceInitDecodeErrorZ. + */ +void CResult_SpliceInitDecodeErrorZ_free(struct LDKCResult_SpliceInitDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_clone(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_ok(struct LDKSpliceAck o); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceAckDecodeErrorZ_is_ok(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceAckDecodeErrorZ. + */ +void CResult_SpliceAckDecodeErrorZ_free(struct LDKCResult_SpliceAckDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_clone(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_ok(struct LDKSpliceLocked o); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpliceLockedDecodeErrorZ_is_ok(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. + */ +void CResult_SpliceLockedDecodeErrorZ_free(struct LDKCResult_SpliceLockedDecodeErrorZ _res); + +/** + * Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_clone(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxAddInputDecodeErrorZ in the success state. + */ +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o); + +/** + * Creates a new CResult_TxAddInputDecodeErrorZ in the error state. + */ +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxAddInputDecodeErrorZ. + */ +void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res); + +/** + * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. + */ +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o); + +/** + * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. + */ +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. + */ +void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res); + +/** + * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. + */ +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o); + +/** + * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. + */ +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. + */ +void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res); + +/** + * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. + */ +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o); + +/** + * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. + */ +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. + */ +void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res); + +/** + * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxCompleteDecodeErrorZ in the success state. + */ +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o); + +/** + * Creates a new CResult_TxCompleteDecodeErrorZ in the error state. + */ +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxCompleteDecodeErrorZ. + */ +void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res); + +/** + * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o); + +/** + * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. + */ +void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. + */ +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o); + +/** + * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. + */ +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. + */ +void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res); + +/** + * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. + */ +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o); + +/** + * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. + */ +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. + */ +void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res); + +/** + * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxAbortDecodeErrorZ in the success state. + */ +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o); + +/** + * Creates a new CResult_TxAbortDecodeErrorZ in the error state. + */ +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxAbortDecodeErrorZ. + */ +void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res); + +/** + * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); + +/** + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. + */ +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); + +/** + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. + */ +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. + */ +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); + +/** + * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. + */ +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. + */ +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); + +/** + * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. + */ +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); + +/** + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. + */ +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. + */ +void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); + +/** + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_ok(struct LDKCommitmentSignedBatch o); + +/** + * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentSignedBatchDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedBatchDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CommitmentSignedBatchDecodeErrorZ. + */ +void CResult_CommitmentSignedBatchDecodeErrorZ_free(struct LDKCResult_CommitmentSignedBatchDecodeErrorZ _res); + +/** + * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedBatchDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); + +/** + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. + */ +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); + +/** + * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. + */ +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); + +/** + * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. + */ +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. + */ +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); + +/** + * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. + */ +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); + +/** + * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. + */ +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. + */ +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); + +/** + * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); + +/** + * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. + */ +void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InitDecodeErrorZ in the success state. + */ +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); + +/** + * Creates a new CResult_InitDecodeErrorZ in the error state. + */ +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InitDecodeErrorZ. + */ +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); + +/** + * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. + */ +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); + +/** + * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. + */ +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. + */ +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); + +/** + * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. + */ +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o); + +/** + * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. + */ +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. + */ +void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res); + +/** + * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. + */ +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); + +/** + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. + */ +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + */ +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); + +/** + * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownDecodeErrorZ in the success state. + */ +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); + +/** + * Creates a new CResult_ShutdownDecodeErrorZ in the error state. + */ +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownDecodeErrorZ. + */ +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); + +/** + * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); + +/** + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. + */ +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); + +/** + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. + */ +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. + */ +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); + +/** + * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. + */ +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. + */ +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); + +/** + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. + */ +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OnionPacketDecodeErrorZ in the success state. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_ok(struct LDKOnionPacket o); + +/** + * Creates a new CResult_OnionPacketDecodeErrorZ in the error state. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionPacketDecodeErrorZ. + */ +void CResult_OnionPacketDecodeErrorZ_free(struct LDKCResult_OnionPacketDecodeErrorZ _res); + +/** + * Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_clone(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. + */ +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); + +/** + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. + */ +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. + */ +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); + +/** + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); + +/** + * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. + */ +void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_ok(struct LDKFinalOnionHopData o); + +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FinalOnionHopDataDecodeErrorZ_is_ok(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. + */ +void CResult_FinalOnionHopDataDecodeErrorZ_free(struct LDKCResult_FinalOnionHopDataDecodeErrorZ _res); + +/** + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_clone(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PingDecodeErrorZ in the success state. + */ +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); + +/** + * Creates a new CResult_PingDecodeErrorZ in the error state. + */ +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PingDecodeErrorZ. + */ +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); + +/** + * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PongDecodeErrorZ in the success state. + */ +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); + +/** + * Creates a new CResult_PongDecodeErrorZ in the error state. + */ +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PongDecodeErrorZ. + */ +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); + +/** + * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + */ +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + */ +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. + */ +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + */ +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. + */ +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. + */ +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. + */ +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); + +/** + * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. + */ +void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + */ +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. + */ +void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. + */ +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + */ +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + */ +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. + */ +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); + +/** + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. + */ +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + */ +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. + */ +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); + +/** + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + */ +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + */ +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. + */ +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); + +/** + * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + */ +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + */ +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. + */ +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); + +/** + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + */ +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + */ +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. + */ +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); + +/** + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_some(enum LDKInboundHTLCStateDetails o); + +/** + * Constructs a new COption_InboundHTLCStateDetailsZ containing nothing + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state + */ +void COption_InboundHTLCStateDetailsZ_free(struct LDKCOption_InboundHTLCStateDetailsZ _res); + +/** + * Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_clone(const struct LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_InboundHTLCStateDetailsZ o); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. + */ +void CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_ok(struct LDKInboundHTLCDetails o); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. + */ +void CResult_InboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_InboundHTLCDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_some(enum LDKOutboundHTLCStateDetails o); + +/** + * Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state + */ +void COption_OutboundHTLCStateDetailsZ_free(struct LDKCOption_OutboundHTLCStateDetailsZ _res); + +/** + * Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_clone(const struct LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_OutboundHTLCStateDetailsZ o); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. + */ +void CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_ok(struct LDKOutboundHTLCDetails o); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. + */ +void CResult_OutboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. + */ +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ 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); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + */ +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ 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); + +/** + * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); + +/** + * Constructs a new COption_ChannelShutdownStateZ containing nothing + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state + */ +void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); + +/** + * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_InboundHTLCDetailsZ_free(struct LDKCVec_InboundHTLCDetailsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_OutboundHTLCDetailsZ_free(struct LDKCVec_OutboundHTLCDetailsZ _res); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. + */ +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ 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); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. + */ +void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_FutureZ_free(struct LDKCVec_FutureZ _res); + +/** + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. + */ +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_ok(struct LDKHeldHtlcAvailable o); + +/** + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. + */ +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. + */ +void CResult_HeldHtlcAvailableDecodeErrorZ_free(struct LDKCResult_HeldHtlcAvailableDecodeErrorZ _res); + +/** + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_clone(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. + */ +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_ok(struct LDKReleaseHeldHtlc o); + +/** + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. + */ +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. + */ +void CResult_ReleaseHeldHtlcDecodeErrorZ_free(struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ _res); + +/** + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_clone(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_ok(struct LDKAsyncPaymentsMessage o); + +/** + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. + */ +void CResult_AsyncPaymentsMessageDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OffersMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o); + +/** + * Creates a new CResult_OffersMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OffersMessageDecodeErrorZ. + */ +void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *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_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); + +/** + * 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); + +/** + * 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); + +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. */ -void Witness_free(struct LDKWitness _res); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); /** - * Frees the witness and script_sig in a TxIn + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. */ -void TxIn_free(struct LDKTxIn _res); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); /** - * Convenience function for constructing a new TxIn + * Checks if the given object is currently in the success state */ -struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Convenience function for constructing a new TxOut + * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); /** - * Frees the data pointed to by script_pubkey. + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void TxOut_free(struct LDKTxOut _res); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. */ -void Str_free(struct LDKStr _res); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Checks if the given object is currently in the success state */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_u64Z containing a u64 + * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); /** - * Constructs a new COption_u64Z containing nothing + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u64Z COption_u64Z_none(void); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources associated with the u64, if we are in the Some state + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); /** - * Creates a new COption_u64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _res); +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); +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_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o); +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RefundBolt12ParseErrorZ. + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. */ -void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res); +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); /** - * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig` + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RetryDecodeErrorZ in the success state. + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); /** - * Creates a new CResult_RetryDecodeErrorZ in the error state. + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RetryDecodeErrorZ. + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. */ -void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); /** - * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. */ -bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); +void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_usizeZ containing a usize */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_usizeZ containing nothing */ -void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); +struct LDKCOption_usizeZ COption_usizeZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the usize, if we are in the Some state */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); +void COption_usizeZ_free(struct LDKCOption_usizeZ _res); /** - * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes + * Creates a new COption_usizeZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); +struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); /** - * Constructs a new COption_ThirtyTwoBytesZ containing nothing + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. */ -struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. */ -void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` + * 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 LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. */ -void CVec_u8Z_free(struct LDKCVec_u8Z _res); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); /** - * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. */ -struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); /** - * Constructs a new COption_CVec_u8ZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void); +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. */ -void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res); +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); /** - * Creates a new COption_CVec_u8ZZ which has the same data as `orig` + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ 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); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state. + * Creates a new CResult_FundingInfoDecodeErrorZ in the success state. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_ok(struct LDKFundingInfo o); + +/** + * Creates a new CResult_FundingInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_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); +bool CResult_FundingInfoDecodeErrorZ_is_ok(const struct LDKCResult_FundingInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ. + * Frees any resources used by the CResult_FundingInfoDecodeErrorZ. */ -void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res); +void CResult_FundingInfoDecodeErrorZ_free(struct LDKCResult_FundingInfoDecodeErrorZ _res); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingInfoDecodeErrorZ 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); +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_clone(const struct LDKCResult_FundingInfoDecodeErrorZ *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_PaymentPurposeDecodeErrorZ in the success state. */ -struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); /** - * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. */ -struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_u64CVec_u8ZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res); +bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. */ -void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res); +void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. */ -bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res); +bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); +void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ + * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o); +struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); /** - * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing + * Constructs a new COption_PathFailureZ containing nothing */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void); +struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); /** - * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state + * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state */ -void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res); +void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); /** - * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` + * Creates a new COption_PathFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_clone(const struct LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR orig); +struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. */ -struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. */ -struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o); +bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. + * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. */ -void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res); +void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. - */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_ClosureReasonZ containing nothing */ -bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); /** - * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state */ -void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res); +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); /** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` + * Creates a new COption_ClosureReasonZ 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); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_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_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. */ -void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * 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_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. - */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. + * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCDestinationZ containing nothing */ -bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); /** - * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state */ -void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); +void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * Creates a new COption_HTLCDestinationZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_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_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. */ -void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); +void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` + * 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_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason */ -void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o); /** - * Constructs a new COption_u32Z containing a u32 + * Constructs a new COption_PaymentFailureReasonZ containing nothing */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void); /** - * Constructs a new COption_u32Z containing nothing + * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state */ -struct LDKCOption_u32Z COption_u32Z_none(void); +void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res); /** - * Frees any resources associated with the u32, if we are in the Some state + * Creates a new COption_PaymentFailureReasonZ 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 LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig); /** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(struct LDKCOption_PaymentFailureReasonZ o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. */ -struct LDKC2Tuple_CVec_u8ZusizeZ C2Tuple_CVec_u8ZusizeZ_clone(const struct LDKC2Tuple_CVec_u8ZusizeZ *NONNULL_PTR orig); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C2Tuple_CVec_u8ZusizeZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_CVec_u8ZusizeZ C2Tuple_CVec_u8ZusizeZ_new(struct LDKCVec_u8Z a, uintptr_t b); +bool CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_CVec_u8ZusizeZ. + * Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. */ -void C2Tuple_CVec_u8ZusizeZ_free(struct LDKC2Tuple_CVec_u8ZusizeZ _res); +void CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the success state. + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_ok(struct LDKC2Tuple_CVec_u8ZusizeZ o); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ in the error state. + * Constructs a new COption_U128Z containing a crate::c_types::U128 */ -struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_err(void); +struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_U128Z containing nothing */ -bool CResult_C2Tuple_CVec_u8ZusizeZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR o); +struct LDKCOption_U128Z COption_U128Z_none(void); /** - * Frees any resources used by the CResult_C2Tuple_CVec_u8ZusizeZNoneZ. + * Frees any resources associated with the crate::c_types::U128, if we are in the Some state */ -void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ _res); +void COption_U128Z_free(struct LDKCOption_U128Z _res); /** - * Creates a new CResult_C2Tuple_CVec_u8ZusizeZNoneZ which has the same data as `orig` + * Creates a new COption_U128Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR orig); +struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); +void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. + * Constructs a new COption_EventZ containing a crate::lightning::events::Event */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_EventZ containing nothing */ -bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state */ -void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` + * Creates a new COption_EventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. */ -void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneNoneZ in the success state. + * Creates a new CResult_NonceDecodeErrorZ in the success state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_ok(struct LDKNonce o); /** - * Creates a new CResult_NoneNoneZ in the error state. + * Creates a new CResult_NonceDecodeErrorZ in the error state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); +bool CResult_NonceDecodeErrorZ_is_ok(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneNoneZ. + * Frees any resources used by the CResult_NonceDecodeErrorZ. */ -void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); +void CResult_NonceDecodeErrorZ_free(struct LDKCResult_NonceDecodeErrorZ _res); /** - * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * Creates a new CResult_NonceDecodeErrorZ 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_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_clone(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res); +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. */ -struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o); /** - * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. + * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. */ -struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); /** - * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); +bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. + * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); +void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. + * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. + */ +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o); + +/** + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. + */ +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); +bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. + * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. */ -void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); +void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ECDSASignatureNoneZ in the success state. + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. */ -struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o); /** - * Creates a new CResult_ECDSASignatureNoneZ in the error state. + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. */ -struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); +bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ECDSASignatureNoneZ. + * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. */ -void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); +void CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res); /** - * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PublicKeyNoneZ in the success state. - */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyNoneZ 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_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); +struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. */ -bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); +struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c); /** - * Frees any resources used by the CResult_PublicKeyNoneZ. + * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. */ -void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); +void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _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_PayeePubKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); /** - * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** - * Constructs a new COption_BigEndianScalarZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void); +bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *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_PayeePubKeySecp256k1ErrorZ. */ -void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); +void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); /** - * Creates a new COption_BigEndianScalarZ which has the same data as `orig` + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_U5Z_free(struct LDKCVec_U5Z _res); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError 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_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` + * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SchnorrSignatureNoneZ in the success state. + * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void); /** - * Creates a new CResult_SchnorrSignatureNoneZ in the error state. + * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); +bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SchnorrSignatureNoneZ. + * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. */ -void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); +void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res); /** - * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` + * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. */ -struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(struct LDKWriteableEcdsaChannelSigner o); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o); /** - * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the error state. + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. */ -struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_WriteableEcdsaChannelSignerDecodeErrorZ. + * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. */ -void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res); +void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res); /** - * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZNoneZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_CVec_u8ZNoneZ in the error state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZNoneZ. + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Creates a new CResult_CVec_u8ZNoneZ 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_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptNoneZ in the success state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Creates a new CResult_ShutdownScriptNoneZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o); +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptNoneZ. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); /** - * Creates a new CResult_ShutdownScriptNoneZ 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_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing a u16 + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Constructs a new COption_u16Z containing nothing + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -struct LDKCOption_u16Z COption_u16Z_none(void); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the u16, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_u16Z which has the same data as `orig` + * Frees any resources used by the CResult_OutPointDecodeErrorZ. + */ +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); + +/** + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_boolZ containing a bool + * Creates a new CResult_BigSizeDecodeErrorZ in the success state. */ -struct LDKCOption_boolZ COption_boolZ_some(bool o); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o); /** - * Constructs a new COption_boolZ containing nothing + * Creates a new CResult_BigSizeDecodeErrorZ in the error state. */ -struct LDKCOption_boolZ COption_boolZ_none(void); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the bool, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_boolZ_free(struct LDKCOption_boolZ _res); +bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_boolZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_BigSizeDecodeErrorZ. */ -struct LDKCOption_boolZ COption_boolZ_clone(const struct LDKCOption_boolZ *NONNULL_PTR orig); +void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); +bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. + * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. */ -void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); +void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res); /** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ 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_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + * Creates a new CResult_HostnameDecodeErrorZ in the success state. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. + * Creates a new CResult_HostnameDecodeErrorZ in the error state. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); +bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + * Frees any resources used by the CResult_HostnameDecodeErrorZ. */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); +void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TransactionNoneZ in the success state. + * Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); +struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_ok(struct LDKTransactionU16LenLimited o); /** - * Creates a new CResult_TransactionNoneZ in the error state. + * Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); +bool CResult_TransactionU16LenLimitedNoneZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TransactionNoneZ. + * Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ. */ -void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); +void CResult_TransactionU16LenLimitedNoneZ_free(struct LDKCResult_TransactionU16LenLimitedNoneZ _res); /** - * Creates a new CResult_TransactionNoneZ which has the same data as `orig` + * Creates a new CResult_TransactionU16LenLimitedNoneZ 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); - -/** - * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore - */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_clone(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_WriteableScoreZ containing nothing + * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state. */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); +struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_ok(struct LDKTransactionU16LenLimited o); /** - * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. */ -void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); +struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_NoneIOErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); +bool CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneIOErrorZ in the error state. + * Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e); +void CResult_TransactionU16LenLimitedDecodeErrorZ_free(struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); +struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_clone(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NoneIOErrorZ. + * Creates a new CResult_ChannelIdDecodeErrorZ in the success state. */ -void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_ok(struct LDKChannelId o); /** - * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelIdDecodeErrorZ in the error state. */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_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_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +bool CResult_ChannelIdDecodeErrorZ_is_ok(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Frees any resources used by the CResult_ChannelIdDecodeErrorZ. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +void CResult_ChannelIdDecodeErrorZ_free(struct LDKCResult_ChannelIdDecodeErrorZ _res); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_clone(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR orig); /** - * 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_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); +struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_clone(const struct LDKC2Tuple__u832u16Z *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Creates a new C2Tuple__u832u16Z from the contained elements. */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_new(struct LDKThirtyTwoBytes a, uint16_t b); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple__u832u16Z. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +void C2Tuple__u832u16Z_free(struct LDKC2Tuple__u832u16Z _res); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. */ -void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); +void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedPayInfoDecodeErrorZ 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_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + * Creates a new CResult_BlindedPaymentPathNoneZ in the success state. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_ok(struct LDKBlindedPaymentPath o); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + * Creates a new CResult_BlindedPaymentPathNoneZ in the error state. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedPaymentPathNoneZ_is_ok(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + * Frees any resources used by the CResult_BlindedPaymentPathNoneZ. */ -void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +void CResult_BlindedPaymentPathNoneZ_free(struct LDKCResult_BlindedPaymentPathNoneZ _res); /** - * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedPaymentPathNoneZ 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); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_clone(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res); +void CVec_PaymentForwardNodeZ_free(struct LDKCVec_PaymentForwardNodeZ _res); /** - * Creates a new CResult_BlindedTailDecodeErrorZ in the success state. + * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. */ -struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); /** - * Creates a new CResult_BlindedTailDecodeErrorZ in the error state. + * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. */ -struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_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); +bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedTailDecodeErrorZ. + * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. */ -void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res); +void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); /** - * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentRelayDecodeErrorZ 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); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. */ -void CVec_PathZ_free(struct LDKCVec_PathZ _res); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RouteDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteDecodeErrorZ in the error state. + * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteDecodeErrorZ. + * Creates a new CResult_PaymentContextDecodeErrorZ in the success state. */ -void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_ok(struct LDKPaymentContext o); /** - * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PaymentContextDecodeErrorZ in the error state. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); +bool CResult_PaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + * Frees any resources used by the CResult_PaymentContextDecodeErrorZ. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_PaymentContextDecodeErrorZ_free(struct LDKCResult_PaymentContextDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_clone(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state. */ -void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); +struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_ok(struct LDKUnknownPaymentContext o); /** - * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_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_u64Z_free(struct LDKCVec_u64Z _res); +bool CResult_UnknownPaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + * Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); +void CResult_UnknownPaymentContextDecodeErrorZ_free(struct LDKCResult_UnknownPaymentContextDecodeErrorZ _res); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + * Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_clone(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. */ -bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_ok(struct LDKBolt12OfferContext o); /** - * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state. */ -void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ 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_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); +bool CResult_Bolt12OfferContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new tuple which has the same data as `orig` + * Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ. + */ +void CResult_Bolt12OfferContextDecodeErrorZ_free(struct LDKCResult_Bolt12OfferContextDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ 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); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements. + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state. */ -struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_ok(struct LDKBolt12RefundContext o); /** - * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ. + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state. */ -void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res); +bool CResult_Bolt12RefundContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ. */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +void CResult_Bolt12RefundContextDecodeErrorZ_free(struct LDKCResult_Bolt12RefundContextDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); +bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. */ -void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); +void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); /** - * Creates a new CResult_RouteHintDecodeErrorZ 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_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + * Creates a new CResult_ResponderDecodeErrorZ in the success state. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); +struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_ok(struct LDKResponder o); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + * Creates a new CResult_ResponderDecodeErrorZ in the error state. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_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); +bool CResult_ResponderDecodeErrorZ_is_ok(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + * Frees any resources used by the CResult_ResponderDecodeErrorZ. */ -void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); +void CResult_ResponderDecodeErrorZ_free(struct LDKCResult_ResponderDecodeErrorZ _res); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ResponderDecodeErrorZ 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 LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_clone(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); +struct LDKCOption_MessageContextZ COption_MessageContextZ_some(struct LDKMessageContext o); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + * Constructs a new COption_MessageContextZ containing nothing */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); +struct LDKCOption_MessageContextZ COption_MessageContextZ_none(void); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + * Frees any resources associated with the crate::lightning::blinded_path::message::MessageContext, if we are in the Some state */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); +void COption_MessageContextZ_free(struct LDKCOption_MessageContextZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new COption_MessageContextZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_MessageContextZ COption_MessageContextZ_clone(const struct LDKCOption_MessageContextZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); +struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(const struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR orig); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); +struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(struct LDKPublicKey a, struct LDKOnionMessage b, struct LDKCOption_CVec_SocketAddressZZ c); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ. */ -void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); +void C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state. */ -struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o); /** - * Creates a new C2Tuple_u64u64Z from the contained elements. + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state. */ -struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(struct LDKSendError e); /** - * Frees any resources used by the C2Tuple_u64u64Z. + * Checks if the given object is currently in the success state */ -void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); +bool CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + * Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); +void CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + * Creates a new CResult_PeeledOnionNoneZ in the success state. */ -void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); /** - * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PeeledOnionNoneZ in the error state. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); /** - * Creates a new C2Tuple_Z from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); +bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_Z. + * Frees any resources used by the CResult_PeeledOnionNoneZ. */ -void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); +void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); /** - * Creates a new C2Tuple__u1632_u1632Z from the contained elements. + * Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_clone(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple__u1632_u1632Z. + * Creates a new CResult_SendSuccessSendErrorZ in the success state. */ -void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_ok(struct LDKSendSuccess o); /** - * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z + * Creates a new CResult_SendSuccessSendErrorZ in the error state. */ -struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_err(struct LDKSendError e); /** - * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); +bool CResult_SendSuccessSendErrorZ_is_ok(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state + * Frees any resources used by the CResult_SendSuccessSendErrorZ. */ -void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); +void CResult_SendSuccessSendErrorZ_free(struct LDKCResult_SendSuccessSendErrorZ _res); /** - * Constructs a new COption_f64Z containing a f64 + * Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_f64Z COption_f64Z_some(double o); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_clone(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_f64Z containing nothing + * Creates a new CResult_NoneSendErrorZ in the success state. */ -struct LDKCOption_f64Z COption_f64Z_none(void); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); /** - * Frees any resources associated with the f64, if we are in the Some state + * Creates a new CResult_NoneSendErrorZ in the error state. */ -void COption_f64Z_free(struct LDKCOption_f64Z _res); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); /** - * Creates a new COption_f64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + * Frees any resources used by the CResult_NoneSendErrorZ. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + * Creates a new CResult_NoneSendErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_clone(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. */ -bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); /** - * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. */ -void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_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_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); +bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_usizeTransactionZ from the contained elements. + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_usizeTransactionZ. + * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. */ -struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); /** - * Creates a new C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ from the contained elements. + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. */ -struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, struct LDKCOption_ThirtyTwoBytesZ b); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZ _res); +bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. */ -void CVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ _res); +void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. + * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o); + +/** + * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state. + */ +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); +bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. + * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ. */ -void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); +void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` + * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state. */ -void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_ok(struct LDKTrackedSpendableOutput o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state. */ -struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c); +bool CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ. + * Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ. */ -void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res); +void CResult_TrackedSpendableOutputDecodeErrorZ_free(struct LDKCResult_TrackedSpendableOutputDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_clone(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_ok(struct LDKOutputSpendStatus o); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_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_OutputSpendStatusDecodeErrorZ_is_ok(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ. */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +void CResult_OutputSpendStatusDecodeErrorZ_free(struct LDKCResult_OutputSpendStatusDecodeErrorZ _res); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OutputSpendStatusDecodeErrorZ 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); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_clone(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError 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_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_FilterZ COption_FilterZ_none(void); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +void COption_FilterZ_free(struct LDKCOption_FilterZ _res); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ 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_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); +void CVec_TrackedSpendableOutputZ_free(struct LDKCVec_TrackedSpendableOutputZ _res); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_OutputSweeperDecodeErrorZ in the success state. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); +struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_ok(struct LDKOutputSweeper o); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_OutputSweeperDecodeErrorZ in the error state. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_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); +bool CResult_OutputSweeperDecodeErrorZ_is_ok(const struct LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_OutputSweeperDecodeErrorZ. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +void CResult_OutputSweeperDecodeErrorZ_free(struct LDKCResult_OutputSweeperDecodeErrorZ _res); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_BestBlockOutputSweeperZ C2Tuple_BestBlockOutputSweeperZ_new(struct LDKBestBlock a, struct LDKOutputSweeper b); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ. */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); +void C2Tuple_BestBlockOutputSweeperZ_free(struct LDKC2Tuple_BestBlockOutputSweeperZ _res); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state. */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(struct LDKC2Tuple_BestBlockOutputSweeperZ o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state. */ -bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); +bool CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ. */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +void CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state. */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_ok(struct LDKDelayedPaymentBasepoint o); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state. */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ. */ -void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); +void CResult_DelayedPaymentBasepointDecodeErrorZ_free(struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state. */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_ok(struct LDKDelayedPaymentKey o); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state. */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ. */ -void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); +void CResult_DelayedPaymentKeyDecodeErrorZ_free(struct LDKCResult_DelayedPaymentKeyDecodeErrorZ _res); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ 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); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_ok(struct LDKHtlcBasepoint o); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_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_HtlcBasepointDecodeErrorZ_is_ok(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ. */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +void CResult_HtlcBasepointDecodeErrorZ_free(struct LDKCResult_HtlcBasepointDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HtlcBasepointDecodeErrorZ 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_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_clone(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. + * Creates a new CResult_HtlcKeyDecodeErrorZ in the success state. */ -struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_ok(struct LDKHtlcKey o); /** - * Creates a new CResult_OfferBolt12ParseErrorZ in the error state. + * Creates a new CResult_HtlcKeyDecodeErrorZ in the error state. */ -struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o); +bool CResult_HtlcKeyDecodeErrorZ_is_ok(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OfferBolt12ParseErrorZ. + * Frees any resources used by the CResult_HtlcKeyDecodeErrorZ. */ -void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res); +void CResult_HtlcKeyDecodeErrorZ_free(struct LDKCResult_HtlcKeyDecodeErrorZ _res); /** - * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` + * Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_clone(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_ok(struct LDKRevocationBasepoint o); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); +bool CResult_RevocationBasepointDecodeErrorZ_is_ok(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. + * Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ. */ -void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); +void CResult_RevocationBasepointDecodeErrorZ_free(struct LDKCResult_RevocationBasepointDecodeErrorZ _res); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` + * Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_clone(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the success state. + * Creates a new CResult_RevocationKeyDecodeErrorZ in the success state. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_ok(struct LDKRevocationKey o); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the error state. + * Creates a new CResult_RevocationKeyDecodeErrorZ in the error state. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_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); +bool CResult_RevocationKeyDecodeErrorZ_is_ok(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeIdDecodeErrorZ. + * Frees any resources used by the CResult_RevocationKeyDecodeErrorZ. */ -void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); +void CResult_RevocationKeyDecodeErrorZ_free(struct LDKCResult_RevocationKeyDecodeErrorZ _res); /** - * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_clone(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); /** - * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); /** - * Creates a new COption_NetworkUpdateZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); +void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); +struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_clone(const struct LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + * Creates a new C2Tuple_OutPointChannelIdZ from the contained elements. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_new(struct LDKOutPoint a, struct LDKChannelId b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_OutPointChannelIdZ. */ -bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_OutPointChannelIdZ_free(struct LDKC2Tuple_OutPointChannelIdZ _res); /** - * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); +void CVec_C2Tuple_OutPointChannelIdZZ_free(struct LDKCVec_C2Tuple_OutPointChannelIdZZ _res); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ 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_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointCVec_u64ZZ C2Tuple_OutPointCVec_u64ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u64ZZ *NONNULL_PTR orig); /** - * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup + * Creates a new C2Tuple_OutPointCVec_u64ZZ from the contained elements. */ -struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); +struct LDKC2Tuple_OutPointCVec_u64ZZ C2Tuple_OutPointCVec_u64ZZ_new(struct LDKOutPoint a, struct LDKCVec_u64Z b); /** - * Constructs a new COption_UtxoLookupZ containing nothing + * Frees any resources used by the C2Tuple_OutPointCVec_u64ZZ. */ -struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); +void C2Tuple_OutPointCVec_u64ZZ_free(struct LDKC2Tuple_OutPointCVec_u64ZZ _res); /** - * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); +void CVec_C2Tuple_OutPointCVec_u64ZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ _res); /** - * Creates a new CResult_NoneLightningErrorZ in the success state. + * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the success state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_ok(struct LDKBlindedMessagePath o); /** - * Creates a new CResult_NoneLightningErrorZ in the error state. + * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the error state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_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_BlindedMessagePathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneLightningErrorZ. + * Frees any resources used by the CResult_BlindedMessagePathDecodeErrorZ. */ -void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); +void CResult_BlindedMessagePathDecodeErrorZ_free(struct LDKCResult_BlindedMessagePathDecodeErrorZ _res); /** - * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedMessagePathDecodeErrorZ 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); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_clone(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolLightningErrorZ in the success state. + * Creates a new CResult_BlindedMessagePathNoneZ in the success state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); +struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_ok(struct LDKBlindedMessagePath o); /** - * Creates a new CResult_boolLightningErrorZ in the error state. + * Creates a new CResult_BlindedMessagePathNoneZ in the error state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_boolLightningErrorZ. - */ -void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); +bool CResult_BlindedMessagePathNoneZ_is_ok(const struct LDKCResult_BlindedMessagePathNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_BlindedMessagePathNoneZ. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); +void CResult_BlindedMessagePathNoneZ_free(struct LDKCResult_BlindedMessagePathNoneZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_BlindedMessagePathNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); - -/** - * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. - */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_clone(const struct LDKCResult_BlindedMessagePathNoneZ *NONNULL_PTR orig); /** - * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + * Creates a new CResult_MessageContextDecodeErrorZ in the success state. */ -void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_ok(struct LDKMessageContext o); /** - * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + * Creates a new CResult_MessageContextDecodeErrorZ in the error state. */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_err(struct LDKDecodeError 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_MessageContextDecodeErrorZ_is_ok(const struct LDKCResult_MessageContextDecodeErrorZ *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_MessageContextDecodeErrorZ. */ -void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); +void CResult_MessageContextDecodeErrorZ_free(struct LDKCResult_MessageContextDecodeErrorZ _res); /** - * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` + * Creates a new CResult_MessageContextDecodeErrorZ 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); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_clone(const struct LDKCResult_MessageContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. + * Creates a new CResult_OffersContextDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); +struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_ok(struct LDKOffersContext o); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + * Creates a new CResult_OffersContextDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_OffersContextDecodeErrorZ_is_ok(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. + * Frees any resources used by the CResult_OffersContextDecodeErrorZ. */ -void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); +void CResult_OffersContextDecodeErrorZ_free(struct LDKCResult_OffersContextDecodeErrorZ _res); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OffersContextDecodeErrorZ 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 LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_clone(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + * Frees any resources used by the APIError */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); +void APIError_free(struct LDKAPIError this_ptr); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + * Creates a copy of the APIError */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new APIMisuseError-variant APIError */ -bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); /** - * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + * Utility method to constructs a new FeeRateTooHigh-variant APIError */ -void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new InvalidRoute-variant APIError */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKAPIError APIError_invalid_route(struct LDKStr err); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. + * Utility method to constructs a new ChannelUnavailable-variant APIError */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); +struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + * Utility method to constructs a new MonitorUpdateInProgress-variant APIError */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKAPIError APIError_monitor_update_in_progress(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new IncompatibleShutdownScript-variant APIError */ -bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); +struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); /** - * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + * Checks if two APIErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); +bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the APIError object into a byte array which can be read by APIError_read */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Read a APIError from a byte array, created by APIError_write */ -void CVec_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); +struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. + * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ in the error state. + * Constructs a new BigSize given each field */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); /** - * Checks if the given object is currently in the success state + * Creates a copy of the BigSize */ -bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + * Generates a non-cryptographic 64-bit hash of the BigSize. */ -void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); +uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two BigSizes 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_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); +bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. + * Serialize the BigSize object into a byte array which can be read by BigSize_read */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); +struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. + * Read a BigSize from a byte array, created by BigSize_write */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read */ -bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. + * Read a UntrustedString from a byte array, created by UntrustedString_write */ -void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); +struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); /** - * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); +void Hostname_free(struct LDKHostname this_obj); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + * Creates a copy of the Hostname */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); +struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the Hostname. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t Hostname_hash(const struct LDKHostname *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); +bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); /** - * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + * Returns the length of the hostname. */ -void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); +MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); /** - * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get the string representation of a Hostname object */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKStr Hostname_to_str(const struct LDKHostname *NONNULL_PTR o); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + * Serialize the Hostname object into a byte array which can be read by Hostname_read */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); +struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + * Read a Hostname from a byte array, created by Hostname_write */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL. */ -bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); +void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj); /** - * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. + * Creates a copy of the TransactionU16LenLimited */ -void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ + * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited. */ -struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); +uint64_t TransactionU16LenLimited_hash(const struct LDKTransactionU16LenLimited *NONNULL_PTR o); /** - * Constructs a new COption_CVec_SocketAddressZZ containing nothing + * Checks if two TransactionU16LenLimiteds 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_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); +bool TransactionU16LenLimited_eq(const struct LDKTransactionU16LenLimited *NONNULL_PTR a, const struct LDKTransactionU16LenLimited *NONNULL_PTR b); /** - * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state + * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus- + * serialized length is <= u16::MAX. */ -void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); +MUST_USE_RES struct LDKCResult_TransactionU16LenLimitedNoneZ TransactionU16LenLimited_new(struct LDKTransaction transaction); /** - * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. */ -struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_into_transaction(struct LDKTransactionU16LenLimited this_arg); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Returns a reference to the contained `Transaction` */ -void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res); +MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_as_transaction(const struct LDKTransactionU16LenLimited *NONNULL_PTR this_arg); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read */ -void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res); +struct LDKCVec_u8Z TransactionU16LenLimited_write(const struct LDKTransactionU16LenLimited *NONNULL_PTR obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write */ -void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res); +struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_read(struct LDKu8slice ser); /** - * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut + * 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 LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o); +struct LDKStr sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); /** - * Constructs a new COption_TxOutZ containing nothing + * Recovers the PublicKey of the signer of the message given the message and the signature. */ -struct LDKCOption_TxOutZ COption_TxOutZ_none(void); +struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); /** - * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state + * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, + * and the PublicKey. */ -void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res); +bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); /** - * Creates a new COption_TxOutZ 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 LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig); +void KVStore_free(struct LDKKVStore this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Calls the free function if one is set */ -void CVec_InputZ_free(struct LDKCVec_InputZ _res); +void Persister_free(struct LDKPersister this_ptr); /** - * Creates a new CResult_CoinSelectionNoneZ in the success state. + * Read previously persisted [`ChannelMonitor`]s from the store. */ -struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); /** - * Creates a new CResult_CoinSelectionNoneZ in the error state. + * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void); +void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); /** - * Checks if the given object is currently in the success state + * Constructs a new [`MonitorUpdatingPersister`]. + * + * The `maximum_pending_updates` parameter controls how many updates may be stored before a + * [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that + * consolidation will frequently occur with fewer updates than what you set here; this number + * is merely the maximum that may be stored. When setting this value, consider that for higher + * values of `maximum_pending_updates`: + * + * - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than + * [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every + * `maximum_pending_updates` [`ChannelMonitorUpdate`]s. + * - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in + * \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger, + * less frequent \"waves.\" + * - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run + * [`MonitorUpdatingPersister::cleanup_stale_updates`]. */ -bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o); +MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStore kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator); /** - * Frees any resources used by the CResult_CoinSelectionNoneZ. + * Reads all stored channel monitors, along with any stored updates for them. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. */ -void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); /** - * Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a single channel monitor, along with any stored updates for it. + * + * It is extremely important that your [`KVStore::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + * + * For `monitor_key`, channel storage keys be the channel's transaction ID and index, or + * [`OutPoint`], with an underscore `_` between them. For example, given: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * The correct `monitor_key` would be: + * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * Loading a large number of monitors will be faster if done in parallel. You can use this + * function to accomplish this. Take care to limit the number of parallel readers. */ -struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, struct LDKStr monitor_key); /** - * Creates a new CResult_CVec_UtxoZNoneZ in the success state. + * Cleans up stale updates for all monitors. + * + * This function works by first listing all monitors, and then for each of them, listing all + * updates. The updates that have an `update_id` less than or equal to than the stored monitor + * are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will + * be passed to [`KVStore::remove`]. */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); /** - * Creates a new CResult_CVec_UtxoZNoneZ in the error state. + * Constructs a new Persist which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void); +struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Creates a copy of the ShortChannelIdError */ -bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o); +enum LDKShortChannelIdError ShortChannelIdError_clone(const enum LDKShortChannelIdError *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_CVec_UtxoZNoneZ. + * Utility method to constructs a new BlockOverflow-variant ShortChannelIdError */ -void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); +enum LDKShortChannelIdError ShortChannelIdError_block_overflow(void); /** - * Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new TxIndexOverflow-variant ShortChannelIdError */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); +enum LDKShortChannelIdError ShortChannelIdError_tx_index_overflow(void); /** - * 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 VoutIndexOverflow-variant ShortChannelIdError */ -struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); +enum LDKShortChannelIdError ShortChannelIdError_vout_index_overflow(void); /** - * Creates a new C2Tuple_u64u16Z from the contained elements. + * Checks if two ShortChannelIdErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); +bool ShortChannelIdError_eq(const enum LDKShortChannelIdError *NONNULL_PTR a, const enum LDKShortChannelIdError *NONNULL_PTR b); /** - * Frees any resources used by the C2Tuple_u64u16Z. + * Extracts the block height (most significant 3-bytes) from the `short_channel_id` */ -void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); +uint32_t block_from_scid(uint64_t short_channel_id); /** - * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z + * Extracts the tx index (bytes [2..4]) from the `short_channel_id` */ -struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); +uint32_t tx_index_from_scid(uint64_t short_channel_id); /** - * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing + * Extracts the vout (bytes [0..2]) from the `short_channel_id` */ -struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); +uint16_t vout_from_scid(uint64_t short_channel_id); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state + * Constructs a `short_channel_id` using the components pieces. Results in an error + * if the block height, tx index, or vout index overflow the maximum sizes. */ -void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); +struct LDKCResult_u64ShortChannelIdErrorZ scid_from_parts(uint64_t block, uint64_t tx_index, uint64_t vout_index); /** - * Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the TrackedSpendableOutput, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); +void TrackedSpendableOutput_free(struct LDKTrackedSpendableOutput this_obj); /** - * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channelmanager::ChannelShutdownState + * The tracked output descriptor. */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); +struct LDKSpendableOutputDescriptor TrackedSpendableOutput_get_descriptor(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Constructs a new COption_ChannelShutdownStateZ containing nothing + * The tracked output descriptor. */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); +void TrackedSpendableOutput_set_descriptor(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKSpendableOutputDescriptor val); /** - * Frees any resources associated with the crate::lightning::ln::channelmanager::ChannelShutdownState, if we are in the Some state + * The channel this output belongs to. + * + * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); +struct LDKChannelId TrackedSpendableOutput_get_channel_id(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The channel this output belongs to. + * + * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); +void TrackedSpendableOutput_set_channel_id(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. + * The current status of the output spend. */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKOutputSpendStatus TrackedSpendableOutput_get_status(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. + * The current status of the output spend. */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); +void TrackedSpendableOutput_set_status(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKOutputSpendStatus val); /** - * Checks if the given object is currently in the success state + * Constructs a new TrackedSpendableOutput given each field + * + * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKTrackedSpendableOutput TrackedSpendableOutput_new(struct LDKSpendableOutputDescriptor descriptor_arg, struct LDKChannelId channel_id_arg, struct LDKOutputSpendStatus status_arg); /** - * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. + * Creates a copy of the TrackedSpendableOutput */ -void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); +struct LDKTrackedSpendableOutput TrackedSpendableOutput_clone(const struct LDKTrackedSpendableOutput *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two TrackedSpendableOutputs 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_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); +bool TrackedSpendableOutput_eq(const struct LDKTrackedSpendableOutput *NONNULL_PTR a, const struct LDKTrackedSpendableOutput *NONNULL_PTR b); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Returns whether the output is spent in the given transaction. */ -void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); +MUST_USE_RES bool TrackedSpendableOutput_is_spent_in(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_arg, struct LDKTransaction tx); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Serialize the TrackedSpendableOutput object into a byte array which can be read by TrackedSpendableOutput_read */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCVec_u8Z TrackedSpendableOutput_write(const struct LDKTrackedSpendableOutput *NONNULL_PTR obj); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Read a TrackedSpendableOutput from a byte array, created by TrackedSpendableOutput_write */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ TrackedSpendableOutput_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the OutputSpendStatus */ -bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); +void OutputSpendStatus_free(struct LDKOutputSpendStatus this_ptr); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Creates a copy of the OutputSpendStatus */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +struct LDKOutputSpendStatus OutputSpendStatus_clone(const struct LDKOutputSpendStatus *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new PendingInitialBroadcast-variant OutputSpendStatus */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +struct LDKOutputSpendStatus OutputSpendStatus_pending_initial_broadcast(struct LDKCOption_u32Z delayed_until_height); /** - * Creates a new CResult_NoneRetryableSendFailureZ in the success state. + * Utility method to constructs a new PendingFirstConfirmation-variant OutputSpendStatus */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); +struct LDKOutputSpendStatus OutputSpendStatus_pending_first_confirmation(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx); /** - * Creates a new CResult_NoneRetryableSendFailureZ in the error state. + * Utility method to constructs a new PendingThresholdConfirmations-variant OutputSpendStatus */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKOutputSpendStatus OutputSpendStatus_pending_threshold_confirmations(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx, uint32_t confirmation_height, struct LDKThirtyTwoBytes confirmation_hash); /** - * Checks if the given object is currently in the success state + * Checks if two OutputSpendStatuss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); +bool OutputSpendStatus_eq(const struct LDKOutputSpendStatus *NONNULL_PTR a, const struct LDKOutputSpendStatus *NONNULL_PTR b); /** - * Frees any resources used by the CResult_NoneRetryableSendFailureZ. + * Serialize the OutputSpendStatus object into a byte array which can be read by OutputSpendStatus_read */ -void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); +struct LDKCVec_u8Z OutputSpendStatus_write(const struct LDKOutputSpendStatus *NONNULL_PTR obj); /** - * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a OutputSpendStatus from a byte array, created by OutputSpendStatus_write */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_OutputSpendStatusDecodeErrorZ OutputSpendStatus_read(struct LDKu8slice ser); /** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. + * Frees any resources used by the OutputSweeper, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +void OutputSweeper_free(struct LDKOutputSweeper this_obj); /** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. + * Constructs a new [`OutputSweeper`]. + * + * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users also + * need to register their [`Filter`] implementation via the given `chain_data_source`. */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +MUST_USE_RES struct LDKOutputSweeper OutputSweeper_new(struct LDKBestBlock best_block, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKCOption_FilterZ chain_data_source, struct LDKOutputSpender output_spender, struct LDKChangeDestinationSource change_destination_source, struct LDKKVStore kv_store, struct LDKLogger logger); /** - * Checks if the given object is currently in the success state + * Tells the sweeper to track the given outputs descriptors. + * + * Usually, this should be called based on the values emitted by the + * [`Event::SpendableOutputs`]. + * + * The given `exclude_static_outputs` flag controls whether the sweeper will filter out + * [`SpendableOutputDescriptor::StaticOutput`]s, which may be handled directly by the on-chain + * wallet implementation. + * + * If `delay_until_height` is set, we will delay the spending until the respective block + * height is reached. This can be used to batch spends, e.g., to reduce on-chain fees. + * + * Returns `Err` on persistence failure, in which case the call may be safely retried. + * + * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs + * + * Note that channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneNoneZ OutputSweeper_track_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ output_descriptors, struct LDKChannelId channel_id, bool exclude_static_outputs, struct LDKCOption_u32Z delay_until_height); /** - * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. + * Returns a list of the currently tracked spendable outputs. */ -void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res); +MUST_USE_RES struct LDKCVec_TrackedSpendableOutputZ OutputSweeper_tracked_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg); /** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Gets the latest best block which was connected either via the [`Listen`] or + * [`Confirm`] interfaces. */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKBestBlock OutputSweeper_current_best_block(const struct LDKOutputSweeper *NONNULL_PTR this_arg); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ 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 */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKListen OutputSweeper_as_Listen(const struct LDKOutputSweeper *NONNULL_PTR this_arg); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. + * 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 LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKConfirm OutputSweeper_as_Confirm(const struct LDKOutputSweeper *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the SpendingDelay */ -bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); +void SpendingDelay_free(struct LDKSpendingDelay this_ptr); /** - * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. + * Creates a copy of the SpendingDelay */ -void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); +struct LDKSpendingDelay SpendingDelay_clone(const struct LDKSpendingDelay *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Relative-variant SpendingDelay */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKSpendingDelay SpendingDelay_relative(uint32_t num_blocks); /** - * 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 Absolute-variant SpendingDelay */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); +struct LDKSpendingDelay SpendingDelay_absolute(uint32_t height); /** - * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. + * Read a OutputSweeper from a byte array, created by OutputSweeper_write */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKCResult_OutputSweeperDecodeErrorZ OutputSweeper_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. + * Read a C2Tuple_BestBlockOutputSweeperZ from a byte array, created by C2Tuple_BestBlockOutputSweeperZ_write */ -void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ C2Tuple_BestBlockOutputSweeperZ_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); +void FutureCallback_free(struct LDKFutureCallback this_ptr); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. + * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +void Future_free(struct LDKFuture this_obj); /** - * Checks if the given object is currently in the success state + * Registers a callback to be called upon completion of this future. If the future has already + * completed, the callback will be called immediately. */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o); +void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. + * Waits until this [`Future`] completes. */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res); +void Future_wait(const struct LDKFuture *NONNULL_PTR this_arg); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Waits until this [`Future`] completes or the given amount of time has elapsed. + * + * Returns true if the [`Future`] completed, false if the time elapsed. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig); +MUST_USE_RES bool Future_wait_timeout(const struct LDKFuture *NONNULL_PTR 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); +void Sleeper_free(struct LDKSleeper this_obj); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. + * Constructs a new sleeper from one future, allowing blocking on it. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); +MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(const struct LDKFuture *NONNULL_PTR future); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + * Constructs a new sleeper from two futures, allowing blocking on both at once. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); +MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b); /** - * Checks if the given object is currently in the success state + * Constructs a new sleeper from three futures, allowing blocking on all three at once. + * */ -bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); +MUST_USE_RES struct LDKSleeper Sleeper_from_three_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b, const struct LDKFuture *NONNULL_PTR fut_c); /** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. + * Constructs a new sleeper on many futures, allowing blocking on all at once. */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); +MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); +void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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. */ -struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR orig); +MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait); /** - * Creates a new C2Tuple_ThirtyTwoBytesPublicKeyZ from the contained elements. + * Creates a copy of the Level */ -struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ C2Tuple_ThirtyTwoBytesPublicKeyZ_new(struct LDKThirtyTwoBytes a, struct LDKPublicKey b); +enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesPublicKeyZ. + * Utility method to constructs a new Gossip-variant Level */ -void C2Tuple_ThirtyTwoBytesPublicKeyZ_free(struct LDKC2Tuple_ThirtyTwoBytesPublicKeyZ _res); +enum LDKLevel Level_gossip(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new Trace-variant Level */ -void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res); +enum LDKLevel Level_trace(void); /** - * Constructs a new COption_StrZ containing a crate::c_types::Str + * Utility method to constructs a new Debug-variant Level */ -struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); +enum LDKLevel Level_debug(void); /** - * Constructs a new COption_StrZ containing nothing + * Utility method to constructs a new Info-variant Level */ -struct LDKCOption_StrZ COption_StrZ_none(void); +enum LDKLevel Level_info(void); /** - * Frees any resources associated with the crate::c_types::Str, if we are in the Some state + * Utility method to constructs a new Warn-variant Level */ -void COption_StrZ_free(struct LDKCOption_StrZ _res); +enum LDKLevel Level_warn(void); /** - * Creates a new COption_StrZ 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 LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); +enum LDKLevel Level_error(void); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ 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_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); +bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the Level. */ -struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Get the string representation of a Level object */ -bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); +struct LDKStr Level_to_str(const enum LDKLevel *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. + * Returns the most verbose logging level. */ -void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); +MUST_USE_RES enum LDKLevel Level_max(void); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); +void Record_free(struct LDKRecord this_obj); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. + * The verbosity level of the message. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); +enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. + * The verbosity level of the message. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); +void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); /** - * Checks if the given object is currently in the success state + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); +struct LDKPublicKey Record_get_peer_id(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); +void Record_set_peer_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); +struct LDKChannelId Record_get_channel_id(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Constructs a new COption_OffersMessageZ containing a crate::lightning::onion_message::offers::OffersMessage + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o); +void Record_set_channel_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Constructs a new COption_OffersMessageZ containing nothing + * The message body. */ -struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void); +struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::onion_message::offers::OffersMessage, if we are in the Some state + * The message body. */ -void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res); +void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a new COption_OffersMessageZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The module path of the message. */ -struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig); +struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The module path of the message. */ -struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR orig); +void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements. + * The source file containing the message. */ -struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_new(struct LDKOffersMessage a, struct LDKDestination b, struct LDKBlindedPath c); +struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C3Tuple_OffersMessageDestinationBlindedPathZ. + * The source file containing the message. */ -void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res); +void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * The line containing the message. */ -void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res); +uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + * The line containing the message. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); +void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + * The payment hash. + * + * Note that this is only filled in for logs pertaining to a specific payment, and will be + * `None` for logs which are not directly related to a payment. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_ThirtyTwoBytesZ Record_get_payment_hash(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The payment hash. + * + * Note that this is only filled in for logs pertaining to a specific payment, and will be + * `None` for logs which are not directly related to a payment. */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); +void Record_set_payment_hash(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. + * Constructs a new Record given each field + * + * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); +MUST_USE_RES struct LDKRecord Record_new(enum LDKLevel level_arg, struct LDKPublicKey peer_id_arg, struct LDKChannelId channel_id_arg, struct LDKStr args_arg, struct LDKStr module_path_arg, struct LDKStr file_arg, uint32_t line_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ 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_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + * Calls the free function if one is set */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); +void Logger_free(struct LDKLogger this_ptr); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_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_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + * 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_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ 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_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ 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_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ 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_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_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_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *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_ChannelDetailsDecodeErrorZ. + * 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 will be treated as `1` instead.) + * + * Maximum value: `100` (Any values larger will be treated as `100` instead.) */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _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_ChannelDetailsDecodeErrorZ 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 will be treated as `1` instead.) + * + * Maximum value: `100` (Any values larger will be treated as `100` instead.) */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *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_PhantomRouteHintsDecodeErrorZ 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::announce_for_forwarding`] 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_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); +bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ 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::announce_for_forwarding`] 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_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_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_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); +bool ChannelHandshakeConfig_get_announce_for_forwarding(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. + * 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_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); +void ChannelHandshakeConfig_set_announce_for_forwarding(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ 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::sign::SignerProvider::get_shutdown_scriptpubkey */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); +bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ 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::sign::SignerProvider::get_shutdown_scriptpubkey */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); +void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ 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: `10_000` millionths (i.e., 1% of channel value) + * + * 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` (i.e., 100% of channel value. Any values larger than one million + * will be treated as one million instead, although channel negotiations will + * fail in that case.) */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_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: `10_000` millionths (i.e., 1% of channel value) + * + * 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` (i.e., 100% of channel value. Any values larger than one million + * will be treated as one million instead, although channel negotiations will + * fail in that case.) */ -bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *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_ChannelShutdownStateDecodeErrorZ. + * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future + * channels. This feature requires having a reserve of onchain funds readily available to bump + * transactions in the event of a channel force close to avoid the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.116, 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 `anchors_zero_fee_htlc_tx` option; we will simply + * fall back to a `static_remote_key` channel. + * + * LDK will not support the legacy `option_anchors` commitment version due to a discovered + * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee + * Considered Harmful`] mailing list post. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html */ -void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); +bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future + * channels. This feature requires having a reserve of onchain funds readily available to bump + * transactions in the event of a channel force close to avoid the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.116, 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 `anchors_zero_fee_htlc_tx` option; we will simply + * fall back to a `static_remote_key` channel. + * + * LDK will not support the legacy `option_anchors` commitment version due to a discovered + * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee + * Considered Harmful`] mailing list post. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * 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 CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); +uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. + * 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 LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. + * Constructs a new ChannelHandshakeConfig given each field */ -void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); +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 announce_for_forwarding_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, bool negotiate_anchors_zero_fee_htlc_tx_arg, uint16_t our_max_accepted_htlcs_arg); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. + * Creates a copy of the ChannelHandshakeConfig */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. + * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. */ -bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: `1000` + * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) */ -void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ 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: `1000` + * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) */ -struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o); +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ 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_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_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_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *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_MaxDustHTLCExposureDecodeErrorZ. + * 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_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res); +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ 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_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ 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_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ 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_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_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_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *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_ChannelConfigDecodeErrorZ. + * 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_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ 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_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure + * 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 LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o); +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new COption_MaxDustHTLCExposureZ containing nothing + * 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 LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void); +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some 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 */ -void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res); +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new COption_MaxDustHTLCExposureZ 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 LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig); +bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError + * 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 LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); +void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new COption_APIErrorZ containing nothing + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announce_for_forwarding`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: `true` */ -struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announce_for_forwarding`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: `true` */ -void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Creates a new COption_APIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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) */ -struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ 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) */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. + * Constructs a new ChannelHandshakeLimits given each field */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); +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); /** - * Checks if the given object is currently in the success state + * Creates a copy of the ChannelHandshakeLimits */ -bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. + * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. */ -void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the MaxDustHTLCExposure */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); +void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + * Creates a copy of the MaxDustHTLCExposure */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure */ -bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Checks if two MaxDustHTLCExposures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj); /** - * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser); /** - * Constructs a new COption_MonitorEventZ containing nothing + * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); +void ChannelConfig_free(struct LDKChannelConfig this_obj); /** - * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + * 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 COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); +uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new COption_MonitorEventZ 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 LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); +void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ 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_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); +uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ 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_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_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_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); +uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + * 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_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); +void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Limit our total exposure to potential loss to on-chain fees on close, including in-flight + * HTLCs which are burned to fees as they are too small to claim on-chain and fees on + * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. + * + * # HTLC-based Dust Exposure + * + * 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 substantial 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. Because of this, you may want to set this + * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier + * variant is primarily intended for use with pre-anchor channels. + * + * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. + * + * # Transaction Fee Dust Exposure + * + * Further, counterparties broadcasting a commitment transaction in a force-close may result + * in other balance being burned to fees, and thus all fees on commitment and HTLC + * transactions in excess of our local fee estimates are included in the dust calculation. + * + * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 + * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per + * non-dust HTLC we're allowed to have with our peers before risking a force-closure for + * inbound channels. + * + * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 + * sat/KW), we risk force-closure if we disagree with our peer by: + * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in + * both directions (the maximum), + * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both + * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs + * in both directions (the maximum), + * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs + * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * + * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement + * will scale linearly with increases (or decreases) in the our feerate estimates. Further, + * for anchor channels we expect our counterparty to use a relatively low feerate estimate + * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) + * and feerate disagreement force-closures should only occur when theirs is higher than ours. + * + * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` + * + * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); +struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Limit our total exposure to potential loss to on-chain fees on close, including in-flight + * HTLCs which are burned to fees as they are too small to claim on-chain and fees on + * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. + * + * # HTLC-based Dust Exposure + * + * 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 substantial 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. Because of this, you may want to set this + * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier + * variant is primarily intended for use with pre-anchor channels. + * + * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. + * + * # Transaction Fee Dust Exposure + * + * Further, counterparties broadcasting a commitment transaction in a force-close may result + * in other balance being burned to fees, and thus all fees on commitment and HTLC + * transactions in excess of our local fee estimates are included in the dust calculation. + * + * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 + * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per + * non-dust HTLC we're allowed to have with our peers before risking a force-closure for + * inbound channels. + * + * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 + * sat/KW), we risk force-closure if we disagree with our peer by: + * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in + * both directions (the maximum), + * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both + * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs + * in both directions (the maximum), + * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs + * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * + * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement + * will scale linearly with increases (or decreases) in the our feerate estimates. Further, + * for anchor channels we expect our counterparty to use a relatively low feerate estimate + * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) + * and feerate disagreement force-closures should only occur when theirs is higher than ours. + * + * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` + * + * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ 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 [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: `1000` + * + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_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 [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: `1000` + * + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ -bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *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_HTLCUpdateDecodeErrorZ. + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound + * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. + * + * Usage: + * - The payee will set this option and set its invoice route hints to use [intercept scids] + * generated by this channel's counterparty. + * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call + * [`forward_intercepted_htlc`] with less than the amount provided in + * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. + * + * # Note + * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is + * as-expected if this feature is activated, otherwise they may lose money! + * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the + * counterparty. + * + * # Note + * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. + * Unsetting this flag between restarts may lead to payment receive failures. + * + * Default value: `false` + * + * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat + * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound + * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. + * + * Usage: + * - The payee will set this option and set its invoice route hints to use [intercept scids] + * generated by this channel's counterparty. + * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call + * [`forward_intercepted_htlc`] with less than the amount provided in + * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. + * + * # Note + * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is + * as-expected if this feature is activated, otherwise they may lose money! + * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the + * counterparty. + * + * # Note + * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. + * Unsetting this flag between restarts may lead to payment receive failures. + * + * Default value: `false` + * + * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat + * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new ChannelConfig given each field */ -struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); +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, struct LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg); /** - * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. + * Creates a copy of the ChannelConfig */ -struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. + * 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. */ -void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); +bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`]. */ -struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); +void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update); /** - * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. + * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); /** - * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. + * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read */ -void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res); +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Read a ChannelConfig from a byte array, created by ChannelConfig_write */ -void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); /** - * 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 ChannelConfigUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig); +void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj); -/** - * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. - */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b); +struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); -/** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. - */ -void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res); +void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res); +struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); +void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. + * + * Returns a copy of the field. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); -/** - * Frees any resources used by the C2Tuple_u32TxOutZ. - */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); + +void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new ChannelConfigUpdate given each field */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_new(struct LDKCOption_u32Z forwarding_fee_proportional_millionths_arg, struct LDKCOption_u32Z forwarding_fee_base_msat_arg, struct LDKCOption_u16Z cltv_expiry_delta_arg, struct LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, struct LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg); /** - * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +void UserConfig_free(struct LDKUserConfig this_obj); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. + * Channel handshake config that we propose to our counterparty. */ -void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res); +struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Channel handshake config that we propose to our counterparty. */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); +struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); +void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** - * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. + * Channel config which affects behavior during channel lifetime. */ -struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. + * Channel config which affects behavior during channel lifetime. */ -void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); +void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ 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::announce_for_forwarding`] 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); +bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ 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::announce_for_forwarding`] 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +void UserConfig_set_accept_forwards_to_priv_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 `false`, we do not accept inbound requests to open a new channel. + * + * Default value: `true` */ -bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. + * If this is set to `false`, we do not accept inbound requests to open a new channel. + * + * Default value: `true` */ -void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); +void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig); +bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); +void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + * 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 */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * 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 C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple + * parts. If this is set to `true`, we'll accept the payment. + * + * Setting this to `true` will break backwards compatibility upon downgrading to an LDK + * version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP + * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. + * + * Default value: `false` + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +bool UserConfig_get_accept_mpp_keysend(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents + * If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple + * parts. If this is set to `true`, we'll accept the payment. + * + * Setting this to `true` will break backwards compatibility upon downgrading to an LDK + * version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP + * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. + * + * Default value: `false` + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); +void UserConfig_set_accept_mpp_keysend(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new COption_OnionMessageContentsZ containing nothing + * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * + * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received + * [`Bolt12Invoice`] instead of being automatically paid after verification. Use + * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or + * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * + * Default value: `false` + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ -struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); +bool UserConfig_get_manually_handle_bolt12_invoices(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state + * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * + * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received + * [`Bolt12Invoice`] instead of being automatically paid after verification. Use + * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or + * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * + * Default value: `false` + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ -void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); +void UserConfig_set_manually_handle_bolt12_invoices(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new COption_OnionMessageContentsZ 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 LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *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, bool accept_mpp_keysend_arg, bool manually_handle_bolt12_invoices_arg); /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. + * Creates a copy of the UserConfig */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. + * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_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_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +void BestBlock_free(struct LDKBestBlock this_obj); /** - * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. + * The block's hash */ -void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); +const uint8_t (*BestBlock_get_block_hash(const struct LDKBestBlock *NONNULL_PTR this_ptr))[32]; /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The block's hash */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); +void BestBlock_set_block_hash(struct LDKBestBlock *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The height at which the block was confirmed. */ -struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR orig); +uint32_t BestBlock_get_height(const struct LDKBestBlock *NONNULL_PTR this_ptr); /** - * Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements. + * The height at which the block was confirmed. */ -struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(struct LDKOnionMessageContents a, struct LDKDestination b, struct LDKBlindedPath c); +void BestBlock_set_height(struct LDKBestBlock *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the C3Tuple_OnionMessageContentsDestinationBlindedPathZ. + * Constructs a new BestBlock given each field */ -void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res); +MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash_arg, uint32_t height_arg); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a copy of the BestBlock */ -void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res); +struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); /** - * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + * Generates a non-cryptographic 64-bit hash of the BestBlock. */ -struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); +uint64_t BestBlock_hash(const struct LDKBestBlock *NONNULL_PTR o); /** - * Constructs a new COption_TypeZ containing nothing + * 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 LDKCOption_TypeZ COption_TypeZ_none(void); +bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b); /** - * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + * Constructs a `BestBlock` that represents the genesis block at height 0 of the given + * network. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network); /** - * Creates a new COption_TypeZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the BestBlock object into a byte array which can be read by BestBlock_read */ -struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig); +struct LDKCVec_u8Z BestBlock_write(const struct LDKBestBlock *NONNULL_PTR obj); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Read a BestBlock from a byte array, created by BestBlock_write */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_BestBlockDecodeErrorZ BestBlock_read(struct LDKu8slice ser); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); +void Listen_free(struct LDKListen this_ptr); /** - * Checks if the given object is currently in the success state + * Calls the free function if one is set */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +void Confirm_free(struct LDKConfirm this_ptr); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Creates a copy of the ChannelMonitorUpdateStatus */ -void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); /** - * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress + * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus */ -struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); /** - * Constructs a new COption_SocketAddressZ containing nothing + * Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus */ -struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); +enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_unrecoverable_error(void); /** - * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state + * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); +bool ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b); /** - * Creates a new COption_SocketAddressZ 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 LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); +void Watch_free(struct LDKWatch this_ptr); /** - * Creates a new tuple 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 LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_clone(const struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ *NONNULL_PTR orig); +void Filter_free(struct LDKFilter this_ptr); /** - * Creates a new C2Tuple_PublicKeyCOption_SocketAddressZZ from the contained elements. + * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. */ -struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ C2Tuple_PublicKeyCOption_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKCOption_SocketAddressZ b); +void WatchedOutput_free(struct LDKWatchedOutput this_obj); /** - * Frees any resources used by the C2Tuple_PublicKeyCOption_SocketAddressZZ. + * First block where the transaction output may have been spent. */ -void C2Tuple_PublicKeyCOption_SocketAddressZZ_free(struct LDKC2Tuple_PublicKeyCOption_SocketAddressZZ _res); +struct LDKCOption_ThirtyTwoBytesZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * First block where the transaction output may have been spent. */ -void CVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ_free(struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ _res); +void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Outpoint identifying the transaction output. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Outpoint identifying the transaction output. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Checks if the given object is currently in the success state + * Spending condition of the transaction output. */ -bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Spending condition of the transaction output. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new WatchedOutput given each field */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_ThirtyTwoBytesZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a copy of the WatchedOutput */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error 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. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Generates a non-cryptographic 64-bit hash of the WatchedOutput. */ -bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); +uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Calls the free function if one is set */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the ConfirmationTarget */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Utility method to constructs a new MaximumFeeEstimate-variant ConfirmationTarget */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +enum LDKConfirmationTarget ConfirmationTarget_maximum_fee_estimate(void); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Utility method to constructs a new UrgentOnChainSweep-variant ConfirmationTarget */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +enum LDKConfirmationTarget ConfirmationTarget_urgent_on_chain_sweep(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget */ -bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); +enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void); /** - * Creates a new CResult_u32GraphSyncErrorZ in the success state. + * Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); +enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void); /** - * Creates a new CResult_u32GraphSyncErrorZ in the error state. + * Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); +enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new OutputSpendingFee-variant ConfirmationTarget */ -bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); +enum LDKConfirmationTarget ConfirmationTarget_output_spending_fee(void); /** - * Frees any resources used by the CResult_u32GraphSyncErrorZ. + * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget. */ -void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); +uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); /** - * Creates a new CResult_CVec_u8ZIOErrorZ 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_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); +bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); /** - * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); +void FeeEstimator_free(struct LDKFeeEstimator this_ptr); /** - * Checks if the given object is currently in the success state + * Calls the free function if one is set */ -bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); +void Persist_free(struct LDKPersist this_ptr); /** - * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. + * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL. */ -void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); +void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); /** - * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig); +void ChainMonitor_free(struct LDKChainMonitor this_obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * 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. */ -void CVec_StrZ_free(struct LDKCVec_StrZ _res); +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_CVec_StrZIOErrorZ 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`. + * + * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for + * inclusion in the return value. */ -struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ 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_CVec_StrZIOErrorZ 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_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError 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 and channel ID 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_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointChannelIdZZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_CVec_StrZIOErrorZ. + * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + * Each `Vec` contains `update_id`s from [`ChannelMonitor::get_latest_update_id`] for updates + * that have not yet been fully persisted. Note that if a full monitor is persisted all the pending + * monitor updates must be individually marked completed by calling [`ChainMonitor::channel_monitor_updated`]. */ -void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_CVec_StrZIOErrorZ 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 [`ChannelMonitor::get_latest_update_id`] + * or [`ChannelMonitorUpdate::update_id`] as the `completed_update_id`, and once all pending + * updates have completed the channel will be re-enabled. + * + * It is only necessary to call [`ChainMonitor::channel_monitor_updated`] when you return [`ChannelMonitorUpdateStatus::InProgress`] + * from [`Persist`] and either: + * 1. A new [`ChannelMonitor`] was added in [`Persist::persist_new_channel`], or + * 2. A [`ChannelMonitorUpdate`] was provided as part of [`Persist::update_persisted_channel`]. + * Note that we don't care about calls to [`Persist::update_persisted_channel`] where no + * [`ChannelMonitorUpdate`] was provided. + * + * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently + * registered [`ChannelMonitor`]s. */ -struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, uint64_t completed_update_id); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * 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 */ -void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); +MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); +void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. + * Triggers rebroadcasts of pending claims from force-closed channels after a transaction + * signature generation failure. + * + * `monitor_opt` can be used as a filter to only trigger them for a specific channel monitor. + * + * Note that monitor_opt (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e); +void ChainMonitor_signer_unblocked(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint monitor_opt); /** - * Checks if the given object is currently in the success state + * Archives fully resolved channel monitors by calling [`Persist::archive_persisted_channel`]. + * + * This is useful for pruning fully resolved monitors from the monitor set and primary + * storage so they are not kept in memory and reloaded on restart. + * + * Should be called occasionally (once every handful of blocks or on startup). + * + * Depending on the implementation of [`Persist::archive_persisted_channel`] the monitor + * data could be moved to an archive location or removed entirely. */ -bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o); +void ChainMonitor_archive_fully_resolved_channel_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); +struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig); +struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. + * 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); +struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); +struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. */ -bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o); +void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. + * 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); +uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); +void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new COption_SecretKeyZ containing a crate::c_types::SecretKey + * The channel ID associated with these updates. + * + * Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and + * always `Some` otherwise. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_SecretKeyZ COption_SecretKeyZ_some(struct LDKSecretKey o); +struct LDKChannelId ChannelMonitorUpdate_get_channel_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); /** - * Constructs a new COption_SecretKeyZ containing nothing + * The channel ID associated with these updates. + * + * Will be `None` for `ChannelMonitorUpdate`s constructed on LDK versions prior to 0.0.121 and + * always `Some` otherwise. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_SecretKeyZ COption_SecretKeyZ_none(void); +void ChannelMonitorUpdate_set_channel_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Frees any resources associated with the crate::c_types::SecretKey, if we are in the Some state + * Creates a copy of the ChannelMonitorUpdate */ -void COption_SecretKeyZ_free(struct LDKCOption_SecretKeyZ _res); +struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); /** - * Creates a new COption_SecretKeyZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCOption_SecretKeyZ COption_SecretKeyZ_clone(const struct LDKCOption_SecretKeyZ *NONNULL_PTR orig); +bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. + * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read */ -struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); +struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. + * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write */ -struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the MonitorEvent */ -bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); +void MonitorEvent_free(struct LDKMonitorEvent this_ptr); /** - * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. + * Creates a copy of the MonitorEvent */ -void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); +struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new HTLCEvent-variant MonitorEvent */ -struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig); +struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); /** - * Constructs a new COption_NoneZ containing a + * Utility method to constructs a new HolderForceClosedWithInfo-variant MonitorEvent */ -enum LDKCOption_NoneZ COption_NoneZ_some(void); +struct LDKMonitorEvent MonitorEvent_holder_force_closed_with_info(struct LDKClosureReason reason, struct LDKOutPoint outpoint, struct LDKChannelId channel_id); /** - * Constructs a new COption_NoneZ containing nothing + * Utility method to constructs a new HolderForceClosed-variant MonitorEvent */ -enum LDKCOption_NoneZ COption_NoneZ_none(void); +struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a); /** - * Frees any resources associated with the , if we are in the Some state + * Utility method to constructs a new Completed-variant MonitorEvent */ -void COption_NoneZ_free(enum LDKCOption_NoneZ _res); +struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, struct LDKChannelId channel_id, uint64_t monitor_update_id); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if two MonitorEvents contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res); +bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b); /** - * Constructs a new COption_i64Z containing a i64 + * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read */ -struct LDKCOption_i64Z COption_i64Z_some(int64_t o); +struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj); /** - * Constructs a new COption_i64Z containing nothing + * Read a MonitorEvent from a byte array, created by MonitorEvent_write */ -struct LDKCOption_i64Z COption_i64Z_none(void); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser); /** - * Frees any resources associated with the i64, if we are in the Some state + * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. */ -void COption_i64Z_free(struct LDKCOption_i64Z _res); +void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); /** - * Creates a new COption_i64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the HTLCUpdate */ -struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); +struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); /** - * Creates a new CResult_SocketAddressDecodeErrorZ 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_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); +bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b); /** - * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. + * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read */ -struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); +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_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. + * Creates a copy of the BalanceSource */ -void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); +enum LDKBalanceSource BalanceSource_clone(const enum LDKBalanceSource *NONNULL_PTR orig); /** - * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new HolderForceClosed-variant BalanceSource */ -struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); +enum LDKBalanceSource BalanceSource_holder_force_closed(void); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. + * Utility method to constructs a new CounterpartyForceClosed-variant BalanceSource */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); +enum LDKBalanceSource BalanceSource_counterparty_force_closed(void); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. + * Utility method to constructs a new CoopClose-variant BalanceSource */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); +enum LDKBalanceSource BalanceSource_coop_close(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Htlc-variant BalanceSource */ -bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); +enum LDKBalanceSource BalanceSource_htlc(void); /** - * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. + * Checks if two BalanceSources contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); +bool BalanceSource_eq(const enum LDKBalanceSource *NONNULL_PTR a, const enum LDKBalanceSource *NONNULL_PTR b); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the Balance */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); +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_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _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_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); +struct LDKBalance Balance_claimable_on_channel_close(uint64_t amount_satoshis, uint64_t transaction_fee_satoshis, uint64_t outbound_payment_htlc_rounded_msat, uint64_t outbound_forwarded_htlc_rounded_msat, uint64_t inbound_claiming_htlc_rounded_msat, uint64_t inbound_htlc_rounded_msat); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance */ -void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); +struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t amount_satoshis, uint32_t confirmation_height, enum LDKBalanceSource source); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Utility method to constructs a new ContentiousClaimable-variant Balance */ -void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); +struct LDKBalance Balance_contentious_claimable(uint64_t amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. + * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); +struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash, bool outbound_payment); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. + * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance */ -bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); +struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t amount_satoshis); /** - * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. + * Checks if two Balances contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); +bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The amount claimable, in satoshis. + * + * For outbound payments, this excludes the balance from the possible HTLC timeout. + * + * For forwarded payments, this includes the balance from the possible HTLC timeout as + * (to be conservative) that balance does not include routing fees we'd earn if we'd claim + * the balance from a preimage in a successful forward. + * + * For more information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and + * [`Balance::MaybePreimageClaimableHTLC`]. + * + * On-chain fees required to claim the balance are not included in this amount. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance *NONNULL_PTR this_arg); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. + * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o); +void ChannelMonitor_free(struct LDKChannelMonitor this_obj); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. + * Creates a copy of the ChannelMonitor */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e); +struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read */ -bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. + * 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. */ -void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this + * ChannelMonitor. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxAddInputDecodeErrorZ in the success state. + * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. */ -struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o); +MUST_USE_RES struct LDKC2Tuple_OutPointCVec_u8ZZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxAddInputDecodeErrorZ in the error state. + * Gets the channel_id of the channel this ChannelMonitor is monitoring for. */ -struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelId ChannelMonitor_channel_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * 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(). */ -bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_TxAddInputDecodeErrorZ. + * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly + * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs + * have been registered. */ -void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res); +void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. + * Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity. + * + * For channels featuring anchor outputs, this method will also process [`BumpTransaction`] + * events produced from each [`ChannelMonitor`] while there is a balance to claim onchain + * within each channel. As the confirmation of a commitment transaction may be critical to the + * safety of funds, we recommend invoking this every 30 seconds, or lower if running in an + * environment with spotty connections, like on mobile. + * + * An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in + * order to handle these events. + * + * Will return a [`ReplayEvent`] error if event handling failed and should eventually be retried. + * + * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs + * [`BumpTransaction`]: crate::events::Event::BumpTransaction */ -struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o); +MUST_USE_RES struct LDKCResult_NoneReplayEventZ ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. + * Gets the counterparty's initial commitment transaction. The returned commitment + * transaction is unsigned. This is intended to be called during the initial persistence of + * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for + * watchtowers in the persistence pipeline to have enough data to form justice transactions. + * + * This is similar to [`Self::counterparty_commitment_txs_from_update`], except + * that for the initial commitment transaction, we don't have a corresponding update. + * + * This will only return `Some` for channel monitors that have been created after upgrading + * to LDK 0.0.117+. + * + * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCommitmentTransaction ChannelMonitor_initial_counterparty_commitment_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Gets all of the counterparty commitment transactions provided by the given update. This + * may be empty if the update doesn't include any new counterparty commitments. Returned + * commitment transactions are unsigned. + * + * This is provided so that watchtower clients in the persistence pipeline are able to build + * justice transactions for each counterparty commitment upon each update. It's intended to be + * used within an implementation of [`Persist::update_persisted_channel`], which is provided + * with a monitor and an update. Once revoked, signing a justice transaction can be done using + * [`Self::sign_to_local_justice_tx`]. + * + * It is expected that a watchtower client may use this method to retrieve the latest counterparty + * commitment transaction(s), and then hold the necessary data until a later update in which + * the monitor has been updated with the corresponding revocation data, at which point the + * monitor can sign the justice transaction. + * + * This will only return a non-empty list for monitor updates that have been created after + * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which + * may have been created prior to upgrading. + * + * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel */ -bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_commitment_txs_from_update(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** - * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. + * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make + * signing the justice transaction easier for implementors of + * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction + * signing the input at `input_idx`. This method will only produce a valid signature for + * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot + * be used for revoked HTLC outputs. + * + * `Value` is the value of the output being spent by the input at `input_idx`, committed + * in the BIP 143 signature. + * + * This method will only succeed if this monitor has received the revocation secret for the + * provided `commitment_number`. If a commitment number is provided that does not correspond + * to the commitment transaction being revoked, this will return a signed transaction, but + * the signature will not be valid. + * + * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output + * [`Persist`]: crate::chain::chainmonitor::Persist */ -void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_justice_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input_idx, uint64_t value, uint64_t commitment_number); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. + * You may use this to broadcast the latest local commitment transaction, either because + * a monitor update failed or because we've fallen behind (i.e. we've received proof that our + * counterparty side knows a revocation secret we gave them that they shouldn't know). + * + * Broadcasting these transactions in this manner 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. */ -struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o); +void ChannelMonitor_broadcast_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. + * 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 LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Checks if the given object is currently in the success state + * Determines if the disconnected block contained any transactions of interest and updates + * appropriately. */ -bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o); +void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. + * 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 */ -void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig); +void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. + * 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 LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o); +MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. + * Returns the set of txids that should be monitored for re-organization out of the chain. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. + * 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. */ -void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res); +void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Returns true if the monitor has pending claim requests that are not fully confirmed yet. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES bool ChannelMonitor_has_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxCompleteDecodeErrorZ in the success state. + * Triggers rebroadcasts of pending claims from a force-closed channel after a transaction + * signature generation failure. */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o); +void ChannelMonitor_signer_unblocked(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** - * Creates a new CResult_TxCompleteDecodeErrorZ in the error state. + * Returns the descriptors for relevant outputs (i.e., those that we can spend) within the + * transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`] + * confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be + * returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)` + * confirmations. + * + * Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`] + * once they are no longer under reorg risk. This method serves as a way to retrieve these + * descriptors at a later time, either for historical purposes, or to replay any + * missed/unhandled descriptors. For the purpose of gathering historical records, if the + * channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns + * an empty set), you can retrieve all spendable outputs by providing all descendant spending + * transactions starting from the channel's funding transaction and going down three levels. + * + * `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any + * outputs which can be spent by us are found, at least one descriptor is returned. + * + * `confirmation_height` must be the height of the block in which `tx` was included in. */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spendable_outputs(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction tx, uint32_t confirmation_height); /** - * Checks if the given object is currently in the success state + * Checks if the monitor is fully resolved. Resolved monitor is one that has claimed all of + * its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set). + * + * This function returns true only if [`Self::get_claimable_balances`] has been empty for at least + * 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets. */ -bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES bool ChannelMonitor_is_fully_resolved(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); /** - * Frees any resources used by the CResult_TxCompleteDecodeErrorZ. + * 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, not all or excess balances may be included. + * + * See [`Balance`] for additional details on the types of claimable balances which + * may be returned here and their meanings. */ -void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res); +MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. + * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o); +void OutPoint_free(struct LDKOutPoint this_obj); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. + * The referenced transaction's txid. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; /** - * Checks if the given object is currently in the success state + * The referenced transaction's txid. */ -bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o); +void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. + * The index of the referenced output in its transaction's vout. */ -void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res); +uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The index of the referenced output in its transaction's vout. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig); +void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. + * Constructs a new OutPoint given each field */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o); +MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. + * Creates a copy of the OutPoint */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Checks if two OutPoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o); +bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); /** - * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. + * Generates a non-cryptographic 64-bit hash of the OutPoint. */ -void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res); +uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get the string representation of a OutPoint object */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig); +struct LDKStr OutPoint_to_str(const struct LDKOutPoint *NONNULL_PTR o); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. + * Serialize the OutPoint object into a byte array which can be read by OutPoint_read */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o); +struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. + * Read a OutPoint from a byte array, created by OutPoint_write */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the InboundHTLCErr, if is_owned is set and inner is non-NULL. */ -bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o); +void InboundHTLCErr_free(struct LDKInboundHTLCErr this_obj); /** - * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. + * BOLT 4 error code. */ -void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res); +uint16_t InboundHTLCErr_get_err_code(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * BOLT 4 error code. */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig); +void InboundHTLCErr_set_err_code(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_TxAbortDecodeErrorZ in the success state. + * Data attached to this error. + * + * Returns a copy of the field. */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o); +struct LDKCVec_u8Z InboundHTLCErr_get_err_data(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * Creates a new CResult_TxAbortDecodeErrorZ in the error state. + * Data attached to this error. */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e); +void InboundHTLCErr_set_err_data(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Checks if the given object is currently in the success state + * Error message text. */ -bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o); +struct LDKStr InboundHTLCErr_get_msg(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_TxAbortDecodeErrorZ. + * Error message text. */ -void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res); +void InboundHTLCErr_set_msg(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new InboundHTLCErr given each field + */ +MUST_USE_RES struct LDKInboundHTLCErr InboundHTLCErr_new(uint16_t err_code_arg, struct LDKCVec_u8Z err_data_arg, struct LDKStr msg_arg); + +/** + * Creates a copy of the InboundHTLCErr */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig); +struct LDKInboundHTLCErr InboundHTLCErr_clone(const struct LDKInboundHTLCErr *NONNULL_PTR orig); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); +uint64_t InboundHTLCErr_hash(const struct LDKInboundHTLCErr *NONNULL_PTR o); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. + * Checks if two InboundHTLCErrs 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_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +bool InboundHTLCErr_eq(const struct LDKInboundHTLCErr *NONNULL_PTR a, const struct LDKInboundHTLCErr *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information + * about the intended next-hop for the HTLC. + * + * This does all the relevant context-free checks that LDK requires for payment relay or + * acceptance. If the payment is to be received, and the amount matches the expected amount for + * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the + * channel, will generate an [`Event::PaymentClaimable`]. + * + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable */ -bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, uint32_t cur_height, bool accept_mpp_keysend, bool allow_skimmed_fees); /** - * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. + * Frees any resources used by the PendingHTLCRouting */ -void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); +void PendingHTLCRouting_free(struct LDKPendingHTLCRouting this_ptr); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the PendingHTLCRouting */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKPendingHTLCRouting PendingHTLCRouting_clone(const struct LDKPendingHTLCRouting *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. + * Utility method to constructs a new Forward-variant PendingHTLCRouting */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); +struct LDKPendingHTLCRouting PendingHTLCRouting_forward(struct LDKOnionPacket onion_packet, uint64_t short_channel_id, struct LDKBlindedForward blinded); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. + * Utility method to constructs a new Receive-variant PendingHTLCRouting */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopData payment_data, struct LDKCOption_CVec_u8ZZ payment_metadata, struct LDKCOption_PaymentContextZ payment_context, uint32_t incoming_cltv_expiry, struct LDKThirtyTwoBytes phantom_shared_secret, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting */ -bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); +struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); /** - * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. + * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL. */ -void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); +void BlindedForward_free(struct LDKBlindedForward 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 `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); +struct LDKPublicKey BlindedForward_get_inbound_blinding_point(const struct LDKBlindedForward *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. + * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); +void BlindedForward_set_inbound_blinding_point(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKBlindedFailure BlindedForward_get_failure(const struct LDKBlindedForward *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. */ -bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); +void BlindedForward_set_failure(struct LDKBlindedForward *NONNULL_PTR this_ptr, enum LDKBlindedFailure val); /** - * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. + * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being + * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that + * starts at the next hop. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); +struct LDKPublicKey BlindedForward_get_next_blinding_override(const struct LDKBlindedForward *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. + * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being + * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that + * starts at the next hop. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); +void BlindedForward_set_next_blinding_override(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. + * Constructs a new BlindedForward given each field + * + * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); +MUST_USE_RES struct LDKBlindedForward BlindedForward_new(struct LDKPublicKey inbound_blinding_point_arg, enum LDKBlindedFailure failure_arg, struct LDKPublicKey next_blinding_override_arg); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. + * Creates a copy of the BlindedForward */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKBlindedForward BlindedForward_clone(const struct LDKBlindedForward *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Generates a non-cryptographic 64-bit hash of the BlindedForward. */ -bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); +uint64_t BlindedForward_hash(const struct LDKBlindedForward *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. + * Checks if two BlindedForwards contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); +bool BlindedForward_eq(const struct LDKBlindedForward *NONNULL_PTR a, const struct LDKBlindedForward *NONNULL_PTR b); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the PendingHTLCInfo, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); +void PendingHTLCInfo_free(struct LDKPendingHTLCInfo this_obj); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. + * Further routing details based on whether the HTLC is being forwarded or received. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); +struct LDKPendingHTLCRouting PendingHTLCInfo_get_routing(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. + * Further routing details based on whether the HTLC is being forwarded or received. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +void PendingHTLCInfo_set_routing(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKPendingHTLCRouting val); /** - * Checks if the given object is currently in the success state + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. */ -bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); +const uint8_t (*PendingHTLCInfo_get_incoming_shared_secret(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. */ -void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); +void PendingHTLCInfo_set_incoming_shared_secret(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); +const uint8_t (*PendingHTLCInfo_get_payment_hash(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); +void PendingHTLCInfo_set_payment_hash(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_u64Z PendingHTLCInfo_get_incoming_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. */ -bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); +void PendingHTLCInfo_set_incoming_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. + * + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). + * + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. */ -void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); +uint64_t PendingHTLCInfo_get_outgoing_amt_msat(const struct LDKPendingHTLCInfo *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. + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. + * + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). + * + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); +void PendingHTLCInfo_set_outgoing_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); +uint32_t PendingHTLCInfo_get_outgoing_cltv_value(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); +void PendingHTLCInfo_set_outgoing_cltv_value(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if the given object is currently in the success state + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. */ -bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_u64Z PendingHTLCInfo_get_skimmed_fee_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. */ -void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); +void PendingHTLCInfo_set_skimmed_fee_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new PendingHTLCInfo given each field */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPendingHTLCInfo PendingHTLCInfo_new(struct LDKPendingHTLCRouting routing_arg, struct LDKThirtyTwoBytes incoming_shared_secret_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u64Z incoming_amt_msat_arg, uint64_t outgoing_amt_msat_arg, uint32_t outgoing_cltv_value_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. + * Creates a copy of the PendingHTLCInfo */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); +struct LDKPendingHTLCInfo PendingHTLCInfo_clone(const struct LDKPendingHTLCInfo *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. + * Creates a copy of the BlindedFailure */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKBlindedFailure BlindedFailure_clone(const enum LDKBlindedFailure *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new FromIntroductionNode-variant BlindedFailure */ -bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); +enum LDKBlindedFailure BlindedFailure_from_introduction_node(void); /** - * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. + * Utility method to constructs a new FromBlindedNode-variant BlindedFailure */ -void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); +enum LDKBlindedFailure BlindedFailure_from_blinded_node(void); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ 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 BlindedFailure. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); +uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o); /** - * Creates a new CResult_InitDecodeErrorZ in the success state. + * Checks if two BlindedFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); +bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b); /** - * Creates a new CResult_InitDecodeErrorZ in the error state. + * Frees any resources used by the FailureCode */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); +void FailureCode_free(struct LDKFailureCode this_ptr); /** - * Checks if the given object is currently in the success state + * Creates a copy of the FailureCode */ -bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); +struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InitDecodeErrorZ. + * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode */ -void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); +struct LDKFailureCode FailureCode_temporary_node_failure(void); /** - * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); +struct LDKFailureCode FailureCode_required_node_feature_missing(void); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. + * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); +struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. + * Utility method to constructs a new InvalidOnionPayload-variant FailureCode */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ -bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); +void ChannelManager_free(struct LDKChannelManager this_obj); /** - * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. + * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. */ -void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); +void ChainParameters_free(struct LDKChainParameters this_obj); /** - * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The network for determining the `chain_hash` in Lightning messages. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); +enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. + * The network for determining the `chain_hash` in Lightning messages. */ -struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o); +void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); /** - * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. + * 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 LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e); +struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o); +void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); /** - * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. + * Constructs a new ChainParameters given each field */ -void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res); +MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); /** - * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the ChainParameters */ -struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig); +struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. + * Frees any resources used by the RecentPaymentDetails */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); +void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. + * Creates a copy of the RecentPaymentDetails */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails */ -bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); +struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); /** - * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the success state. + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the error state. + * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); +void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); /** - * Checks if the given object is currently in the success state + * The list of channels to be included in the invoice route hints. */ -bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ShutdownDecodeErrorZ. + * The list of channels to be included in the invoice route hints. */ -void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); +void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); /** - * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); +uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); +void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. + * The pubkey of the real backing node that would ultimately receive the payment. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The pubkey of the real backing node that would ultimately receive the payment. */ -bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); +void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. + * Constructs a new PhantomRouteHints given each field */ -void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); +MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the PhantomRouteHints */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. + * Constructs a new `ChannelManager` to hold several channels and route between them. + * + * The current time or latest block header time can be provided as the `current_timestamp`. + * + * 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 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); +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, uint32_t current_timestamp); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. + * Gets the current configuration applied to all new channels. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * 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`. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. + * + * 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). + * + * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the + * channel. Otherwise, a random one will be generated for you. + * + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`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 temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ 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 LDKChannelId temporary_channel_id, struct LDKUserConfig override_config); /** - * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. + * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for + * more information. */ -void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. + * Gets the list of channels we have with a given counterparty, in random order. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. + * 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 */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * 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 [`ChannelCloseMinimum`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate. + * * If our counterparty is the channel initiator, we will require a channel closing + * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which + * would appear on a force-closure transaction, whichever is lower. We will allow our + * counterparty to pay as much fee as they'd like, however. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ -bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); /** - * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. + * 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 [`NonAnchorChannelFee`] + * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * * If our counterparty is the channel initiator, we will refuse to accept a channel closure + * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which + * will appear on a force-closure transaction, whichever is lower). + * + * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. + * Will fail if a shutdown script has already been set for this channel by + * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must + * also be compatible with our and the counterparty's features. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + * + * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Force closes a channel, immediately broadcasting the latest local transaction(s), + * rejecting new HTLCs. + * + * The provided `error_message` is sent to connected peers for closing + * channels and should be a human-readable description of what went wrong. + * + * Fails if `channel_id` is unknown to the manager, or if the `counterparty_node_id` + * isn't the counterparty of the corresponding channel. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKStr error_message); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. + * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting + * the latest local transaction(s). + * + * The provided `error_message` is sent to connected peers for closing channels and should + * be a human-readable description of what went wrong. + * + * 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 broadcast the latest local transaction(s) via + * [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKStr error_message); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. + * Force close all channels, immediately broadcasting the latest local commitment transaction + * for each to the chain and rejecting new HTLCs on each. + * + * The provided `error_message` is sent to connected peers for closing channels and should + * be a human-readable description of what went wrong. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); /** - * Checks if the given object is currently in the success state + * Force close all channels rejecting new HTLCs on each but without broadcasting the latest + * local transaction(s). + * + * The provided `error_message` is sent to connected peers for closing channels and + * should be a human-readable description of what went wrong. */ -bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); +void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); /** - * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. + * Sends a payment along a given route. + * + * This method is *DEPRECATED*, use [`Self::send_payment`] instead. If you wish to fix the + * route for a payment, do so by matching the [`PaymentId`] passed to + * [`Router::find_route_with_id`]. + * + * 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 as it has been + * closed, doesn't exist, or the peer is currently disconnected. + * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the + * relevant updates. + * + * 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! + * + * [`RouteHop`]: crate::routing::router::RouteHop + * [`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 */ -void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRoute route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on + * `route_params` and retry failed payment paths based on `retry_strategy`. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); +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); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. + * Signals that no further attempts for the given payment should occur. Useful if you have a + * pending outbound payment with retries remaining, but wish to stop retrying the payment before + * retries are exhausted. + * + * # Event Generation + * + * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon + * as there are no remaining pending HTLCs for this payment. + * + * 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. + * + * # Requested Invoices + * + * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning + * the payment prior to receiving the invoice will result in an [`Event::PaymentFailed`] and + * prevent any attempts at paying it once received. + * + * # Restart Behavior + * + * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. + * 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. + * + * [`send_payment`]: Self::send_payment */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * Checks if the given object is currently in the success state + * 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 */ -bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. + * 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. */ -void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Sends payment probes over all paths of a route that would be used to pay the given + * amount to the given `node_id`. + * + * See [`ChannelManager::send_preflight_probes`] for more information. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); /** - * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. + * Sends payment probes over all paths of a route that would be used to pay a route found + * according to the given [`RouteParameters`]. + * + * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting + * the actual payment. Note this is only useful if there likely is sufficient time for the + * probe to settle before sending out the actual payment, e.g., when waiting for user + * confirmation in a wallet UI. + * + * Otherwise, there is a chance the probe could take up some liquidity needed to complete the + * actual payment. Users should therefore be cautious and might avoid sending probes if + * liquidity is scarce and/or they don't expect the probe to return before they send the + * payment. To mitigate this issue, channels with available liquidity less than the required + * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight + * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); /** - * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. + * 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 */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); /** - * Checks if the given object is currently in the success state + * **Unsafe**: This method does not validate the spent output. It is the caller's + * responsibility to ensure the spent outputs are SegWit, as well as making sure the funding + * transaction has a final absolute locktime, i.e., its locktime is lower than the next block height. + * + * For a safer method, please refer to [`ChannelManager::funding_transaction_generated`]. + * + * Call this in response to a [`Event::FundingGenerationReady`] event. + * + * Note that if this method is called successfully, the funding transaction won't be + * broadcasted and you are expected to broadcast it manually when receiving the + * [`Event::FundingTxBroadcastSafe`] event. + * + * 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 funding output is duplicative with some other channel (note that this + * should be trivially prevented by using unique funding transaction keys per-channel). + * + * 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::FundingTxBroadcastSafe`]: crate::events::Event::FundingTxBroadcastSafe + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ -bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_unsafe_manual_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding); /** - * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. + * Call this upon creation of a batch funding transaction for the given channels. + * + * Return values are identical to [`Self::funding_transaction_generated`], respective to + * each individual channel and transaction output. + * + * Do NOT broadcast the funding transaction yourself. This batch funding transaction + * will only be broadcast when we have safely received and persisted the counterparty's + * signature for each channel. + * + * If there is an error, all channels in the batch are to be considered closed. */ -void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); /** - * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Atomically applies partial updates to the [`ChannelConfig`] of 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 */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); /** - * Creates a new CResult_PingDecodeErrorZ in the success state. + * 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 */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); /** - * Creates a new CResult_PingDecodeErrorZ in the error state. + * 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. See + * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount + * than expected. + * + * 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 + * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); /** - * Checks if the given object is currently in the success state + * 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 */ -bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); /** - * Frees any resources used by the CResult_PingDecodeErrorZ. + * Processes HTLCs which are pending waiting on random forward delay. + * + * Should only really ever be called in response to a PendingHTLCsForwardable event. + * Will likely generate further events. */ -void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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`]. + * * Removing peers which have disconnected but and no longer have any channels. + * * Force-closing and removing channels which have not completed establishment in a timely manner. + * * Forgetting about stale outbound payments, either those that have already been fulfilled + * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. + * The latter is determined using the system clock in `std` and the highest seen block time + * minus two hours in `no-std`. + * + * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate + * estimate fetches. + * + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelConfig`]: crate::util::config::ChannelConfig */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); +void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_PongDecodeErrorZ in the success state. + * 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. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); +void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * Creates a new CResult_PongDecodeErrorZ in the error state. + * 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. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); /** - * Checks if the given object is currently in the success state + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any + * [`MessageSendEvent`]s needed to claim the payment. + * + * 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. + * + * 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. + * + * This function will fail the payment if it has custom TLVs with even type numbers, as we + * will assume they are unknown. If you intend to accept even custom TLVs, you should use + * [`claim_funds_with_known_custom_tlvs`]. + * + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline + * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed + * [`process_pending_events`]: EventsProvider::process_pending_events + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs */ -bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); +void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Frees any resources used by the CResult_PongDecodeErrorZ. + * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with + * even type numbers. + * + * # Note + * + * You MUST check you've understood all even TLVs before using this to + * claim, otherwise you may unintentionally agree to some protocol you do not understand. + * + * [`claim_funds`]: Self::claim_funds */ -void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); +void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Gets the node_id held by this ChannelManager */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + * 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 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + * 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 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); /** - * Checks if the given object is currently in the success state + * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the + * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer's + * expiration will be `absolute_expiry` if `Some`, otherwise it will not expire. + * + * # Privacy + * + * Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the offer based on the given + * `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for + * privacy implications as well as those of the parameterized [`Router`], which implements + * [`MessageRouter`]. + * + * Also, uses a derived signing pubkey in the offer for recipient privacy. + * + * # Limitations + * + * Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s + * reply path. + * + * # Errors + * + * Errors if the parameterized [`Router`] is unable to create a blinded path for the offer. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z absolute_expiry); /** - * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the + * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the refund. + * See [Avoiding Duplicate Payments] for other requirements once the payment has been sent. + * + * The builder will have the provided expiration set. Any changes to the expiration on the + * returned builder will not be honored by [`ChannelManager`]. For `no-std`, the highest seen + * block time minus two hours is used for the current time when determining if the refund has + * expired. + * + * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail + * with an [`Event::PaymentFailed`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Privacy + * + * Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the refund based on the given + * `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for + * privacy implications as well as those of the parameterized [`Router`], which implements + * [`MessageRouter`]. + * + * Also, uses a derived payer id in the refund for payer privacy. + * + * # Limitations + * + * Requires a direct connection to an introduction node in the responding + * [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - `amount_msats` is invalid, or + * - the parameterized [`Router`] is unable to create a blinded path for the refund. + * + * [`Refund`]: crate::offers::refund::Refund + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and + * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual + * [`Bolt12Invoice`] once it is received. + * + * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by + * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. + * The optional parameters are used in the builder, if `Some`: + * - `quantity` for [`InvoiceRequest::quantity`] which must be set if + * [`Offer::expects_quantity`] is `true`. + * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and + * - `payer_note` for [`InvoiceRequest::payer_note`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`Event::PaymentFailed`]. + * + * # Privacy + * + * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] + * to construct a [`BlindedMessagePath`] for the reply path. For further privacy implications, see the + * docs of the parameterized [`Router`], which implements [`MessageRouter`]. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Offer::paths`] or to + * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding + * [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - the provided parameters are invalid for the offer, + * - the offer is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice + * request. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note + * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. + * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion + * message. + * + * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a + * [`BlindedPaymentPath`] containing the [`PaymentSecret`] needed to reconstruct the + * corresponding [`PaymentPreimage`]. It is returned purely for informational purposes. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Refund::paths`] or to + * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each + * node meeting the aforementioned criteria, but there's no guarantee that they will be + * received and no retries will be made. + * + * # Errors + * + * Errors if: + * - the refund is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for + * the invoice. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); +MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + * 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`] event, which + * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. 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::preimage`]: events::PaymentPurpose::preimage + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Checks if the given object is currently in the success state + * 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_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 */ -bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); /** - * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. + * 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 */ -void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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::sign::PhantomKeysManager */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + * Gets route hints for use in receiving [phantom node payments]. + * + * [phantom node payments]: crate::sign::PhantomKeysManager */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); +MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + * 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. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. + * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); +struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ 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 */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + * 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 LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or + * may have events that need processing. + * + * In order to check if this [`ChannelManager`] needs persisting, call + * [`Self::get_and_clear_needs_persistence`]. + * + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`ChannelManager`] and should instead register actions to be taken later. */ -bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. + * Returns true if this [`ChannelManager`] needs to be persisted. + * + * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that + * indicates this should be checked. */ -void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); +MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + * Fetches the set of [`NodeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); +MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); +MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new 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 LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); +struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. + * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKAsyncPaymentsMessageHandler ChannelManager_as_AsyncPaymentsMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is */ -bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); +struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); +struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); /** - * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); /** - * Checks if the given object is currently in the success state + * Read a BlindedForward from a byte array, created by BlindedForward_write */ -bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. + * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read */ -void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); +struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); +struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read */ -bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. + * Read a BlindedFailure from a byte array, created by BlindedFailure_write */ -void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); +struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + * A cryptographically secure source of entropy. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); +const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * A cryptographically secure source of entropy. */ -bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); +void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); /** - * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. + * A signer that is able to perform node-scoped cryptographic operations. */ -void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); +const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * A signer that is able to perform node-scoped cryptographic operations. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); +void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. + * 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. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); +const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + * 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. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); /** - * Checks if the given object is currently in the success state + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** - * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); +const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); +void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** - * Checks if the given object is currently in the success state + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); +struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); +void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); +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); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); +void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); + +struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); + +void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if the given object is currently in the success state + * Constructs a new DelayedPaymentBasepoint given each field */ -bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); /** - * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. + * Checks if two DelayedPaymentBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); +bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); /** - * 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 DelayedPaymentBasepoint */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); +struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. */ -void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); +uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. + * Get inner Public Key */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); +MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. + *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); +MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * Checks if the given object is currently in the success state + * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read */ -bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. + * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write */ -void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); +void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); + +struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); + +void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new DelayedPaymentKey given each field */ -void CVec_FutureZ_free(struct LDKCVec_FutureZ _res); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); /** - * Creates a new CResult_OffersMessageDecodeErrorZ in the success state. + * Checks if two DelayedPaymentKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o); +bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); /** - * Creates a new CResult_OffersMessageDecodeErrorZ in the error state. + * Creates a copy of the DelayedPaymentKey */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Frees any resources used by the CResult_OffersMessageDecodeErrorZ. + *Build a delayedpubkey directly from an already-derived private key */ -void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); /** - * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get inner Public Key */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); /** - * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim + * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); +struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); /** - * Constructs a new COption_HTLCClaimZ containing nothing + * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); /** - * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state + * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. */ -void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); +void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); + +struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); + +void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + * Constructs a new HtlcBasepoint given each field */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); +MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + * Checks if two HtlcBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); +bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Creates a copy of the HtlcBasepoint */ -bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); +struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. */ -void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); +uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get inner Public Key */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); +MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); /** - * Checks if the given object is currently in the success state + * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write */ -bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. */ -void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); +void HtlcKey_free(struct LDKHtlcKey this_obj); + +struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); + +void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new HtlcKey given each field */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + * Checks if two HtlcKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); +bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + * Creates a copy of the HtlcKey */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + *Build a htlcpubkey directly from an already-derived private key */ -void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get inner Public Key */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); +struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + * Read a HtlcKey from a byte array, created by HtlcKey_write */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Adds a tweak to a public key to derive a new public key. + * + * May panic if `tweak` is not the output of a SHA-256 hash. */ -bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); +struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]); /** - * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. */ -void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); + +struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); + +void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new RevocationBasepoint given each field */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + * Checks if two RevocationBasepoints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a copy of the RevocationBasepoint */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. */ -bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + * Get inner Public Key */ -void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +void RevocationKey_free(struct LDKRevocationKey this_obj); + +struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); + +void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if the given object is currently in the success state + * Constructs a new RevocationKey given each field */ -bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); /** - * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + * Checks if two RevocationKeys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); +bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the RevocationKey */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the RevocationKey. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); +uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + * Derives a per-commitment-transaction revocation public key from one party's per-commitment + * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of + * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public + * key instead of private keys. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). + * + * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Checks if the given object is currently in the success state + * Get inner Public Key */ -bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read */ -void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); +struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a RevocationKey from a byte array, created by RevocationKey_write */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + * Creates a copy of the InboundHTLCStateDetails */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_clone(const enum LDKInboundHTLCStateDetails *NONNULL_PTR orig); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant InboundHTLCStateDetails */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Committed-variant InboundHTLCStateDetails */ -bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_committed(void); /** - * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFulfill-variant InboundHTLCStateDetails */ -void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill(void); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFail-variant InboundHTLCStateDetails */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail(void); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + * Serialize the InboundHTLCStateDetails object into a byte array which can be read by InboundHTLCStateDetails_read */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +struct LDKCVec_u8Z InboundHTLCStateDetails_write(const enum LDKInboundHTLCStateDetails *NONNULL_PTR obj); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Read a InboundHTLCStateDetails from a byte array, created by InboundHTLCStateDetails_write */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ InboundHTLCStateDetails_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the InboundHTLCDetails, if is_owned is set and inner is non-NULL. */ -bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); +void InboundHTLCDetails_free(struct LDKInboundHTLCDetails this_obj); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +uint64_t InboundHTLCDetails_get_htlc_id(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +void InboundHTLCDetails_set_htlc_id(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * The amount in msat. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t InboundHTLCDetails_get_amount_msat(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The amount in msat. */ -bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +void InboundHTLCDetails_set_amount_msat(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * The block height at which this HTLC expires. */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +uint32_t InboundHTLCDetails_get_cltv_expiry(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The block height at which this HTLC expires. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +void InboundHTLCDetails_set_cltv_expiry(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * The payment hash. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +const uint8_t (*InboundHTLCDetails_get_payment_hash(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr))[32]; /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * The payment hash. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +void InboundHTLCDetails_set_payment_hash(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Checks if the given object is currently in the success state + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`InboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); +struct LDKCOption_InboundHTLCStateDetailsZ InboundHTLCDetails_get_state(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`InboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +void InboundHTLCDetails_set_state(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_InboundHTLCStateDetailsZ val); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); +bool InboundHTLCDetails_get_is_dust(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void); +void InboundHTLCDetails_set_is_dust(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * Constructs a new InboundHTLCDetails given each field */ -bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); +MUST_USE_RES struct LDKInboundHTLCDetails InboundHTLCDetails_new(uint64_t htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_InboundHTLCStateDetailsZ state_arg, bool is_dust_arg); /** - * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. + * Creates a copy of the InboundHTLCDetails */ -void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); +struct LDKInboundHTLCDetails InboundHTLCDetails_clone(const struct LDKInboundHTLCDetails *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the InboundHTLCDetails object into a byte array which can be read by InboundHTLCDetails_read */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); +struct LDKCVec_u8Z InboundHTLCDetails_write(const struct LDKInboundHTLCDetails *NONNULL_PTR obj); /** - * Constructs a new COption_usizeZ containing a usize + * Read a InboundHTLCDetails from a byte array, created by InboundHTLCDetails_write */ -struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ InboundHTLCDetails_read(struct LDKu8slice ser); /** - * Constructs a new COption_usizeZ containing nothing + * Creates a copy of the OutboundHTLCStateDetails */ -struct LDKCOption_usizeZ COption_usizeZ_none(void); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_clone(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR orig); /** - * Frees any resources associated with the usize, if we are in the Some state + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant OutboundHTLCStateDetails */ -void COption_usizeZ_free(struct LDKCOption_usizeZ _res); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); /** - * Creates a new COption_usizeZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Committed-variant OutboundHTLCStateDetails */ -struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_committed(void); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveSuccess-variant OutboundHTLCStateDetails */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success(void); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFailure-variant OutboundHTLCStateDetails */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure(void); /** - * Checks if the given object is currently in the success state + * Serialize the OutboundHTLCStateDetails object into a byte array which can be read by OutboundHTLCStateDetails_read */ -bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z OutboundHTLCStateDetails_write(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Read a OutboundHTLCStateDetails from a byte array, created by OutboundHTLCStateDetails_write */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ OutboundHTLCStateDetails_read(struct LDKu8slice ser); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the OutboundHTLCDetails, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +void OutboundHTLCDetails_free(struct LDKOutboundHTLCDetails this_obj); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. + * + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKCOption_u64Z OutboundHTLCDetails_get_htlc_id(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. + * + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +void OutboundHTLCDetails_set_htlc_id(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Checks if the given object is currently in the success state + * The amount in msat. */ -bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); +uint64_t OutboundHTLCDetails_get_amount_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * The amount in msat. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void OutboundHTLCDetails_set_amount_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The block height at which this HTLC expires. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); +uint32_t OutboundHTLCDetails_get_cltv_expiry(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. + * The block height at which this HTLC expires. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); +void OutboundHTLCDetails_set_cltv_expiry(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. + * The payment hash. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); +const uint8_t (*OutboundHTLCDetails_get_payment_hash(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr))[32]; /** - * Checks if the given object is currently in the success state + * The payment hash. */ -bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); +void OutboundHTLCDetails_set_payment_hash(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); +struct LDKCOption_OutboundHTLCStateDetailsZ OutboundHTLCDetails_get_state(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); +void OutboundHTLCDetails_set_state(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_OutboundHTLCStateDetailsZ val); /** - * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. + * The extra fee being skimmed off the top of this HTLC. */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o); +struct LDKCOption_u64Z OutboundHTLCDetails_get_skimmed_fee_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. + * The extra fee being skimmed off the top of this HTLC. */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +void OutboundHTLCDetails_set_skimmed_fee_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Checks if the given object is currently in the success state + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); +bool OutboundHTLCDetails_get_is_dust(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); +void OutboundHTLCDetails_set_is_dust(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new OutboundHTLCDetails given each field */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKOutboundHTLCDetails OutboundHTLCDetails_new(struct LDKCOption_u64Z htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_OutboundHTLCStateDetailsZ state_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, bool is_dust_arg); /** - * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure + * Creates a copy of the OutboundHTLCDetails */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); +struct LDKOutboundHTLCDetails OutboundHTLCDetails_clone(const struct LDKOutboundHTLCDetails *NONNULL_PTR orig); /** - * Constructs a new COption_PathFailureZ containing nothing + * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); +struct LDKCVec_u8Z OutboundHTLCDetails_write(const struct LDKOutboundHTLCDetails *NONNULL_PTR obj); /** - * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state + * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write */ -void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ OutboundHTLCDetails_read(struct LDKu8slice ser); /** - * Creates a new COption_PathFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); +void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. + * Base routing fee in millisatoshis. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); +uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. + * Base routing fee in millisatoshis. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); +void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if the given object is currently in the success state + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); +uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); +void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); +uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason + * 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. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); +void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new COption_ClosureReasonZ containing nothing + * Constructs a new CounterpartyForwardingInfo given each field */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); +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); /** - * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state + * Creates a copy of the CounterpartyForwardingInfo */ -void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); +struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); /** - * Creates a new COption_ClosureReasonZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); +struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); /** - * Checks if the given object is currently in the success state + * The node_id of our counterparty */ -bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); +struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + * The node_id of our counterparty */ -void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); +void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); +struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); +void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Constructs a new COption_HTLCDestinationZ containing nothing + * 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 */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); +uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); +void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new COption_HTLCDestinationZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); +struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); +void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. + * 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. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); +void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); +void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state. + * Constructs a new ChannelCounterparty given each field + * + * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o); +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); /** - * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state. + * Creates a copy of the ChannelCounterparty */ -struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read */ -bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ. + * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write */ -void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); /** - * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig); +void ChannelDetails_free(struct LDKChannelDetails this_obj); /** - * Constructs a new COption_U128Z containing a crate::c_types::U128 + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); +struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new COption_U128Z containing nothing + * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, + * thereafter this is the txid of the funding transaction xor the funding transaction output). + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -struct LDKCOption_U128Z COption_U128Z_none(void); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Frees any resources associated with the crate::c_types::U128, if we are in the Some state + * Parameters which apply to our counterparty. See individual fields for more information. */ -void COption_U128Z_free(struct LDKCOption_U128Z _res); +struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new COption_U128Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Parameters which apply to our counterparty. See individual fields for more information. */ -struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); +void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); +struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o); +void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Constructs a new COption_PaymentFailureReasonZ containing nothing + * 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 */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void); +struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state + * 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 */ -void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res); +void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig); +struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new COption_EventZ containing a crate::lightning::events::Event + * 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 */ -struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); +void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new COption_EventZ containing nothing + * 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 */ -struct LDKCOption_EventZ COption_EventZ_none(void); +struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state + * 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 */ -void COption_EventZ_free(struct LDKCOption_EventZ _res); +void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new COption_EventZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); +struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. + * 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 */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); +void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. + * The value, in satoshis, of this channel as appears in the funding output */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The value, in satoshis, of this channel as appears in the funding output */ -bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + * 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 */ -void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); +struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); +void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o); +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects + * serialized with LDK versions prior to 0.0.113. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o); +struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. + * 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. */ -void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res); +void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig); +uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. + * 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 LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o); +void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. + * 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 LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. + * 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::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ -void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res); +uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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::next_outbound_htlc_minimum_msat`], + * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. */ -struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o); +uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); +void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. + * 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 CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig); +struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig); +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. + * 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 LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c); +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. + * 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 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res); +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); +struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); +void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Checks if the given object is currently in the success state + * True if the channel was initiated (and thus funded) by us. */ -bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o); +bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. + * True if the channel was initiated (and thus funded) by us. */ -void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); +void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); +bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * 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 */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * + * Returns a copy of the field. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); /** - * Checks if the given object is currently in the success state + * 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`. */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * 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`. */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * True if this channel is (or will be) publicly-announced. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +bool ChannelDetails_get_is_announced(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. + * True if this channel is (or will be) publicly-announced. */ -struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void); +void ChannelDetails_set_is_announced(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. + * 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 */ -struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * 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 */ -bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o); +void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig); +void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. + * 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 */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o); +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. + * 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 */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Checks if the given object is currently in the success state + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o); +struct LDKCVec_InboundHTLCDetailsZ ChannelDetails_get_pending_inbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res); +void ChannelDetails_set_pending_inbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_InboundHTLCDetailsZ val); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); +struct LDKCVec_OutboundHTLCDetailsZ ChannelDetails_get_pending_outbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +void ChannelDetails_set_pending_outbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_OutboundHTLCDetailsZ val); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Constructs a new ChannelDetails given each field + * + * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKChannelId channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_announced_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg, struct LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg, struct LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg); /** - * Checks if the given object is currently in the success state + * Creates a copy of the ChannelDetails */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * 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. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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. + * + * [`Route`]: crate::routing::router::Route */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Read a ChannelDetails from a byte array, created by ChannelDetails_write */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Creates a copy of the ChannelShutdownState */ -bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); +enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); /** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. + * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); /** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. + * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Checks if two ChannelShutdownStates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); /** - * Creates a new CResult_BigSizeDecodeErrorZ in the success state. + * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); /** - * Creates a new CResult_BigSizeDecodeErrorZ in the error state. + * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e); +void ExpandedKey_free(struct LDKExpandedKey this_obj); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); /** - * Frees any resources used by the CResult_BigSizeDecodeErrorZ. + * 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::sign::PhantomKeysManager + * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material */ -void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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::sign::PhantomKeysManager */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Creates a new CResult_HostnameDecodeErrorZ in the success state. + * Frees any resources used by the DecodeError */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o); +void DecodeError_free(struct LDKDecodeError this_ptr); /** - * Creates a new CResult_HostnameDecodeErrorZ in the error state. + * Creates a copy of the DecodeError */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new UnknownVersion-variant DecodeError */ -bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o); +struct LDKDecodeError DecodeError_unknown_version(void); /** - * Frees any resources used by the CResult_HostnameDecodeErrorZ. + * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError */ -void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res); +struct LDKDecodeError DecodeError_unknown_required_feature(void); /** - * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new InvalidValue-variant DecodeError */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig); +struct LDKDecodeError DecodeError_invalid_value(void); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state. + * Utility method to constructs a new ShortRead-variant DecodeError */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_ok(struct LDKTransactionU16LenLimited o); +struct LDKDecodeError DecodeError_short_read(void); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state. + * Utility method to constructs a new BadLengthDescriptor-variant DecodeError */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_err(void); +struct LDKDecodeError DecodeError_bad_length_descriptor(void); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new Io-variant DecodeError */ -bool CResult_TransactionU16LenLimitedNoneZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR o); +struct LDKDecodeError DecodeError_io(enum LDKIOError a); /** - * Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ. + * Utility method to constructs a new UnsupportedCompression-variant DecodeError */ -void CResult_TransactionU16LenLimitedNoneZ_free(struct LDKCResult_TransactionU16LenLimitedNoneZ _res); +struct LDKDecodeError DecodeError_unsupported_compression(void); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new DangerousValue-variant DecodeError */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_clone(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR orig); +struct LDKDecodeError DecodeError_dangerous_value(void); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the DecodeError. */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_ok(struct LDKTransactionU16LenLimited o); +uint64_t DecodeError_hash(const struct LDKDecodeError *NONNULL_PTR o); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. + * Checks if two DecodeErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_err(struct LDKDecodeError e); +bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. */ -bool CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR o); +void Init_free(struct LDKInit this_obj); /** - * Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. + * The relevant features which the sender supports. */ -void CResult_TransactionU16LenLimitedDecodeErrorZ_free(struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res); +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The relevant features which the sender supports. */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_clone(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR orig); +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. + * + * Returns a copy of the field. */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o); +struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e); +void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. + * 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 CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res); +void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new Init given each field */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); /** - * Creates a new CResult_ReceiveTlvsDecodeErrorZ in the success state. + * Creates a copy of the Init */ -struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_ok(struct LDKReceiveTlvs o); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); /** - * Creates a new CResult_ReceiveTlvsDecodeErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the Init. */ -struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t Init_hash(const struct LDKInit *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_ReceiveTlvsDecodeErrorZ_is_ok(const struct LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR o); +bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); /** - * Frees any resources used by the CResult_ReceiveTlvsDecodeErrorZ. + * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. */ -void CResult_ReceiveTlvsDecodeErrorZ_free(struct LDKCResult_ReceiveTlvsDecodeErrorZ _res); +void ErrorMessage_free(struct LDKErrorMessage this_obj); /** - * Creates a new CResult_ReceiveTlvsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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. */ -struct LDKCResult_ReceiveTlvsDecodeErrorZ CResult_ReceiveTlvsDecodeErrorZ_clone(const struct LDKCResult_ReceiveTlvsDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelId ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. + * 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. */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. + * A possibly human-readable error description. + * + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * 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. */ -bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. + * Constructs a new ErrorMessage given each field */ -void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); +MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the ErrorMessage */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the ErrorMessage. */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); +uint64_t ErrorMessage_hash(const struct LDKErrorMessage *NONNULL_PTR o); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. + * 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. */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); +bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. */ -bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); +void WarningMessage_free(struct LDKWarningMessage this_obj); /** - * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); +struct LDKChannelId WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); +void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the success state. + * 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 LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); /** - * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ in the error state. + * 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 LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_err(struct LDKPaymentError e); +void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Checks if the given object is currently in the success state + * Constructs a new WarningMessage given each field */ -bool CResult_ThirtyTwoBytesPaymentErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); /** - * Frees any resources used by the CResult_ThirtyTwoBytesPaymentErrorZ. + * Creates a copy of the WarningMessage */ -void CResult_ThirtyTwoBytesPaymentErrorZ_free(struct LDKCResult_ThirtyTwoBytesPaymentErrorZ _res); +struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesPaymentErrorZ 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 WarningMessage. */ -struct LDKCResult_ThirtyTwoBytesPaymentErrorZ CResult_ThirtyTwoBytesPaymentErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentErrorZ *NONNULL_PTR orig); +uint64_t WarningMessage_hash(const struct LDKWarningMessage *NONNULL_PTR o); /** - * Creates a new CResult_NonePaymentErrorZ in the success state. + * 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. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); +bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b); /** - * Creates a new CResult_NonePaymentErrorZ in the error state. + * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); +void Ping_free(struct LDKPing this_obj); /** - * Checks if the given object is currently in the success state + * The desired response length. */ -bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_NonePaymentErrorZ. + * The desired response length. */ -void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The ping packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the success state. + * The ping packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ in the error state. + * Constructs a new Ping given each field */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_err(struct LDKProbingError e); +MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); /** - * Checks if the given object is currently in the success state + * Creates a copy of the Ping */ -bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR o); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ. + * Generates a non-cryptographic 64-bit hash of the Ping. */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ _res); +uint64_t Ping_hash(const struct LDKPing *NONNULL_PTR o); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ *NONNULL_PTR orig); +bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); /** - * Creates a new CResult_StrSecp256k1ErrorZ in the success state. + * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_ok(struct LDKStr o); +void Pong_free(struct LDKPong this_obj); /** - * Creates a new CResult_StrSecp256k1ErrorZ in the error state. + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_err(enum LDKSecp256k1Error e); +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -bool CResult_StrSecp256k1ErrorZ_is_ok(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR o); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the CResult_StrSecp256k1ErrorZ. + * Constructs a new Pong given each field */ -void CResult_StrSecp256k1ErrorZ_free(struct LDKCResult_StrSecp256k1ErrorZ _res); +MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); /** - * Creates a new CResult_StrSecp256k1ErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the Pong */ -struct LDKCResult_StrSecp256k1ErrorZ CResult_StrSecp256k1ErrorZ_clone(const struct LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR orig); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); /** - * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the Pong. */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); +uint64_t Pong_hash(const struct LDKPong *NONNULL_PTR o); /** - * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. + * 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. */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); +bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CommonOpenChannelFields, if is_owned is set and inner is non-NULL. */ -bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); +void CommonOpenChannelFields_free(struct LDKCommonOpenChannelFields this_obj); /** - * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. + * The genesis hash of the blockchain where the channel is to be opened */ -void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); +const uint8_t (*CommonOpenChannelFields_get_chain_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr))[32]; /** - * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); +void CommonOpenChannelFields_set_chain_hash(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a new CResult_OnionMessagePathNoneZ in the success state. + * A temporary channel ID + * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint + * For V1 channels: a temporary channel ID, until the funding outpoint is announced */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); +struct LDKChannelId CommonOpenChannelFields_get_temporary_channel_id(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OnionMessagePathNoneZ in the error state. + * A temporary channel ID + * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint + * For V1 channels: a temporary channel ID, until the funding outpoint is announced */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); +void CommonOpenChannelFields_set_temporary_channel_id(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Checks if the given object is currently in the success state + * For V1 channels: The channel value + * For V2 channels: Part of the channel value contributed by the channel initiator */ -bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); +uint64_t CommonOpenChannelFields_get_funding_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_OnionMessagePathNoneZ. + * For V1 channels: The channel value + * For V2 channels: Part of the channel value contributed by the channel initiator */ -void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); +void CommonOpenChannelFields_set_funding_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); +uint64_t CommonOpenChannelFields_get_dust_limit_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted */ -struct LDKC2Tuple_PublicKeyOnionMessageZ C2Tuple_PublicKeyOnionMessageZ_clone(const struct LDKC2Tuple_PublicKeyOnionMessageZ *NONNULL_PTR orig); +void CommonOpenChannelFields_set_dust_limit_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new C2Tuple_PublicKeyOnionMessageZ from the contained elements. + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -struct LDKC2Tuple_PublicKeyOnionMessageZ C2Tuple_PublicKeyOnionMessageZ_new(struct LDKPublicKey a, struct LDKOnionMessage b); +uint64_t CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C2Tuple_PublicKeyOnionMessageZ. + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -void C2Tuple_PublicKeyOnionMessageZ_free(struct LDKC2Tuple_PublicKeyOnionMessageZ _res); +void CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the success state. + * The minimum HTLC size incoming to channel initiator, in milli-satoshi */ -struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_ok(struct LDKC2Tuple_PublicKeyOnionMessageZ o); +uint64_t CommonOpenChannelFields_get_htlc_minimum_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ in the error state. + * The minimum HTLC size incoming to channel initiator, in milli-satoshi */ -struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_err(struct LDKSendError e); +void CommonOpenChannelFields_set_htlc_minimum_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -bool CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(const struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR o); +uint32_t CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ. + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -void CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res); +void CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_PeeledOnionNoneZ in the success state. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); +uint16_t CommonOpenChannelFields_get_to_self_delay(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PeeledOnionNoneZ in the error state. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); +void CommonOpenChannelFields_set_to_self_delay(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * Checks if the given object is currently in the success state + * The maximum number of inbound HTLCs towards channel initiator */ -bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); +uint16_t CommonOpenChannelFields_get_max_accepted_htlcs(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PeeledOnionNoneZ. + * The maximum number of inbound HTLCs towards channel initiator */ -void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); +void CommonOpenChannelFields_set_max_accepted_htlcs(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * The channel initiator's key controlling the funding transaction */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +struct LDKPublicKey CommonOpenChannelFields_get_funding_pubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * The channel initiator's key controlling the funding transaction */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +void CommonOpenChannelFields_set_funding_pubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if the given object is currently in the success state + * Used to derive a revocation key for transactions broadcast by counterparty */ -bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); +struct LDKPublicKey CommonOpenChannelFields_get_revocation_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * Used to derive a revocation key for transactions broadcast by counterparty */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void CommonOpenChannelFields_set_revocation_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_BlindedPathNoneZ in the success state. + * A payment key to channel initiator for transactions broadcast by counterparty */ -struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o); +struct LDKPublicKey CommonOpenChannelFields_get_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedPathNoneZ in the error state. + * A payment key to channel initiator for transactions broadcast by counterparty */ -struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void); +void CommonOpenChannelFields_set_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if the given object is currently in the success state + * Used to derive a payment key to channel initiator for transactions broadcast by channel + * initiator */ -bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o); +struct LDKPublicKey CommonOpenChannelFields_get_delayed_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_BlindedPathNoneZ. + * Used to derive a payment key to channel initiator for transactions broadcast by channel + * initiator */ -void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); +void CommonOpenChannelFields_set_delayed_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Used to derive an HTLC payment key to channel initiator */ -struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); +struct LDKPublicKey CommonOpenChannelFields_get_htlc_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the success state. + * Used to derive an HTLC payment key to channel initiator */ -struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ o); +void CommonOpenChannelFields_set_htlc_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ in the error state. + * The first to-be-broadcast-by-channel-initiator transaction's per commitment point */ -struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err(void); +struct LDKPublicKey CommonOpenChannelFields_get_first_per_commitment_point(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The first to-be-broadcast-by-channel-initiator transaction's per commitment point */ -bool CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR o); +void CommonOpenChannelFields_set_first_per_commitment_point(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ. + * The channel flags to be used */ -void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res); +uint8_t CommonOpenChannelFields_get_channel_flags(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The channel flags to be used */ -struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(const struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR orig); +void CommonOpenChannelFields_set_channel_flags(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint8_t val); /** - * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. + * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we + * collaboratively close */ -struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o); +struct LDKCOption_CVec_u8ZZ CommonOpenChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedPathDecodeErrorZ in the error state. + * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we + * collaboratively close */ -struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e); +void CommonOpenChannelFields_set_shutdown_scriptpubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Checks if the given object is currently in the success state + * The channel type that this channel will represent + * + * If this is `None`, we derive the channel type from the intersection of our + * feature bits with our counterparty's feature bits from the [`Init`] message. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o); +struct LDKChannelTypeFeatures CommonOpenChannelFields_get_channel_type(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_BlindedPathDecodeErrorZ. + * 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 */ -void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res); +void CommonOpenChannelFields_set_channel_type(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new CommonOpenChannelFields given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCommonOpenChannelFields CommonOpenChannelFields_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKChannelId temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + * Creates a copy of the CommonOpenChannelFields */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); +struct LDKCommonOpenChannelFields CommonOpenChannelFields_clone(const struct LDKCommonOpenChannelFields *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields. */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t CommonOpenChannelFields_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Checks if two CommonOpenChannelFieldss 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_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); +bool CommonOpenChannelFields_eq(const struct LDKCommonOpenChannelFields *NONNULL_PTR a, const struct LDKCommonOpenChannelFields *NONNULL_PTR b); /** - * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + * The [`ChannelParameters`] for this channel. */ -void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); +MUST_USE_RES struct LDKChannelParameters CommonOpenChannelFields_channel_parameters(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_arg); /** - * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the ChannelParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); +void ChannelParameters_free(struct LDKChannelParameters this_obj); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state. + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted. */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o); +uint64_t ChannelParameters_get_dust_limit_satoshis(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state. + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted. */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelParameters_set_dust_limit_satoshis(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o); +uint64_t ChannelParameters_get_max_htlc_value_in_flight_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ. + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res); +void ChannelParameters_set_max_htlc_value_in_flight_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig); +uint64_t ChannelParameters_get_htlc_minimum_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter + * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi */ -struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); +void ChannelParameters_set_htlc_minimum_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new COption_FilterZ containing nothing + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -struct LDKCOption_FilterZ COption_FilterZ_none(void); +uint32_t ChannelParameters_get_commitment_feerate_sat_per_1000_weight(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -void COption_FilterZ_free(struct LDKCOption_FilterZ _res); +void ChannelParameters_set_commitment_feerate_sat_per_1000_weight(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. + * The number of blocks which the non-channel-initator will have to wait to claim on-chain + * funds if they broadcast a commitment transaction. */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); +uint16_t ChannelParameters_get_to_self_delay(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. + * The number of blocks which the non-channel-initator will have to wait to claim on-chain + * funds if they broadcast a commitment transaction. */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); +void ChannelParameters_set_to_self_delay(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Checks if the given object is currently in the success state + * The maximum number of pending HTLCs towards the channel initiator. */ -bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); +uint16_t ChannelParameters_get_max_accepted_htlcs(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. + * The maximum number of pending HTLCs towards the channel initiator. */ -void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); +void ChannelParameters_set_max_accepted_htlcs(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new ChannelParameters given each field */ -void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); +MUST_USE_RES struct LDKChannelParameters ChannelParameters_new(uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a copy of the ChannelParameters */ -void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res); +struct LDKChannelParameters ChannelParameters_clone(const struct LDKChannelParameters *NONNULL_PTR orig); /** - * Creates a new tuple 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 ChannelParameters. */ -struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig); +uint64_t ChannelParameters_hash(const struct LDKChannelParameters *NONNULL_PTR o); /** - * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. + * Checks if two ChannelParameterss 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 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b); +bool ChannelParameters_eq(const struct LDKChannelParameters *NONNULL_PTR a, const struct LDKChannelParameters *NONNULL_PTR b); /** - * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. + * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. */ -void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res); +void OpenChannel_free(struct LDKOpenChannel this_obj); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Common fields of `open_channel(2)`-like messages */ -void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res); +struct LDKCommonOpenChannelFields OpenChannel_get_common_fields(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Frees any resources used by the APIError + * Common fields of `open_channel(2)`-like messages */ -void APIError_free(struct LDKAPIError this_ptr); +void OpenChannel_set_common_fields(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); /** - * Creates a copy of the APIError + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new APIMisuseError-variant APIError + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new FeeRateTooHigh-variant APIError + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new InvalidRoute-variant APIError + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKAPIError APIError_invalid_route(struct LDKStr err); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new ChannelUnavailable-variant APIError + * Constructs a new OpenChannel given each field */ -struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); +MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKCommonOpenChannelFields common_fields_arg, uint64_t push_msat_arg, uint64_t channel_reserve_satoshis_arg); /** - * Utility method to constructs a new MonitorUpdateInProgress-variant APIError + * Creates a copy of the OpenChannel */ -struct LDKAPIError APIError_monitor_update_in_progress(void); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); /** - * Utility method to constructs a new IncompatibleShutdownScript-variant APIError + * Generates a non-cryptographic 64-bit hash of the OpenChannel. */ -struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); +uint64_t OpenChannel_hash(const struct LDKOpenChannel *NONNULL_PTR o); /** - * Checks if two APIErrors contain equal inner contents. + * 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. */ -bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); +bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); /** - * Serialize the APIError object into a byte array which can be read by APIError_read + * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); +void OpenChannelV2_free(struct LDKOpenChannelV2 this_obj); /** - * Read a APIError from a byte array, created by APIError_write + * Common fields of `open_channel(2)`-like messages */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); +struct LDKCommonOpenChannelFields OpenChannelV2_get_common_fields(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. + * Common fields of `open_channel(2)`-like messages */ -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 OpenChannelV2_set_common_fields(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); /** - * Constructs a new BigSize given each field + * The feerate for the funding transaction set by the channel initiator */ -MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); +uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Creates a copy of the BigSize + * The feerate for the funding transaction set by the channel initiator */ -struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig); +void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the BigSize. + * The locktime for the funding transaction */ -uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o); +uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Checks if two BigSizes 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 locktime for the funding transaction */ -bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b); +void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the BigSize object into a byte array which can be read by BigSize_read + * The second to-be-broadcast-by-channel-initiator transaction's per commitment point */ -struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj); +struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Read a BigSize from a byte array, created by BigSize_write + * The second to-be-broadcast-by-channel-initiator transaction's per commitment point */ -struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser); +void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. + * Optionally, a requirement that only confirmed inputs can be added */ -void Hostname_free(struct LDKHostname this_obj); +enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Creates a copy of the Hostname + * Optionally, a requirement that only confirmed inputs can be added */ -struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); +void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ 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. + * Constructs a new OpenChannelV2 given each field */ -bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); +MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKCommonOpenChannelFields common_fields_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t locktime_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * Returns the length of the hostname. + * Creates a copy of the OpenChannelV2 */ -MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); +struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig); /** - * Serialize the Hostname object into a byte array which can be read by Hostname_read + * Generates a non-cryptographic 64-bit hash of the OpenChannelV2. */ -struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj); +uint64_t OpenChannelV2_hash(const struct LDKOpenChannelV2 *NONNULL_PTR o); /** - * Read a Hostname from a byte array, created by Hostname_write + * Checks if two OpenChannelV2s 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_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser); +bool OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b); /** - * Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL. + * Frees any resources used by the CommonAcceptChannelFields, if is_owned is set and inner is non-NULL. */ -void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj); +void CommonAcceptChannelFields_free(struct LDKCommonAcceptChannelFields this_obj); /** - * Creates a copy of the TransactionU16LenLimited + * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. */ -struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig); +struct LDKChannelId CommonAcceptChannelFields_get_temporary_channel_id(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Checks if two TransactionU16LenLimiteds 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 same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. */ -bool TransactionU16LenLimited_eq(const struct LDKTransactionU16LenLimited *NONNULL_PTR a, const struct LDKTransactionU16LenLimited *NONNULL_PTR b); +void CommonAcceptChannelFields_set_temporary_channel_id(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus- - * serialized length is <= u16::MAX. + * The threshold below which outputs on transactions broadcast by the channel acceptor will be + * omitted */ -MUST_USE_RES struct LDKCResult_TransactionU16LenLimitedNoneZ TransactionU16LenLimited_new(struct LDKTransaction transaction); +uint64_t CommonAcceptChannelFields_get_dust_limit_satoshis(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. + * The threshold below which outputs on transactions broadcast by the channel acceptor will be + * omitted */ -MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_into_transaction(struct LDKTransactionU16LenLimited this_arg); +void CommonAcceptChannelFields_set_dust_limit_satoshis(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -struct LDKCVec_u8Z TransactionU16LenLimited_write(const struct LDKTransactionU16LenLimited *NONNULL_PTR obj); +uint64_t CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_read(struct LDKu8slice ser); +void CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t 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. + * The minimum HTLC size incoming to channel acceptor, in milli-satoshi */ -struct LDKCResult_StrSecp256k1ErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +uint64_t CommonAcceptChannelFields_get_htlc_minimum_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Recovers the PublicKey of the signer of the message given the message and the signature. + * The minimum HTLC size incoming to channel acceptor, in milli-satoshi */ -struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +void CommonAcceptChannelFields_set_htlc_minimum_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, - * and the PublicKey. + * Minimum depth of the funding transaction before the channel is considered open */ -bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); +uint32_t CommonAcceptChannelFields_get_minimum_depth(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Construct the invoice's HRP and signatureless data into a preimage to be hashed. + * Minimum depth of the funding transaction before the channel is considered open */ -struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z data_without_signature); +void CommonAcceptChannelFields_set_minimum_depth(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint32_t val); /** - * Calls the free function if one is set + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -void KVStore_free(struct LDKKVStore this_ptr); +uint16_t CommonAcceptChannelFields_get_to_self_delay(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -void Persister_free(struct LDKPersister this_ptr); +void CommonAcceptChannelFields_set_to_self_delay(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * Read previously persisted [`ChannelMonitor`]s from the store. + * The maximum number of inbound HTLCs towards channel acceptor */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); +uint16_t CommonAcceptChannelFields_get_max_accepted_htlcs(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. + * The maximum number of inbound HTLCs towards channel acceptor */ -void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); +void CommonAcceptChannelFields_set_max_accepted_htlcs(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new [`MonitorUpdatingPersister`]. - * - * The `maximum_pending_updates` parameter controls how many updates may be stored before a - * [`MonitorUpdatingPersister`] consolidates updates by writing a full monitor. Note that - * consolidation will frequently occur with fewer updates than what you set here; this number - * is merely the maximum that may be stored. When setting this value, consider that for higher - * values of `maximum_pending_updates`: - * - * - [`MonitorUpdatingPersister`] will tend to write more [`ChannelMonitorUpdate`]s than - * [`ChannelMonitor`]s, approaching one [`ChannelMonitor`] write for every - * `maximum_pending_updates` [`ChannelMonitorUpdate`]s. - * - [`MonitorUpdatingPersister`] will issue deletes differently. Lazy deletes will come in - * \"waves\" for each [`ChannelMonitor`] write. A larger `maximum_pending_updates` means bigger, - * less frequent \"waves.\" - * - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run - * [`MonitorUpdatingPersister::cleanup_stale_updates`]. + * The channel acceptor's key controlling the funding transaction */ -MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStore kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); +struct LDKPublicKey CommonAcceptChannelFields_get_funding_pubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Reads all stored channel monitors, along with any stored updates for them. - * - * It is extremely important that your [`KVStore::read`] implementation uses the - * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the - * documentation for [`MonitorUpdatingPersister`]. + * The channel acceptor's key controlling the funding transaction */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator); +void CommonAcceptChannelFields_set_funding_pubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a single channel monitor, along with any stored updates for it. - * - * It is extremely important that your [`KVStore::read`] implementation uses the - * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the - * documentation for [`MonitorUpdatingPersister`]. - * - * For `monitor_key`, channel storage keys be the channel's transaction ID and index, or - * [`OutPoint`], with an underscore `_` between them. For example, given: - * - * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` - * - Index: `1` - * - * The correct `monitor_key` would be: - * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` - * - * Loading a large number of monitors will be faster if done in parallel. You can use this - * function to accomplish this. Take care to limit the number of parallel readers. + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, struct LDKStr monitor_key); +struct LDKPublicKey CommonAcceptChannelFields_get_revocation_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Cleans up stale updates for all monitors. - * - * This function works by first listing all monitors, and then for each of them, listing all - * updates. The updates that have an `update_id` less than or equal to than the stored monitor - * are deleted. The deletion can either be lazy or non-lazy based on the `lazy` flag; this will - * be passed to [`KVStore::remove`]. + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); +void CommonAcceptChannelFields_set_revocation_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new Persist which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is + * A payment key to channel acceptor for transactions broadcast by counterparty */ -struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); +struct LDKPublicKey CommonAcceptChannelFields_get_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. + * A payment key to channel acceptor for transactions broadcast by counterparty */ -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); +void CommonAcceptChannelFields_set_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new UntrustedString given each field + * Used to derive a payment key to channel acceptor for transactions broadcast by channel + * acceptor */ -MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg); +struct LDKPublicKey CommonAcceptChannelFields_get_delayed_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Creates a copy of the UntrustedString + * Used to derive a payment key to channel acceptor for transactions broadcast by channel + * acceptor */ -struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig); +void CommonAcceptChannelFields_set_delayed_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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. + * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty */ -bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); +struct LDKPublicKey CommonAcceptChannelFields_get_htlc_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read + * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty */ -struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj); +void CommonAcceptChannelFields_set_htlc_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a UntrustedString from a byte array, created by UntrustedString_write + * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); +struct LDKPublicKey CommonAcceptChannelFields_get_first_per_commitment_point(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. + * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -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 CommonAcceptChannelFields_set_first_per_commitment_point(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new PrintableString given each field + * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we + * collaboratively close */ -MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); +struct LDKCOption_CVec_u8ZZ CommonAcceptChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we + * collaboratively close */ -void FutureCallback_free(struct LDKFutureCallback this_ptr); +void CommonAcceptChannelFields_set_shutdown_scriptpubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. + * The channel type that this channel will represent. If none is set, we derive the channel + * type from the intersection of our feature bits with our counterparty's feature bits from + * the Init message. + * + * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s + * [`CommonOpenChannelFields::channel_type`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Future_free(struct LDKFuture this_obj); +struct LDKChannelTypeFeatures CommonAcceptChannelFields_get_channel_type(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Creates a copy of the Future + * 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`] or [`OpenChannelV2`]'s + * [`CommonOpenChannelFields::channel_type`]. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKFuture Future_clone(const struct LDKFuture *NONNULL_PTR orig); +void CommonAcceptChannelFields_set_channel_type(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Registers a callback to be called upon completion of this future. If the future has already - * completed, the callback will be called immediately. + * Constructs a new CommonAcceptChannelFields given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); +MUST_USE_RES struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_new(struct LDKChannelId temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** - * Waits until this [`Future`] completes. + * Creates a copy of the CommonAcceptChannelFields */ -void Future_wait(struct LDKFuture this_arg); +struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_clone(const struct LDKCommonAcceptChannelFields *NONNULL_PTR orig); /** - * Waits until this [`Future`] completes or the given amount of time has elapsed. - * - * Returns true if the [`Future`] completed, false if the time elapsed. + * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields. */ -MUST_USE_RES bool Future_wait_timeout(struct LDKFuture this_arg, uint64_t max_wait); +uint64_t CommonAcceptChannelFields_hash(const struct LDKCommonAcceptChannelFields *NONNULL_PTR o); /** - * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL. + * Checks if two CommonAcceptChannelFieldss 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 Sleeper_free(struct LDKSleeper this_obj); +bool CommonAcceptChannelFields_eq(const struct LDKCommonAcceptChannelFields *NONNULL_PTR a, const struct LDKCommonAcceptChannelFields *NONNULL_PTR b); /** - * Constructs a new sleeper from one future, allowing blocking on it. + * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(struct LDKFuture future); +void AcceptChannel_free(struct LDKAcceptChannel this_obj); /** - * Constructs a new sleeper from two futures, allowing blocking on both at once. + * Common fields of `accept_channel(2)`-like messages */ -MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(struct LDKFuture fut_a, struct LDKFuture fut_b); +struct LDKCommonAcceptChannelFields AcceptChannel_get_common_fields(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Constructs a new sleeper on many futures, allowing blocking on all at once. + * Common fields of `accept_channel(2)`-like messages */ -MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures); +void AcceptChannel_set_common_fields(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); /** - * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * 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. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the Level + * Constructs a new AcceptChannel given each field */ -enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); +MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t channel_reserve_satoshis_arg); /** - * Utility method to constructs a new Gossip-variant Level + * Creates a copy of the AcceptChannel */ -enum LDKLevel Level_gossip(void); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); /** - * Utility method to constructs a new Trace-variant Level + * Generates a non-cryptographic 64-bit hash of the AcceptChannel. */ -enum LDKLevel Level_trace(void); +uint64_t AcceptChannel_hash(const struct LDKAcceptChannel *NONNULL_PTR o); /** - * Utility method to constructs a new Debug-variant Level + * 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. */ -enum LDKLevel Level_debug(void); +bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); /** - * Utility method to constructs a new Info-variant Level + * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL. */ -enum LDKLevel Level_info(void); +void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj); /** - * Utility method to constructs a new Warn-variant Level + * Common fields of `accept_channel(2)`-like messages */ -enum LDKLevel Level_warn(void); +struct LDKCommonAcceptChannelFields AcceptChannelV2_get_common_fields(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Error-variant Level + * Common fields of `accept_channel(2)`-like messages */ -enum LDKLevel Level_error(void); +void AcceptChannelV2_set_common_fields(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); /** - * Checks if two Levels contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Part of the channel value contributed by the channel acceptor */ -bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); +uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the Level. + * Part of the channel value contributed by the channel acceptor */ -uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); +void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns the most verbose logging level. + * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -MUST_USE_RES enum LDKLevel Level_max(void); +struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. + * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -void Record_free(struct LDKRecord this_obj); +void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The verbosity level of the message. + * Optionally, a requirement that only confirmed inputs can be added */ -enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); +enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * The verbosity level of the message. + * Optionally, a requirement that only confirmed inputs can be added */ -void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); +void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * The message body. + * Constructs a new AcceptChannelV2 given each field */ -struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t funding_satoshis_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * The message body. + * Creates a copy of the AcceptChannelV2 */ -void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig); /** - * The module path of the message. + * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2. */ -struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); +uint64_t AcceptChannelV2_hash(const struct LDKAcceptChannelV2 *NONNULL_PTR o); /** - * The module path of the message. + * Checks if two AcceptChannelV2s 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 Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b); /** - * The source file containing the message. + * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. */ -struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); +void FundingCreated_free(struct LDKFundingCreated this_obj); /** - * The source file containing the message. + * A temporary channel ID, until the funding is established */ -void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKChannelId FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * The line containing the message. + * A temporary channel ID, until the funding is established */ -uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The line containing the message. + * The funding transaction ID */ -void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the Record + * The funding transaction ID */ -struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Calls the free function if one is set + * The specific output index funding this channel */ -void Logger_free(struct LDKLogger this_ptr); +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. + * The specific output index funding this channel */ -void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); /** - * 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 + * The signature of the channel initiator (funder) on the initial commitment transaction */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the - * equivalent limit applied to outbound channels). - * - * 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 + * The signature of the channel initiator (funder) on the initial commitment transaction */ -void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less. + * Constructs a new FundingCreated given each field */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKChannelId temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_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. + * Creates a copy of the FundingCreated */ -void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); /** - * 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. + * Generates a non-cryptographic 64-bit hash of the FundingCreated. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint64_t FundingCreated_hash(const struct LDKFundingCreated *NONNULL_PTR o); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required - * by the protocol. + * 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. */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); +bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. */ -uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +void FundingSigned_free(struct LDKFundingSigned this_obj); /** - * 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. + * The channel ID */ -void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); +struct LDKChannelId FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * 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 + * The channel ID */ -bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * 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 + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: false. + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: false. + * Constructs a new FundingSigned given each field */ -void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg); /** - * 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::sign::SignerProvider::get_shutdown_scriptpubkey + * Creates a copy of the FundingSigned */ -bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. - * - * Default value: true. - * - * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey + * Generates a non-cryptographic 64-bit hash of the FundingSigned. */ -void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +uint64_t FundingSigned_hash(const struct LDKFundingSigned *NONNULL_PTR o); /** - * 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. + * 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. */ -uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. */ -void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +void ChannelReady_free(struct LDKChannelReady this_obj); /** - * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future - * channels. This feature requires having a reserve of onchain funds readily available to bump - * transactions in the event of a channel force close to avoid the possibility of losing funds. - * - * Note that if you wish accept inbound channels with anchor outputs, you must enable - * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with - * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check - * whether your reserve of onchain funds is enough to cover the fees for all existing and new - * channels featuring anchor outputs in the event of a force close. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.116, 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 `anchors_zero_fee_htlc_tx` option; we will simply - * fall back to a `static_remote_key` channel. - * - * LDK will not support the legacy `option_anchors` commitment version due to a discovered - * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee - * Considered Harmful`] mailing list post. - * - * Default value: false. This value is likely to change to true in the future. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue - * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html + * The channel ID */ -bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKChannelId ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future - * channels. This feature requires having a reserve of onchain funds readily available to bump - * transactions in the event of a channel force close to avoid the possibility of losing funds. - * - * Note that if you wish accept inbound channels with anchor outputs, you must enable - * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with - * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check - * whether your reserve of onchain funds is enough to cover the fees for all existing and new - * channels featuring anchor outputs in the event of a force close. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.116, 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 `anchors_zero_fee_htlc_tx` option; we will simply - * fall back to a `static_remote_key` channel. - * - * LDK will not support the legacy `option_anchors` commitment version due to a discovered - * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee - * Considered Harmful`] mailing list post. - * - * Default value: false. This value is likely to change to true in the future. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue - * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html + * The channel ID */ -void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * 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`. + * The per-commitment point of the second commitment transaction */ -uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * 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`. + * The per-commitment point of the second commitment transaction */ -void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new ChannelHandshakeConfig given each field + * 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. */ -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, bool negotiate_anchors_zero_fee_htlc_tx_arg, uint16_t our_max_accepted_htlcs_arg); +struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelHandshakeConfig + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); +void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. + * Constructs a new ChannelReady given each field */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); +MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKChannelId channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); /** - * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelReady */ -void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); +struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *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. + * Generates a non-cryptographic 64-bit hash of the ChannelReady. */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +uint64_t ChannelReady_hash(const struct LDKChannelReady *NONNULL_PTR o); /** - * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: 0. + * 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. */ -void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void Stfu_free(struct LDKStfu this_obj); /** - * 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. + * The channel ID where quiescence is intended */ -void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +struct LDKChannelId Stfu_get_channel_id(const struct LDKStfu *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. + * The channel ID where quiescence is intended */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void Stfu_set_channel_id(struct LDKStfu *NONNULL_PTR this_ptr, struct LDKChannelId 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. + * Initiator flag, 1 if initiating, 0 if replying to an stfu. */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +uint8_t Stfu_get_initiator(const struct LDKStfu *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. + * Initiator flag, 1 if initiating, 0 if replying to an stfu. */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void Stfu_set_initiator(struct LDKStfu *NONNULL_PTR this_ptr, uint8_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 Stfu 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 LDKStfu Stfu_new(struct LDKChannelId channel_id_arg, uint8_t initiator_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 Stfu */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +struct LDKStfu Stfu_clone(const struct LDKStfu *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. + * Checks if two Stfus contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +bool Stfu_eq(const struct LDKStfu *NONNULL_PTR a, const struct LDKStfu *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the SpliceInit, if is_owned is set and inner is non-NULL. */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void SpliceInit_free(struct LDKSpliceInit 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 channel ID where splicing is intended */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +struct LDKChannelId SpliceInit_get_channel_id(const struct LDKSpliceInit *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 channel ID where splicing is intended */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void SpliceInit_set_channel_id(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKChannelId 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 amount the splice initiator is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); +int64_t SpliceInit_get_funding_contribution_satoshis(const struct LDKSpliceInit *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. - * - * 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 + * The amount the splice initiator is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void SpliceInit_set_funding_contribution_satoshis(struct LDKSpliceInit *NONNULL_PTR this_ptr, int64_t 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. - * - * 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 + * The feerate for the new funding transaction, set by the splice initiator */ -void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +uint32_t SpliceInit_get_funding_feerate_perkw(const struct LDKSpliceInit *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. - * - * Default value: true. + * The feerate for the new funding transaction, set by the splice initiator */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void SpliceInit_set_funding_feerate_perkw(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_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. - * - * Default value: true. + * The locktime for the new funding transaction */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +uint32_t SpliceInit_get_locktime(const struct LDKSpliceInit *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 locktime for the new funding transaction */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void SpliceInit_set_locktime(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_t 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 key of the sender (splice initiator) controlling the new funding transaction */ -void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +struct LDKPublicKey SpliceInit_get_funding_pubkey(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelHandshakeLimits given each field + * The key of the sender (splice initiator) controlling the new funding transaction */ -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); +void SpliceInit_set_funding_pubkey(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the ChannelHandshakeLimits + * If set, only confirmed inputs added (by the splice acceptor) will be accepted */ -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); +enum LDKCOption_NoneZ SpliceInit_get_require_confirmed_inputs(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. + * If set, only confirmed inputs added (by the splice acceptor) will be accepted */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); +void SpliceInit_set_require_confirmed_inputs(struct LDKSpliceInit *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Frees any resources used by the MaxDustHTLCExposure + * Constructs a new SpliceInit given each field */ -void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr); +MUST_USE_RES struct LDKSpliceInit SpliceInit_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, uint32_t funding_feerate_perkw_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * Creates a copy of the MaxDustHTLCExposure + * Creates a copy of the SpliceInit */ -struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig); +struct LDKSpliceInit SpliceInit_clone(const struct LDKSpliceInit *NONNULL_PTR orig); /** - * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure + * Checks if two SpliceInits 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 LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a); +bool SpliceInit_eq(const struct LDKSpliceInit *NONNULL_PTR a, const struct LDKSpliceInit *NONNULL_PTR b); /** - * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure + * Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL. */ -struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a); +void SpliceAck_free(struct LDKSpliceAck this_obj); /** - * Checks if two MaxDustHTLCExposures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The channel ID where splicing is intended */ -bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b); +struct LDKChannelId SpliceAck_get_channel_id(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read + * The channel ID where splicing is intended */ -struct LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj); +void SpliceAck_set_channel_id(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write + * The amount the splice acceptor is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser); +int64_t SpliceAck_get_funding_contribution_satoshis(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. + * The amount the splice acceptor is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -void ChannelConfig_free(struct LDKChannelConfig this_obj); +void SpliceAck_set_funding_contribution_satoshis(struct LDKSpliceAck *NONNULL_PTR this_ptr, int64_t val); /** - * 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 key of the sender (splice acceptor) controlling the new funding transaction */ -uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKPublicKey SpliceAck_get_funding_pubkey(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * Default value: 0. + * The key of the sender (splice acceptor) controlling the new funding transaction */ -void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +void SpliceAck_set_funding_pubkey(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: 1000. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * If set, only confirmed inputs added (by the splice initiator) will be accepted */ -uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +enum LDKCOption_NoneZ SpliceAck_get_require_confirmed_inputs(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: 1000. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * If set, only confirmed inputs added (by the splice initiator) will be accepted */ -void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +void SpliceAck_set_require_confirmed_inputs(struct LDKSpliceAck *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * Constructs a new SpliceAck given each field */ -uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKSpliceAck SpliceAck_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: 72 (12 hours at an average of 6 blocks/hour). - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead. - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * Creates a copy of the SpliceAck */ -void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); +struct LDKSpliceAck SpliceAck_clone(const struct LDKSpliceAck *NONNULL_PTR orig); /** - * 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. Because of this, you may want to set this - * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier - * variant is primarily intended for use with pre-anchor channels. - * - * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. - * - * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000. + * Checks if two SpliceAcks contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +bool SpliceAck_eq(const struct LDKSpliceAck *NONNULL_PTR a, const struct LDKSpliceAck *NONNULL_PTR b); /** - * 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. Because of this, you may want to set this - * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier - * variant is primarily intended for use with pre-anchor channels. - * - * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. - * - * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of 5000. + * Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL. */ -void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val); +void SpliceLocked_free(struct LDKSpliceLocked this_obj); /** - * 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 [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. - * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. - * - * Default value: 1000 satoshis. - * - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * The channel ID */ -uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKChannelId SpliceLocked_get_channel_id(const struct LDKSpliceLocked *NONNULL_PTR this_ptr); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. - * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. - * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. - * - * Default value: 1000 satoshis. - * - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * The channel ID */ -void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +void SpliceLocked_set_channel_id(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * If set, allows this channel's counterparty to skim an additional fee off this node's inbound - * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. - * - * Usage: - * - The payee will set this option and set its invoice route hints to use [intercept scids] - * generated by this channel's counterparty. - * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call - * [`forward_intercepted_htlc`] with less than the amount provided in - * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. - * - * # Note - * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is - * as-expected if this feature is activated, otherwise they may lose money! - * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the - * counterparty. - * - * # Note - * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. - * Unsetting this flag between restarts may lead to payment receive failures. - * - * Default value: false. - * - * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc - * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat - * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat + * The ID of the new funding transaction that has been locked */ -bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +const uint8_t (*SpliceLocked_get_splice_txid(const struct LDKSpliceLocked *NONNULL_PTR this_ptr))[32]; /** - * If set, allows this channel's counterparty to skim an additional fee off this node's inbound - * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. - * - * Usage: - * - The payee will set this option and set its invoice route hints to use [intercept scids] - * generated by this channel's counterparty. - * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call - * [`forward_intercepted_htlc`] with less than the amount provided in - * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. - * - * # Note - * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is - * as-expected if this feature is activated, otherwise they may lose money! - * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the - * counterparty. - * - * # Note - * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. - * Unsetting this flag between restarts may lead to payment receive failures. - * - * Default value: false. - * - * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc - * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat - * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat + * The ID of the new funding transaction that has been locked */ -void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); +void SpliceLocked_set_splice_txid(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new ChannelConfig given each field + * Constructs a new SpliceLocked given each field */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, struct LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg); +MUST_USE_RES struct LDKSpliceLocked SpliceLocked_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes splice_txid_arg); /** - * Creates a copy of the ChannelConfig + * Creates a copy of the SpliceLocked */ -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); +struct LDKSpliceLocked SpliceLocked_clone(const struct LDKSpliceLocked *NONNULL_PTR orig); /** - * Checks if two ChannelConfigs contain equal inner contents. + * Checks if two SpliceLockeds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); +bool SpliceLocked_eq(const struct LDKSpliceLocked *NONNULL_PTR a, const struct LDKSpliceLocked *NONNULL_PTR b); /** - * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`]. + * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL. */ -void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update); +void TxAddInput_free(struct LDKTxAddInput this_obj); /** - * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. + * The channel ID */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); +struct LDKChannelId TxAddInput_get_channel_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read + * The channel ID */ -struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); +void TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a ChannelConfig from a byte array, created by ChannelConfig_write + * A randomly chosen unique identifier for this input, which is even for initiators and odd for + * non-initiators. */ -struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); +uint64_t TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelConfigUpdate, if is_owned is set and inner is non-NULL. + * A randomly chosen unique identifier for this input, which is even for initiators and odd for + * non-initiators. */ -void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj); - -struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); - -void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); - -struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +void TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val); -void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +/** + * Serialized transaction that contains the output this input spends to verify that it is non + * malleable. + */ +struct LDKTransactionU16LenLimited TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr); -struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +/** + * Serialized transaction that contains the output this input spends to verify that it is non + * malleable. + */ +void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKTransactionU16LenLimited val); -void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +/** + * The index of the output being spent + */ +uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * - * Returns a copy of the field. + * The index of the output being spent */ -struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +void TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); -void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val); +/** + * The sequence number of this input + */ +uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr); -struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +/** + * The sequence number of this input + */ +void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); -void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +/** + * The ID of the previous funding transaction, when it is being added as an input during splicing + */ +struct LDKCOption_ThirtyTwoBytesZ TxAddInput_get_shared_input_txid(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelConfigUpdate given each field + * The ID of the previous funding transaction, when it is being added as an input during splicing */ -MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_new(struct LDKCOption_u32Z forwarding_fee_proportional_millionths_arg, struct LDKCOption_u32Z forwarding_fee_base_msat_arg, struct LDKCOption_u16Z cltv_expiry_delta_arg, struct LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, struct LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg); +void TxAddInput_set_shared_input_txid(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Creates a "default" ChannelConfigUpdate. See struct and individual field documentaiton for details on which values are used. + * Constructs a new TxAddInput given each field */ -MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_default(void); +MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, struct LDKTransactionU16LenLimited prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg, struct LDKCOption_ThirtyTwoBytesZ shared_input_txid_arg); /** - * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. + * Creates a copy of the TxAddInput */ -void UserConfig_free(struct LDKUserConfig this_obj); +struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig); /** - * Channel handshake config that we propose to our counterparty. + * Generates a non-cryptographic 64-bit hash of the TxAddInput. */ -struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +uint64_t TxAddInput_hash(const struct LDKTxAddInput *NONNULL_PTR o); /** - * Channel handshake config that we propose to our counterparty. + * Checks if two TxAddInputs 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 UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL. */ -struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void TxAddOutput_free(struct LDKTxAddOutput this_obj); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * The channel ID */ -void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +struct LDKChannelId TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * Channel config which affects behavior during channel lifetime. + * The channel ID */ -struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Channel config which affects behavior during channel lifetime. + * A randomly chosen unique identifier for this output, which is even for initiators and odd for + * non-initiators. */ -void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *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. - * - * Default value: false. + * A randomly chosen unique identifier for this output, which is even for initiators and odd for + * non-initiators. */ -bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t 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. - * - * Default value: false. + * The satoshi value of the output */ -void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * If this is set to false, we do not accept inbound requests to open a new channel. - * Default value: true. + * The satoshi value of the output */ -bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); /** - * If this is set to false, we do not accept inbound requests to open a new channel. - * Default value: true. + * The scriptPubKey for the output */ -void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +struct LDKCVec_u8Z TxAddOutput_get_script(const struct LDKTxAddOutput *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. - * - * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * The scriptPubKey for the output */ -bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z 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. - * - * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * Constructs a new TxAddOutput given each field */ -void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg); /** - * 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 + * Creates a copy of the TxAddOutput */ -bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig); /** - * 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 + * Generates a non-cryptographic 64-bit hash of the TxAddOutput. */ -void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +uint64_t TxAddOutput_hash(const struct LDKTxAddOutput *NONNULL_PTR o); /** - * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple - * parts. If this is set to true, we'll accept the payment. - * - * Setting this to true will break backwards compatibility upon downgrading to an LDK - * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP - * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. - * - * Default value: false. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Checks if two TxAddOutputs 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 UserConfig_get_accept_mpp_keysend(const struct LDKUserConfig *NONNULL_PTR this_ptr); +bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b); /** - * If this is set to false, when receiving a keysend payment we'll fail it if it has multiple - * parts. If this is set to true, we'll accept the payment. - * - * Setting this to true will break backwards compatibility upon downgrading to an LDK - * version < 0.0.116 while receiving an MPP keysend. If we have already received an MPP - * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. - * - * Default value: false. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL. */ -void UserConfig_set_accept_mpp_keysend(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void TxRemoveInput_free(struct LDKTxRemoveInput this_obj); /** - * Constructs a new UserConfig given each field + * The channel ID */ -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 accept_mpp_keysend_arg); +struct LDKChannelId TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); /** - * Creates a copy of the UserConfig + * The channel ID */ -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); +void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + * The serial ID of the input to be removed */ -MUST_USE_RES struct LDKUserConfig UserConfig_default(void); +uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. + * The serial ID of the input to be removed */ -void BestBlock_free(struct LDKBestBlock this_obj); +void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the BestBlock + * Constructs a new TxRemoveInput given each field */ -struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig); +MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); /** - * 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. + * Creates a copy of the TxRemoveInput */ -bool BestBlock_eq(const struct LDKBestBlock *NONNULL_PTR a, const struct LDKBestBlock *NONNULL_PTR b); +struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig); /** - * Constructs a `BestBlock` that represents the genesis block at height 0 of the given - * network. + * Generates a non-cryptographic 64-bit hash of the TxRemoveInput. */ -MUST_USE_RES struct LDKBestBlock BestBlock_from_network(enum LDKNetwork network); +uint64_t TxRemoveInput_hash(const struct LDKTxRemoveInput *NONNULL_PTR o); /** - * Returns a `BestBlock` as identified by the given block hash and height. + * Checks if two TxRemoveInputs 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 LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height); +bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b); /** - * Returns the best block hash. + * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg); +void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj); /** - * Returns the best block height. + * The channel ID */ -MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg); +struct LDKChannelId TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The channel ID */ -void Listen_free(struct LDKListen this_ptr); +void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Calls the free function if one is set + * The serial ID of the output to be removed */ -void Confirm_free(struct LDKConfirm this_ptr); +uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelMonitorUpdateStatus + * The serial ID of the output to be removed */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_clone(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR orig); +void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new Completed-variant ChannelMonitorUpdateStatus + * Constructs a new TxRemoveOutput given each field */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_completed(void); +MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); /** - * Utility method to constructs a new InProgress-variant ChannelMonitorUpdateStatus + * Creates a copy of the TxRemoveOutput */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_in_progress(void); +struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig); /** - * Utility method to constructs a new UnrecoverableError-variant ChannelMonitorUpdateStatus + * Generates a non-cryptographic 64-bit hash of the TxRemoveOutput. */ -enum LDKChannelMonitorUpdateStatus ChannelMonitorUpdateStatus_unrecoverable_error(void); +uint64_t TxRemoveOutput_hash(const struct LDKTxRemoveOutput *NONNULL_PTR o); /** - * Checks if two ChannelMonitorUpdateStatuss contain equal inner contents. + * Checks if two TxRemoveOutputs 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 ChannelMonitorUpdateStatus_eq(const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR a, const enum LDKChannelMonitorUpdateStatus *NONNULL_PTR b); +bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b); /** - * Calls the free function if one is set + * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL. */ -void Watch_free(struct LDKWatch this_ptr); +void TxComplete_free(struct LDKTxComplete this_obj); /** - * Calls the free function if one is set + * The channel ID */ -void Filter_free(struct LDKFilter this_ptr); +struct LDKChannelId TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr); /** - * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL. + * The channel ID */ -void WatchedOutput_free(struct LDKWatchedOutput this_obj); +void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * First block where the transaction output may have been spent. + * Constructs a new TxComplete given each field */ -struct LDKCOption_ThirtyTwoBytesZ WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKChannelId channel_id_arg); /** - * First block where the transaction output may have been spent. + * Creates a copy of the TxComplete */ -void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig); /** - * Outpoint identifying the transaction output. + * Generates a non-cryptographic 64-bit hash of the TxComplete. */ -struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +uint64_t TxComplete_hash(const struct LDKTxComplete *NONNULL_PTR o); /** - * Outpoint identifying the transaction output. + * Checks if two TxCompletes 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 WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val); +bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b); /** - * Spending condition of the transaction output. + * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL. */ -struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr); +void TxSignatures_free(struct LDKTxSignatures this_obj); /** - * Spending condition of the transaction output. + * The channel ID */ -void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKChannelId TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * Constructs a new WatchedOutput given each field + * The channel ID */ -MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKCOption_ThirtyTwoBytesZ block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg); +void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a copy of the WatchedOutput + * The TXID */ -struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig); +const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The TXID */ -bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b); +void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Generates a non-cryptographic 64-bit hash of the WatchedOutput. + * The list of witnesses + * + * Returns a copy of the field. */ -uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); +struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The list of witnesses */ -void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr); +void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val); /** - * Creates a copy of the ConfirmationTarget + * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers */ -enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); +struct LDKCOption_ECDSASignatureZ TxSignatures_get_shared_input_signature(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new OnChainSweep-variant ConfirmationTarget + * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers */ -enum LDKConfirmationTarget ConfirmationTarget_on_chain_sweep(void); +void TxSignatures_set_shared_input_signature(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Utility method to constructs a new MaxAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget + * Constructs a new TxSignatures given each field */ -enum LDKConfirmationTarget ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee(void); +MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg, struct LDKCOption_ECDSASignatureZ shared_input_signature_arg); /** - * Utility method to constructs a new MinAllowedAnchorChannelRemoteFee-variant ConfirmationTarget + * Creates a copy of the TxSignatures */ -enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void); +struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig); /** - * Utility method to constructs a new MinAllowedNonAnchorChannelRemoteFee-variant ConfirmationTarget + * Generates a non-cryptographic 64-bit hash of the TxSignatures. */ -enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void); +uint64_t TxSignatures_hash(const struct LDKTxSignatures *NONNULL_PTR o); /** - * Utility method to constructs a new AnchorChannelFee-variant ConfirmationTarget + * Checks if two TxSignaturess 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. */ -enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void); +bool TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b); /** - * Utility method to constructs a new NonAnchorChannelFee-variant ConfirmationTarget + * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL. */ -enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void); +void TxInitRbf_free(struct LDKTxInitRbf this_obj); /** - * Utility method to constructs a new ChannelCloseMinimum-variant ConfirmationTarget + * The channel ID */ -enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void); +struct LDKChannelId TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget. + * The channel ID */ -uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); +void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Checks if two ConfirmationTargets contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The locktime of the transaction */ -bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); +uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The locktime of the transaction */ -void FeeEstimator_free(struct LDKFeeEstimator this_ptr); +void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL. + * The feerate of the transaction */ -void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj); +uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Creates a copy of the MonitorUpdateId + * The feerate of the transaction */ -struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig); +void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId. + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o); +struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * 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. + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b); +void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); /** - * Calls the free function if one is set + * Constructs a new TxInitRbf given each field */ -void Persist_free(struct LDKPersist this_ptr); +MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKChannelId channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg); /** - * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL. + * Creates a copy of the TxInitRbf */ -void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); +struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig); /** - * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the TxInitRbf. */ -void ChainMonitor_free(struct LDKChainMonitor this_obj); +uint64_t TxInitRbf_hash(const struct LDKTxInitRbf *NONNULL_PTR o); /** - * 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. + * Checks if two TxInitRbfs 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 LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); +bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels); +void TxAckRbf_free(struct LDKTxAckRbf this_obj); /** - * 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. + * The channel ID */ -MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); +struct LDKChannelId TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); /** - * 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. + * The channel ID */ -MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); +struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); /** - * 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. + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -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 TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); /** - * 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 + * Constructs a new TxAckRbf given each field */ -MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKChannelId channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg); /** - * 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. + * Creates a copy of the TxAckRbf */ -void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg); +struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *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 + * Generates a non-cryptographic 64-bit hash of the TxAckRbf. */ -struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); +uint64_t TxAckRbf_hash(const struct LDKTxAckRbf *NONNULL_PTR o); /** - * 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 + * Checks if two TxAckRbfs 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 LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); +bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b); /** - * 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 + * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL. */ -struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg); +void TxAbort_free(struct LDKTxAbort this_obj); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * The channel ID */ -struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg); +struct LDKChannelId TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL. + * The channel ID */ -void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); +void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with 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. + * Message data * - * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress + * Returns a copy of the field. */ -uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr); /** - * The sequence number of this update. Updates *must* be replayed in-order according to this - * sequence number (and updates may panic if they are not). The update_id values are strictly - * increasing and increase by one for each new update, with 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 + * Message data */ -void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); +void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Creates a copy of the ChannelMonitorUpdate + * Constructs a new TxAbort given each field */ -struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z data_arg); /** - * 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. + * Creates a copy of the TxAbort */ -bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b); +struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig); /** - * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read + * Generates a non-cryptographic 64-bit hash of the TxAbort. */ -struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); +uint64_t TxAbort_hash(const struct LDKTxAbort *NONNULL_PTR o); /** - * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write + * Checks if two TxAborts 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_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); +bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b); /** - * Frees any resources used by the MonitorEvent + * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. */ -void MonitorEvent_free(struct LDKMonitorEvent this_ptr); +void Shutdown_free(struct LDKShutdown this_obj); /** - * Creates a copy of the MonitorEvent + * The channel ID */ -struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig); +struct LDKChannelId Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new HTLCEvent-variant MonitorEvent + * The channel ID */ -struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Utility method to constructs a new HolderForceClosed-variant MonitorEvent + * The destination of this peer's funds on closing. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a); +struct LDKCVec_u8Z Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Completed-variant MonitorEvent + * The destination of this peer's funds on closing. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -struct LDKMonitorEvent MonitorEvent_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Checks if two MonitorEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Constructs a new Shutdown given each field */ -bool MonitorEvent_eq(const struct LDKMonitorEvent *NONNULL_PTR a, const struct LDKMonitorEvent *NONNULL_PTR b); +MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); /** - * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read + * Creates a copy of the Shutdown */ -struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); /** - * Read a MonitorEvent from a byte array, created by MonitorEvent_write + * Generates a non-cryptographic 64-bit hash of the Shutdown. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser); +uint64_t Shutdown_hash(const struct LDKShutdown *NONNULL_PTR o); /** - * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL. + * 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. */ -void HTLCUpdate_free(struct LDKHTLCUpdate this_obj); +bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); /** - * Creates a copy of the HTLCUpdate + * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. */ -struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig); +void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); /** - * 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. + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -bool HTLCUpdate_eq(const struct LDKHTLCUpdate *NONNULL_PTR a, const struct LDKHTLCUpdate *NONNULL_PTR b); +uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj); +void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser); +uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Balance + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void Balance_free(struct LDKBalance this_ptr); +void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the Balance + * Constructs a new ClosingSignedFeeRange given each field */ -struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig); +MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); /** - * Utility method to constructs a new ClaimableOnChannelClose-variant Balance + * Creates a copy of the ClosingSignedFeeRange */ -struct LDKBalance Balance_claimable_on_channel_close(uint64_t amount_satoshis); +struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); /** - * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance + * Generates a non-cryptographic 64-bit hash of the ClosingSignedFeeRange. */ -struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t amount_satoshis, uint32_t confirmation_height); +uint64_t ClosingSignedFeeRange_hash(const struct LDKClosingSignedFeeRange *NONNULL_PTR o); /** - * Utility method to constructs a new ContentiousClaimable-variant Balance + * 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. */ -struct LDKBalance Balance_contentious_claimable(uint64_t amount_satoshis, uint32_t timeout_height, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage); +bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); /** - * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance + * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. */ -struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t amount_satoshis, uint32_t claimable_height, struct LDKThirtyTwoBytes payment_hash); +void ClosingSigned_free(struct LDKClosingSigned this_obj); /** - * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance + * The channel ID */ -struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t amount_satoshis, uint32_t expiry_height, struct LDKThirtyTwoBytes payment_hash); +struct LDKChannelId ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance + * The channel ID */ -struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t amount_satoshis); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Checks if two Balances contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The proposed total fee for the closing transaction */ -bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * The amount claimable, in satoshis. This excludes balances that we are unsure if we are able - * to claim, this is because we are waiting for a preimage or for a timeout to expire. For more - * information on these balances see [`Balance::MaybeTimeoutClaimableHTLC`] and - * [`Balance::MaybePreimageClaimableHTLC`]. - * - * On-chain fees required to claim the balance are not included in this amount. + * The proposed total fee for the closing transaction */ -MUST_USE_RES uint64_t Balance_claimable_amount_satoshis(const struct LDKBalance *NONNULL_PTR this_arg); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL. + * A signature on the closing transaction */ -void ChannelMonitor_free(struct LDKChannelMonitor this_obj); +struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelMonitor + * A signature on the closing transaction */ -struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read + * 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 LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); +struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Updates a ChannelMonitor on the basis of some new information provided by the Channel - * itself. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. * - * panics if the given update is not the next update by update_id. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); /** - * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this - * ChannelMonitor. + * Constructs a new ClosingSigned given each field + * + * Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKChannelId channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** - * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for. + * Creates a copy of the ClosingSigned */ -MUST_USE_RES struct LDKC2Tuple_OutPointCVec_u8ZZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); /** - * 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(). + * Generates a non-cryptographic 64-bit hash of the ClosingSigned. */ -MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +uint64_t ClosingSigned_hash(const struct LDKClosingSigned *NONNULL_PTR o); /** - * 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. + * 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 ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter); +bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); /** - * 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`]. + * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); /** - * Processes [`SpendableOutputs`] events produced from each [`ChannelMonitor`] upon maturity. - * - * For channels featuring anchor outputs, this method will also process [`BumpTransaction`] - * events produced from each [`ChannelMonitor`] while there is a balance to claim onchain - * within each channel. As the confirmation of a commitment transaction may be critical to the - * safety of funds, we recommend invoking this every 30 seconds, or lower if running in an - * environment with spotty connections, like on mobile. - * - * An [`EventHandler`] may safely call back to the provider, though this shouldn't be needed in - * order to handle these events. - * - * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs - * [`BumpTransaction`]: crate::events::Event::BumpTransaction + * The channel ID */ -void ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler); +struct LDKChannelId UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Gets the counterparty's initial commitment transaction. The returned commitment - * transaction is unsigned. This is intended to be called during the initial persistence of - * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for - * watchtowers in the persistence pipeline to have enough data to form justice transactions. - * - * This is similar to [`Self::counterparty_commitment_txs_from_update`], except - * that for the initial commitment transaction, we don't have a corresponding update. - * - * This will only return `Some` for channel monitors that have been created after upgrading - * to LDK 0.0.117+. - * - * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The channel ID */ -MUST_USE_RES struct LDKCommitmentTransaction ChannelMonitor_initial_counterparty_commitment_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Gets all of the counterparty commitment transactions provided by the given update. This - * may be empty if the update doesn't include any new counterparty commitments. Returned - * commitment transactions are unsigned. - * - * This is provided so that watchtower clients in the persistence pipeline are able to build - * justice transactions for each counterparty commitment upon each update. It's intended to be - * used within an implementation of [`Persist::update_persisted_channel`], which is provided - * with a monitor and an update. Once revoked, signing a justice transaction can be done using - * [`Self::sign_to_local_justice_tx`]. - * - * It is expected that a watchtower client may use this method to retrieve the latest counterparty - * commitment transaction(s), and then hold the necessary data until a later update in which - * the monitor has been updated with the corresponding revocation data, at which point the - * monitor can sign the justice transaction. - * - * This will only return a non-empty list for monitor updates that have been created after - * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which - * may have been created prior to upgrading. - * - * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel + * The HTLC ID */ -MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_commitment_txs_from_update(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make - * signing the justice transaction easier for implementors of - * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction - * signing the input at `input_idx`. This method will only produce a valid signature for - * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot - * be used for revoked HTLC outputs. - * - * `Value` is the value of the output being spent by the input at `input_idx`, committed - * in the BIP 143 signature. - * - * This method will only succeed if this monitor has received the revocation secret for the - * provided `commitment_number`. If a commitment number is provided that does not correspond - * to the commitment transaction being revoked, this will return a signed transaction, but - * the signature will not be valid. - * - * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output - * [`Persist`]: crate::chain::chainmonitor::Persist + * The HTLC ID */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_justice_tx(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input_idx, uint64_t value, uint64_t commitment_number); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t 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. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The HTLC value in milli-satoshi */ -MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Used by [`ChannelManager`] deserialization to broadcast the latest holder state if its copy - * of the channel state was out-of-date. - * - * You may also use this to broadcast the latest local commitment transaction, either because - * a monitor update failed 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. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * The HTLC value in milli-satoshi */ -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 UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t 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 payment hash, the pre-image of which controls HTLC redemption */ -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 uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * Determines if the disconnected block contained any transactions of interest and updates - * appropriately. + * The payment hash, the pre-image of which controls HTLC redemption */ -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 UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes 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. - * - * [`block_connected`]: Self::block_connected + * The expiry height of the HTLC */ -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); +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *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. - * - * [`block_disconnected`]: Self::block_disconnected + * The expiry height of the HTLC */ -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 UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t 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. + * The extra fee skimmed by the sender of this message. See + * [`ChannelConfig::accept_underpaying_htlcs`]. * - * [`block_connected`]: Self::block_connected + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs */ -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); +struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Returns the set of txids that should be monitored for re-organization out of the chain. + * The extra fee skimmed by the sender of this message. See + * [`ChannelConfig::accept_underpaying_htlcs`]. + * + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs */ -MUST_USE_RES struct LDKCVec_C2Tuple_ThirtyTwoBytesCOption_ThirtyTwoBytesZZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * The onion routing packet with encrypted data for the next hop. */ -MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +struct LDKOnionPacket UpdateAddHTLC_get_onion_routing_packet(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * 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. + * The onion routing packet with encrypted data for the next hop. */ -void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger); +void UpdateAddHTLC_set_onion_routing_packet(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKOnionPacket val); /** - * Returns the descriptors for relevant outputs (i.e., those that we can spend) within the - * transaction if they exist and the transaction has at least [`ANTI_REORG_DELAY`] - * confirmations. For [`SpendableOutputDescriptor::DelayedPaymentOutput`] descriptors to be - * returned, the transaction must have at least `max(ANTI_REORG_DELAY, to_self_delay)` - * confirmations. - * - * Descriptors returned by this method are primarily exposed via [`Event::SpendableOutputs`] - * once they are no longer under reorg risk. This method serves as a way to retrieve these - * descriptors at a later time, either for historical purposes, or to replay any - * missed/unhandled descriptors. For the purpose of gathering historical records, if the - * channel close has fully resolved (i.e., [`ChannelMonitor::get_claimable_balances`] returns - * an empty set), you can retrieve all spendable outputs by providing all descendant spending - * transactions starting from the channel's funding transaction and going down three levels. - * - * `tx` is a transaction we'll scan the outputs of. Any transaction can be provided. If any - * outputs which can be spent by us are found, at least one descriptor is returned. + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. * - * `confirmation_height` must be the height of the block in which `tx` was included in. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spendable_outputs(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKTransaction tx, uint32_t confirmation_height); +struct LDKPublicKey UpdateAddHTLC_get_blinding_point(const struct LDKUpdateAddHTLC *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, not all or excess balances may be included. + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. * - * See [`Balance`] for additional details on the types of claimable balances which - * may be returned here and their meanings. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +void UpdateAddHTLC_set_blinding_point(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write + * Constructs a new UpdateAddHTLC given each field + * + * Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKEntropySource *NONNULL_PTR arg_a, const struct LDKSignerProvider *NONNULL_PTR arg_b); +MUST_USE_RES struct LDKUpdateAddHTLC UpdateAddHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, uint64_t amount_msat_arg, struct LDKThirtyTwoBytes payment_hash_arg, uint32_t cltv_expiry_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, struct LDKOnionPacket onion_routing_packet_arg, struct LDKPublicKey blinding_point_arg); /** - * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL. + * Creates a copy of the UpdateAddHTLC */ -void OutPoint_free(struct LDKOutPoint this_obj); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); /** - * The referenced transaction's txid. + * Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. */ -const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32]; +uint64_t UpdateAddHTLC_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR o); /** - * The referenced transaction's txid. + * 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 OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); /** - * The index of the referenced output in its transaction's vout. + * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. */ -uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr); +void OnionMessage_free(struct LDKOnionMessage this_obj); /** - * The index of the referenced output in its transaction's vout. + * Used in decrypting the onion packet's payload. */ -void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val); +struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); /** - * Constructs a new OutPoint given each field + * Used in decrypting the onion packet's payload. */ -MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg); +void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the OutPoint + * The full onion packet including hop data, pubkey, and hmac */ -struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig); +struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); /** - * 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. + * The full onion packet including hop data, pubkey, and hmac */ -bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b); +void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); /** - * Generates a non-cryptographic 64-bit hash of the OutPoint. + * Constructs a new OnionMessage given each field */ -uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o); +MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); /** - * Convert an `OutPoint` to a lightning channel id. + * Creates a copy of the OnionMessage */ -MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg); +struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); /** - * Serialize the OutPoint object into a byte array which can be read by OutPoint_read + * Generates a non-cryptographic 64-bit hash of the OnionMessage. */ -struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj); +uint64_t OnionMessage_hash(const struct LDKOnionMessage *NONNULL_PTR o); /** - * Read a OutPoint from a byte array, created by OutPoint_write + * 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. */ -struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); +bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); /** - * Frees any resources used by the FailureCode + * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. */ -void FailureCode_free(struct LDKFailureCode this_ptr); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); /** - * Creates a copy of the FailureCode + * The channel ID */ -struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); +struct LDKChannelId UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode + * The channel ID */ -struct LDKFailureCode FailureCode_temporary_node_failure(void); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode + * The HTLC ID */ -struct LDKFailureCode FailureCode_required_node_feature_missing(void); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode + * The HTLC ID */ -struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new InvalidOnionPayload-variant FailureCode + * The pre-image of the payment hash, allowing HTLC redemption */ -struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. + * The pre-image of the payment hash, allowing HTLC redemption */ -void ChannelManager_free(struct LDKChannelManager this_obj); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. + * Constructs a new UpdateFulfillHTLC given each field */ -void ChainParameters_free(struct LDKChainParameters this_obj); +MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); /** - * The network for determining the `chain_hash` in Lightning messages. + * Creates a copy of the UpdateFulfillHTLC */ -enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); /** - * The network for determining the `chain_hash` in Lightning messages. + * Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. */ -void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); +uint64_t UpdateFulfillHTLC_hash(const struct LDKUpdateFulfillHTLC *NONNULL_PTR o); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * 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. */ -struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); +bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. */ -void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); /** - * Constructs a new ChainParameters given each field + * The channel ID */ -MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); +struct LDKChannelId UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChainParameters + * The channel ID */ -struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. + * The HTLC ID */ -void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Base routing fee in millisatoshis. + * The HTLC ID */ -uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Base routing fee in millisatoshis. + * Creates a copy of the UpdateFailHTLC */ -void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. */ -uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +uint64_t UpdateFailHTLC_hash(const struct LDKUpdateFailHTLC *NONNULL_PTR o); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * 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. */ -void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. */ -uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); /** - * 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 channel ID */ -void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKChannelId UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new CounterpartyForwardingInfo given each field + * The channel ID */ -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 UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a copy of the CounterpartyForwardingInfo + * The HTLC ID */ -struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. + * The HTLC ID */ -void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * The node_id of our counterparty + * The failure code */ -struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * The node_id of our counterparty + * The failure code */ -void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t 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. + * Creates a copy of the UpdateFailMalformedHTLC */ -struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); /** - * 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. + * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. */ -void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +uint64_t UpdateFailMalformedHTLC_hash(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR o); /** - * 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 + * 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. */ -uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); /** - * 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 + * Frees any resources used by the CommitmentSignedBatch, if is_owned is set and inner is non-NULL. */ -void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); +void CommitmentSignedBatch_free(struct LDKCommitmentSignedBatch this_obj); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Batch size N: all N `commitment_signed` messages must be received before being processed */ -struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +uint16_t CommitmentSignedBatch_get_batch_size(const struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Batch size N: all N `commitment_signed` messages must be received before being processed */ -void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); +void CommitmentSignedBatch_set_batch_size(struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr, uint16_t 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. + * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +const uint8_t (*CommitmentSignedBatch_get_funding_txid(const struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ -void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void CommitmentSignedBatch_set_funding_txid(struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Constructs a new CommitmentSignedBatch given each field */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCommitmentSignedBatch CommitmentSignedBatch_new(uint16_t batch_size_arg, struct LDKThirtyTwoBytes funding_txid_arg); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Creates a copy of the CommitmentSignedBatch */ -void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKCommitmentSignedBatch CommitmentSignedBatch_clone(const struct LDKCommitmentSignedBatch *NONNULL_PTR orig); /** - * Constructs a new ChannelCounterparty given each field - * - * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the CommitmentSignedBatch. */ -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); +uint64_t CommitmentSignedBatch_hash(const struct LDKCommitmentSignedBatch *NONNULL_PTR o); /** - * Creates a copy of the ChannelCounterparty + * Checks if two CommitmentSignedBatchs 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 LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); +bool CommitmentSignedBatch_eq(const struct LDKCommitmentSignedBatch *NONNULL_PTR a, const struct LDKCommitmentSignedBatch *NONNULL_PTR b); /** - * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. + * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_free(struct LDKChannelDetails this_obj); +void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * The channel ID */ -const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32]; +struct LDKChannelId CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * The channel's ID (prior to funding transaction generation, this is a random 32 bytes, - * thereafter this is the txid of the funding transaction xor the funding transaction output). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * The channel ID */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * A signature on the commitment transaction */ -struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * A signature on the commitment transaction */ -void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature 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()`. + * Signatures on the HTLC transactions * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns a copy of the field. */ -struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * 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 + * Signatures on the HTLC transactions */ -void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. + * Optional batch size and other parameters * * 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); +struct LDKCommitmentSignedBatch CommitmentSigned_get_batch(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. + * Optional batch size and other parameters * * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +void CommitmentSigned_set_batch(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCommitmentSignedBatch val); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * 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`]. + * Constructs a new CommitmentSigned given each field * - * [`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 + * Note that batch_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg, struct LDKCommitmentSignedBatch batch_arg); /** - * 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 + * Creates a copy of the CommitmentSigned */ -void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); /** - * 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 + * Generates a non-cryptographic 64-bit hash of the CommitmentSigned. */ -struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t CommitmentSigned_hash(const struct LDKCommitmentSigned *NONNULL_PTR o); /** - * 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 + * 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. */ -void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); /** - * 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 + * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); /** - * 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 + * The channel ID */ -void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKChannelId RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * The value, in satoshis, of this channel as appears in the funding output + * The channel ID */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The value, in satoshis, of this channel as appears in the funding output + * The secret corresponding to the per-commitment point */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *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 secret corresponding to the per-commitment point */ -struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * The next sender-broadcast commitment transaction's per-commitment point */ -void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects - * serialized with LDK versions prior to 0.0.113. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * The next sender-broadcast commitment transaction's per-commitment point */ -struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound - * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. This may be zero for objects - * serialized with LDK versions prior to 0.0.113. - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Constructs a new RevokeAndACK given each field */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); +MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); /** - * 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. + * Creates a copy of the RevokeAndACK */ -struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); /** - * 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. + * Generates a non-cryptographic 64-bit hash of the RevokeAndACK. */ -void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +uint64_t RevokeAndACK_hash(const struct LDKRevokeAndACK *NONNULL_PTR o); /** - * 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`] + * 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. */ -uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); /** - * 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`] + * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void UpdateFee_free(struct LDKUpdateFee this_obj); /** - * 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. + * The channel ID */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKChannelId UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, 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. + * The channel ID */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * 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::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * Fee rate per 1000-weight of the transaction */ -uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * 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::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * Fee rate per 1000-weight of the transaction */ -void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Constructs a new UpdateFee given each field */ -uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKChannelId channel_id_arg, uint32_t feerate_per_kw_arg); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Creates a copy of the UpdateFee */ -void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); /** - * 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. + * Generates a non-cryptographic 64-bit hash of the UpdateFee. */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t UpdateFee_hash(const struct LDKUpdateFee *NONNULL_PTR o); /** - * 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. + * 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. + */ +bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); + +/** + * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelReestablish_free(struct LDKChannelReestablish this_obj); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * The channel ID */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKChannelId ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * The channel ID */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + * The next commitment number for the sender */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + * The next commitment number for the sender */ -void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * The next commitment number for the recipient */ -struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *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 next commitment number for the recipient */ -void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * True if the channel was initiated (and thus funded) by us. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** - * True if the channel was initiated (and thus funded) by us. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes 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 + * The sender's per-commitment point for their current commitment transaction */ -bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * 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 + * The sender's per-commitment point for their current commitment transaction */ -void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. - * - * Returns a copy of the field. + * The next funding transaction ID */ -struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * The next funding transaction ID */ -void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); +void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * 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`. + * Constructs a new ChannelReestablish given each field */ -bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKChannelId channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg); /** - * 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`. + * Creates a copy of the ChannelReestablish */ -void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); /** - * True if this channel is (or will be) publicly-announced. + * Generates a non-cryptographic 64-bit hash of the ChannelReestablish. */ -bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t ChannelReestablish_hash(const struct LDKChannelReestablish *NONNULL_PTR o); /** - * True if this channel is (or will be) publicly-announced. + * 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. */ -void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); /** - * 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 + * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); /** - * 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 channel ID */ -void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKChannelId AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * The channel ID */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * The short channel ID */ -void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *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. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The short channel ID */ -struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** - * 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 + * A signature by the node key */ -void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelDetails given each field - * - * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * A signature by the node key */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Creates a copy of the ChannelDetails + * A signature by the funding key */ -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); +struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * 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. + * A signature by the funding key */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * 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. + * Constructs a new AnnouncementSignatures given each field */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKChannelId channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); /** - * Creates a copy of the ChannelShutdownState + * Creates a copy of the AnnouncementSignatures */ -enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); /** - * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState + * Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. */ -enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); +uint64_t AnnouncementSignatures_hash(const struct LDKAnnouncementSignatures *NONNULL_PTR o); /** - * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState + * 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. */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); +bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); /** - * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState + * Frees any resources used by the SocketAddress */ -enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); +void SocketAddress_free(struct LDKSocketAddress this_ptr); /** - * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState + * Creates a copy of the SocketAddress */ -enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); +struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); /** - * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState + * Utility method to constructs a new TcpIpV4-variant SocketAddress */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); +struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); /** - * Checks if two ChannelShutdownStates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new TcpIpV6-variant SocketAddress */ -bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); +struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); /** - * Frees any resources used by the RecentPaymentDetails + * Utility method to constructs a new OnionV2-variant SocketAddress */ -void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); +struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); /** - * Creates a copy of the RecentPaymentDetails + * Utility method to constructs a new OnionV3-variant SocketAddress */ -struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); +struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + * Utility method to constructs a new Hostname-variant SocketAddress */ -struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); +struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); /** - * Utility method to constructs a new Pending-variant RecentPaymentDetails + * Generates a non-cryptographic 64-bit hash of the SocketAddress. */ -struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); +uint64_t SocketAddress_hash(const struct LDKSocketAddress *NONNULL_PTR o); /** - * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails + * Checks if two SocketAddresss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); +bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); /** - * Utility method to constructs a new Abandoned-variant RecentPaymentDetails + * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read */ -struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); +struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj); /** - * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. + * Read a SocketAddress from a byte array, created by SocketAddress_write */ -void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); +struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); /** - * The list of channels to be included in the invoice route hints. + * Creates a copy of the SocketAddressParseError */ -struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); /** - * The list of channels to be included in the invoice route hints. + * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError */ -void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); +enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Utility method to constructs a new InvalidInput-variant SocketAddressParseError */ -uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Utility method to constructs a new InvalidPort-variant SocketAddressParseError */ -void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError */ -struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. */ -void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NONNULL_PTR o); /** - * Constructs a new PhantomRouteHints given each field + * Checks if two SocketAddressParseErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); +bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); /** - * Creates a copy of the PhantomRouteHints + * Get the string representation of a SocketAddressParseError object */ -struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); +struct LDKStr SocketAddressParseError_to_str(const enum LDKSocketAddressParseError *NONNULL_PTR o); /** - * Constructs a new `ChannelManager` to hold several channels and route between them. - * - * The current time or latest block header time can be provided as the `current_timestamp`. - * - * 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. + * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. * - * [`block_connected`]: chain::Listen::block_connected - * [`block_disconnected`]: chain::Listen::block_disconnected - * [`params.best_block.block_hash`]: chain::BestBlock::block_hash + * The host part must end with \".onion\". */ -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, uint32_t current_timestamp); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); /** - * Gets the current configuration applied to all new channels. + * Get the string representation of a SocketAddress object */ -MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); /** - * 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`. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. - * - * 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 + * Read a SocketAddress object from a string */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); /** - * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for - * more information. + * Frees any resources used by the UnsignedGossipMessage */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); /** - * 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. + * Creates a copy of the UnsignedGossipMessage */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); /** - * Gets the list of channels we have with a given counterparty, in random order. + * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); /** - * 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 + * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage */ -MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); /** - * 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 [`ChannelCloseMinimum`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] - * fee estimate. - * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which - * would appear on a force-closure transaction, whichever is lower. We will allow our - * counterparty to pay as much fee as they'd like, however. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage */ -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); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); /** - * 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 [`NonAnchorChannelFee`] - * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). - * * If our counterparty is the channel initiator, we will refuse to accept a channel closure - * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which - * will appear on a force-closure transaction, whichever is lower). - * - * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. - * Will fail if a shutdown script has already been set for this channel by - * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must - * also be compatible with our and the counterparty's features. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown - * - * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); +struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); /** - * 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. + * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. */ -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 UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); /** - * 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 advertised features */ -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); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Force close all channels, immediately broadcasting the latest local commitment transaction - * for each to the chain and rejecting new HTLCs on each. + * The advertised features */ -void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Force close all channels rejecting new HTLCs on each but without broadcasting the latest - * local transaction(s). + * A strictly monotonic announcement counter, with gaps allowed */ -void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Sends a payment along a given route. - * - * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] - * fields for more info. - * - * 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 as it has been - * closed, doesn't exist, or the peer is currently disconnected. - * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the - * relevant updates. - * - * 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! - * - * [`RouteHop`]: crate::routing::router::RouteHop - * [`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 + * A strictly monotonic announcement counter, with gaps allowed */ -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); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** - * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on - * `route_params` and retry failed payment paths based on `retry_strategy`. + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -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); +struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Signals that no further attempts for the given payment should occur. Useful if you have a - * pending outbound payment with retries remaining, but wish to stop retrying the payment before - * retries are exhausted. - * - * # Event Generation - * - * If no [`Event::PaymentFailed`] event had been generated before, one will be generated as soon - * as there are no remaining pending HTLCs for this payment. - * - * 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. - * - * # Requested Invoices - * - * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning - * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`] - * and prevent any attempts at paying it once received. The other events may only be generated - * once the invoice has been received. - * - * # Restart Behavior - * - * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the - * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for - * [`Event::InvoiceRequestFailed`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Send a spontaneous payment, which is a payment that does not require the recipient to have - * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify - * the preimage, it must be a cryptographically secure random value that no intermediate node - * would be able to guess -- otherwise, an intermediate node may claim the payment and it will - * never reach the recipient. - * - * See [`send_payment`] documentation for more details on the return value of this function - * 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. - * - * [`send_payment`]: Self::send_payment + * An RGB color for UI purposes */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** - * 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 + * An RGB color for UI purposes */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * 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. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Sends payment probes over all paths of a route that would be used to pay the given - * amount to the given `node_id`. + * An alias, for UI purposes. * - * See [`ChannelManager::send_preflight_probes`] for more information. + * This should be sanitized before use. There is no guarantee of uniqueness. */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_spontaneous_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, uint64_t amount_msat, uint32_t final_cltv_expiry_delta, struct LDKCOption_u64Z liquidity_limit_multiplier); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * Sends payment probes over all paths of a route that would be used to pay a route found - * according to the given [`RouteParameters`]. - * - * This may be used to send \"pre-flight\" probes, i.e., to train our scorer before conducting - * the actual payment. Note this is only useful if there likely is sufficient time for the - * probe to settle before sending out the actual payment, e.g., when waiting for user - * confirmation in a wallet UI. + * List of addresses on which this node is reachable * - * Otherwise, there is a chance the probe could take up some liquidity needed to complete the - * actual payment. Users should therefore be cautious and might avoid sending probes if - * liquidity is scarce and/or they don't expect the probe to return before they send the - * payment. To mitigate this issue, channels with available liquidity less than the required - * amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight - * probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`. + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ ChannelManager_send_preflight_probes(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRouteParameters route_params, struct LDKCOption_u64Z liquidity_limit_multiplier); +struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * 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 + * List of addresses on which this node is reachable */ -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); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** - * Call this upon creation of a batch funding transaction for the given channels. - * - * Return values are identical to [`Self::funding_transaction_generated`], respective to - * each individual channel and transaction output. + * Excess address data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * Do NOT broadcast the funding transaction yourself. This batch funding transcaction - * will only be broadcast when we have safely received and persisted the counterparty's - * signature for each channel. + * This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol. * - * If there is an error, all channels in the batch are to be considered closed. + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_address_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Atomically applies partial updates to the [`ChannelConfig`] of 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. + * Excess address data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * [`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 + * This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); +void UnsignedNodeAnnouncement_set_excess_address_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * 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`]. + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * If an error is returned, none of the updates should be considered applied. + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. * - * [`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 + * Returns a copy of the field. */ -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); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * 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. See - * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount - * than expected. - * - * Errors if the event was not handled in time, in which case the HTLC was automatically failed - * backwards. + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs - * [`HTLCIntercepted`]: events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. */ -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); +void UnsignedNodeAnnouncement_set_excess_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * 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 + * Constructs a new UnsignedNodeAnnouncement given each field */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); +MUST_USE_RES struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_new(struct LDKNodeFeatures features_arg, uint32_t timestamp_arg, struct LDKNodeId node_id_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg, struct LDKCVec_u8Z excess_address_data_arg, struct LDKCVec_u8Z excess_data_arg); /** - * 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. + * Creates a copy of the UnsignedNodeAnnouncement */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); /** - * 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`]. - * * Removing peers which have disconnected but and no longer have any channels. - * * Force-closing and removing channels which have not completed establishment in a timely manner. - * * Forgetting about stale outbound payments, either those that have already been fulfilled - * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. - * The latter is determined using the system clock in `std` and the highest seen block time - * minus two hours in `no-std`. - * - * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate - * estimate fetches. - * - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelConfig`]: crate::util::config::ChannelConfig + * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. */ -void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t UnsignedNodeAnnouncement_hash(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR o); /** - * 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. + * 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. */ -void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); /** - * 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. + * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. */ -void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** - * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any - * [`MessageSendEvent`]s needed to claim the payment. - * - * 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. - * - * 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. - * - * This function will fail the payment if it has custom TLVs with even type numbers, as we - * will assume they are unknown. If you intend to accept even custom TLVs, you should use - * [`claim_funds_with_known_custom_tlvs`]. - * - * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable - * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline - * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed - * [`process_pending_events`]: EventsProvider::process_pending_events - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash - * [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs + * The signature by the node key */ -void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with - * even type numbers. - * - * # Note - * - * You MUST check you've understood all even TLVs before using this to - * claim, otherwise you may unintentionally agree to some protocol you do not understand. - * - * [`claim_funds`]: Self::claim_funds + * The signature by the node key */ -void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Gets the node_id held by this ChannelManager + * The actual content of the announcement */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * 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 actual content of the announcement */ -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); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); /** - * 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 + * Constructs a new NodeAnnouncement given each field */ -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); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** - * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and - * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual - * [`Bolt12Invoice`] once it is received. - * - * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by - * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. - * The optional parameters are used in the builder, if `Some`: - * - `quantity` for [`InvoiceRequest::quantity`] which must be set if - * [`Offer::expects_quantity`] is `true`. - * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and - * - `payer_note` for [`InvoiceRequest::payer_note`]. - * - * If `max_total_routing_fee_msat` is not specified, The default from - * [`RouteParameters::from_payment_params_and_value`] is applied. - * - * # Payment - * - * The provided `payment_id` is used to ensure that only one invoice is paid for the request - * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has - * been sent. - * - * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the - * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the - * payment will fail with an [`Event::InvoiceRequestFailed`]. - * - * # Privacy - * - * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`] - * as the introduction node and a derived payer id for payer privacy. As such, currently, the - * node must be announced. Otherwise, there is no way to find a path to the introduction node - * in order to send the [`Bolt12Invoice`]. - * - * # Limitations - * - * Requires a direct connection to an introduction node in [`Offer::paths`] or to - * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding - * [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link - * or if the provided parameters are invalid for the offer. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity - * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note - * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * Creates a copy of the NodeAnnouncement */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); /** - * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion - * message. - * - * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a - * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding - * [`PaymentPreimage`]. - * - * # Limitations - * - * Requires a direct connection to an introduction node in [`Refund::paths`] or to - * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each - * node meeting the aforementioned criteria, but there's no guarantee that they will be - * received and no retries will be made. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); +uint64_t NodeAnnouncement_hash(const struct LDKNodeAnnouncement *NONNULL_PTR o); /** - * 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 + * 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. */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *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_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 + * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); /** - * 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 advertised channel features */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * 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::sign::PhantomKeysManager + * The advertised channel features */ -MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Gets route hints for use in receiving [phantom node payments]. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * The genesis hash of the blockchain where the channel is to be opened */ -MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The genesis hash of the blockchain where the channel is to be opened */ -MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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. + * The short channel ID */ -MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The short channel ID */ -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * One of the two `node_id`s which are endpoints of this channel */ -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + +/** + * One of the two `node_id`s which are endpoints of this channel + */ +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); + +/** + * The other of the two `node_id`s which are endpoints of this channel + */ +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); + +/** + * The other of the two `node_id`s which are endpoints of this channel + */ +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * The funding key for the first node */ -struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * 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 + * The funding key for the first node */ -struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Gets a [`Future`] that completes when this [`ChannelManager`] may need to be persisted or - * may have events that need processing. - * - * In order to check if this [`ChannelManager`] needs persisting, call - * [`Self::get_and_clear_needs_persistence`]. - * - * Note that callbacks registered on the [`Future`] MUST NOT call back into this - * [`ChannelManager`] and should instead register actions to be taken later. + * The funding key for the second node */ -MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Returns true if this [`ChannelManager`] needs to be persisted. + * The funding key for the second node */ -MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * 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. */ -MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Fetches the set of [`NodeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * 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. */ -MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Constructs a new UnsignedChannelAnnouncement given each field */ -MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_new(struct LDKChannelFeatures features_arg, struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, struct LDKNodeId node_id_1_arg, struct LDKNodeId node_id_2_arg, struct LDKNodeId bitcoin_key_1_arg, struct LDKNodeId bitcoin_key_2_arg, struct LDKCVec_u8Z excess_data_arg); /** - * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Creates a copy of the UnsignedChannelAnnouncement */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. */ -MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t UnsignedChannelAnnouncement_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR o); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * Checks if two 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. */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); /** - * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Authentication of the announcement by the first public node */ -struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read + * Authentication of the announcement by the first public node */ -struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write + * Authentication of the announcement by the second public node */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read + * Authentication of the announcement by the second public node */ -struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write + * Proof of funding UTXO ownership by the first public node */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read + * Proof of funding UTXO ownership by the first public node */ -struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Read a ChannelDetails from a byte array, created by ChannelDetails_write + * Proof of funding UTXO ownership by the second public node */ -struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read + * Proof of funding UTXO ownership by the second public node */ -struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write + * The actual announcement */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read + * The actual announcement */ -struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); /** - * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read + * Constructs a new ChannelAnnouncement given each field */ -struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKECDSASignature node_signature_1_arg, struct LDKECDSASignature node_signature_2_arg, struct LDKECDSASignature bitcoin_signature_1_arg, struct LDKECDSASignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); /** - * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write + * Creates a copy of the ChannelAnnouncement */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. */ -void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +uint64_t ChannelAnnouncement_hash(const struct LDKChannelAnnouncement *NONNULL_PTR o); /** - * A cryptographically secure source of entropy. + * 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. */ -const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); /** - * A cryptographically secure source of entropy. + * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. */ -void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); /** - * A signer that is able to perform node-scoped cryptographic operations. + * The genesis hash of the blockchain where the channel is to be opened */ -const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** - * A signer that is able to perform node-scoped cryptographic operations. + * The genesis hash of the blockchain where the channel is to be opened */ -void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * The short channel ID */ -const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * The short channel ID */ -void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *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. + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t 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. + * Flags pertaining to this message. */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint8_t UnsignedChannelUpdate_get_message_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * 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. + * Flags pertaining to this message. */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); +void UnsignedChannelUpdate_set_message_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Flags pertaining to the channel, including to which direction in the channel this update + * applies and whether the direction is currently able to forward HTLCs. */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint8_t UnsignedChannelUpdate_get_channel_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Flags pertaining to the channel, including to which direction in the channel this update + * applies and whether the direction is currently able to forward HTLCs. */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +void UnsignedChannelUpdate_set_channel_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. - * - * No calls to the router will be made during deserialization. + * 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 struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. - * - * No calls to the router will be made during deserialization. + * 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 ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * The minimum HTLC size incoming to sender, in milli-satoshi */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t 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 maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *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 maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); +void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *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 base HTLC fee charged by sender, in milli-satoshi */ -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); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write + * The base HTLC fee charged by sender, in milli-satoshi */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. + * The amount to fee multiplier, in micro-satoshi */ -void ExpandedKey_free(struct LDKExpandedKey this_obj); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * 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. + * The amount to fee multiplier, in micro-satoshi */ -MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * 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. + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * 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. + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. * - * [phantom node payments]: crate::sign::PhantomKeysManager - * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material + * Returns a copy of the field. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * 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. + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. * - * [phantom node payments]: crate::sign::PhantomKeysManager + * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. */ -struct LDKCResult_ThirtyTwoBytesNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Frees any resources used by the DecodeError + * Constructs a new UnsignedChannelUpdate given each field */ -void DecodeError_free(struct LDKDecodeError 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 message_flags_arg, uint8_t channel_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); /** - * Creates a copy of the DecodeError + * Creates a copy of the UnsignedChannelUpdate */ -struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); /** - * Utility method to constructs a new UnknownVersion-variant DecodeError + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. */ -struct LDKDecodeError DecodeError_unknown_version(void); +uint64_t UnsignedChannelUpdate_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR o); /** - * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError + * 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. */ -struct LDKDecodeError DecodeError_unknown_required_feature(void); +bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); /** - * Utility method to constructs a new InvalidValue-variant DecodeError + * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKDecodeError DecodeError_invalid_value(void); +void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** - * Utility method to constructs a new ShortRead-variant DecodeError + * A signature of the channel update */ -struct LDKDecodeError DecodeError_short_read(void); +struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BadLengthDescriptor-variant DecodeError + * A signature of the channel update */ -struct LDKDecodeError DecodeError_bad_length_descriptor(void); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Utility method to constructs a new Io-variant DecodeError + * The actual channel update */ -struct LDKDecodeError DecodeError_io(enum LDKIOError a); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new UnsupportedCompression-variant DecodeError + * The actual channel update */ -struct LDKDecodeError DecodeError_unsupported_compression(void); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); /** - * Checks if two DecodeErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Constructs a new ChannelUpdate given each field */ -bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** - * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelUpdate */ -void Init_free(struct LDKInit this_obj); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); /** - * The relevant features which the sender supports. + * Generates a non-cryptographic 64-bit hash of the ChannelUpdate. */ -struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); +uint64_t ChannelUpdate_hash(const struct LDKChannelUpdate *NONNULL_PTR o); /** - * The relevant features which the sender supports. + * 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. */ -void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); /** - * Indicates chains the sender is interested in. - * - * If there are no common chains, the connection will be closed. - * - * Returns a copy of the field. + * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); +void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); /** - * Indicates chains the sender is interested in. - * - * If there are no common chains, the connection will be closed. + * The genesis hash of the blockchain being queried */ -void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The genesis hash of the blockchain being queried */ -struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The receipient's network address. - * - * This adds the option to report a remote IP address back to a connecting peer using the init - * message. A node can decide to use that information to discover a potential update to its - * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing - * the new address. + * The height of the first block for the channel UTXOs being queried */ -void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * Constructs a new Init given each field + * The height of the first block for the channel UTXOs being queried */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the Init + * The number of blocks to include in the query results */ -struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * 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. + * The number of blocks to include in the query results */ -bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. + * Constructs a new QueryChannelRange given each field */ -void ErrorMessage_free(struct LDKErrorMessage this_obj); +MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); /** - * 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. + * Creates a copy of the QueryChannelRange */ -const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32]; +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); /** - * 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. + * Generates a non-cryptographic 64-bit hash of the QueryChannelRange. */ -void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t QueryChannelRange_hash(const struct LDKQueryChannelRange *NONNULL_PTR o); /** - * 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. + * 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. */ -struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); +bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); /** - * 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 ReplyChannelRange, if is_owned is set and inner is non-NULL. */ -void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); /** - * Constructs a new ErrorMessage given each field + * The genesis hash of the blockchain being queried */ -MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the ErrorMessage + * The genesis hash of the blockchain being queried */ -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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. + * The height of the first block in the range of the reply */ -bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. + * The height of the first block in the range of the reply */ -void WarningMessage_free(struct LDKWarningMessage this_obj); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID involved in the warning. - * - * All-0s indicates a warning unrelated to a specific channel. + * The number of blocks included in the range of the reply */ -const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32]; +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * The channel ID involved in the warning. - * - * All-0s indicates a warning unrelated to a specific channel. + * The number of blocks included in the range of the reply */ -void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t 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. + * True when this is the final reply for a query */ -struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); +bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *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. + * True when this is the final reply for a query */ -void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); +void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new WarningMessage given each field + * The `short_channel_id`s in the channel range + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg); +struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Creates a copy of the WarningMessage + * The `short_channel_id`s in the channel range */ -struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * 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. + * Constructs a new ReplyChannelRange given each field */ -bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *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 Ping, if is_owned is set and inner is non-NULL. + * Creates a copy of the ReplyChannelRange */ -void Ping_free(struct LDKPing this_obj); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); /** - * The desired response length. + * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. */ -uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); +uint64_t ReplyChannelRange_hash(const struct LDKReplyChannelRange *NONNULL_PTR o); /** - * The desired response length. + * 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. */ -void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); /** - * The ping packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. */ -uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); /** - * The ping packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * The genesis hash of the blockchain being queried */ -void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** - * Constructs a new Ping given each field + * The genesis hash of the blockchain being queried */ -MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a copy of the Ping + * The short_channel_ids that are being queried + * + * Returns a copy of the field. */ -struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); /** - * 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. + * The short_channel_ids that are being queried */ -bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. + * Constructs a new QueryShortChannelIds given each field */ -void Pong_free(struct LDKPong this_obj); +MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * The pong packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Creates a copy of the QueryShortChannelIds */ -uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); /** - * The pong packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. */ -void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); +uint64_t QueryShortChannelIds_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR o); /** - * Constructs a new Pong given each field + * 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. */ -MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); +bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); /** - * Creates a copy of the Pong + * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. */ -struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); /** - * 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. + * The genesis hash of the blockchain that was queried */ -bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. + * The genesis hash of the blockchain that was queried */ -void OpenChannel_free(struct LDKOpenChannel this_obj); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The genesis hash of the blockchain where the channel is to be opened + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); /** - * A temporary channel ID, until the funding outpoint is announced + * Constructs a new ReplyShortChannelIdsEnd given each field */ -const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); /** - * A temporary channel ID, until the funding outpoint is announced + * Creates a copy of the ReplyShortChannelIdsEnd */ -void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); /** - * The channel value + * Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. */ -uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +uint64_t ReplyShortChannelIdsEnd_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR o); /** - * The channel value + * 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. */ -void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. */ -uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * The genesis hash of the blockchain for channel and node information */ -void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The genesis hash of the blockchain for channel and node information */ -uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * The starting unix timestamp */ -void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The starting unix timestamp */ -uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * The range of information in seconds */ -void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * The range of information in seconds */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Constructs a new GossipTimestampFilter given each field */ -void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Creates a copy of the GossipTimestampFilter */ -uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. */ -void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +uint64_t GossipTimestampFilter_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR o); /** - * The feerate per 1000-weight of sender generated transactions, until updated by - * [`UpdateFee`] + * 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. */ -uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); /** - * The feerate per 1000-weight of sender generated transactions, until updated by - * [`UpdateFee`] + * Frees any resources used by the ErrorAction */ -void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val); +void ErrorAction_free(struct LDKErrorAction this_ptr); /** - * 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 ErrorAction */ -uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if - * they broadcast a commitment transaction + * Utility method to constructs a new DisconnectPeer-variant ErrorAction */ -void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); /** - * The maximum number of inbound HTLCs towards sender + * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction */ -uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg); /** - * The maximum number of inbound HTLCs towards sender + * Utility method to constructs a new IgnoreError-variant ErrorAction */ -void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKErrorAction ErrorAction_ignore_error(void); /** - * The sender's key controlling the funding transaction + * Utility method to constructs a new IgnoreAndLog-variant ErrorAction */ -struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); /** - * The sender's key controlling the funding transaction + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction */ -void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Utility method to constructs a new SendErrorMessage-variant ErrorAction */ -struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Utility method to constructs a new SendWarningMessage-variant ErrorAction */ -void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); /** - * A payment key to sender for transactions broadcast by counterparty + * Generates a non-cryptographic 64-bit hash of the ErrorAction. */ -struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +uint64_t ErrorAction_hash(const struct LDKErrorAction *NONNULL_PTR o); /** - * A payment key to sender for transactions broadcast by counterparty + * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. */ -void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void LightningError_free(struct LDKLightningError this_obj); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * A human-readable message describing the error */ -struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * A human-readable message describing the error */ -void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Used to derive an HTLC payment key to sender + * The action which should be taken against the offending peer. */ -struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * Used to derive an HTLC payment key to sender + * The action which should be taken against the offending peer. */ -void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Constructs a new LightningError given each field */ -struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Creates a copy of the LightningError */ -void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); /** - * The channel flags to be used + * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. */ -uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); /** - * The channel flags to be used + * `update_add_htlc` messages which should be sent */ -void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); +struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close + * `update_add_htlc` messages which should be sent */ -struct LDKCOption_CVec_u8ZZ OpenChannel_get_shutdown_scriptpubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** - * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close + * `update_fulfill_htlc` messages which should be sent */ -void OpenChannel_set_shutdown_scriptpubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent - * - * If this is `None`, we derive the channel type from the intersection of our - * feature bits with our counterparty's feature bits from the [`Init`] message. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * `update_fulfill_htlc` messages which should be sent */ -struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** - * 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 + * `update_fail_htlc` messages which should be sent */ -void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Constructs a new OpenChannel given each field - * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * `update_fail_htlc` messages which should be sent */ -MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t push_msat_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t feerate_per_kw_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** - * Creates a copy of the OpenChannel + * `update_fail_malformed_htlc` messages which should be sent */ -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * 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. + * `update_fail_malformed_htlc` messages which should be sent */ -bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** - * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL. + * 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 OpenChannelV2_free(struct LDKOpenChannelV2 this_obj); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * 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 (*OpenChannelV2_get_chain_hash(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr))[32]; +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** - * The genesis hash of the blockchain where the channel is to be opened + * A `commitment_signed` message which should be sent */ -void OpenChannelV2_set_chain_hash(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint + * A `commitment_signed` message which should be sent */ -const uint8_t (*OpenChannelV2_get_temporary_channel_id(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr))[32]; +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); /** - * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint + * Constructs a new CommitmentUpdate given each field + * + * Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void OpenChannelV2_set_temporary_channel_id(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes 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); /** - * The feerate for the funding transaction set by the channel initiator + * Creates a copy of the CommitmentUpdate */ -uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); /** - * The feerate for the funding transaction set by the channel initiator + * Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. */ -void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +uint64_t CommitmentUpdate_hash(const struct LDKCommitmentUpdate *NONNULL_PTR o); /** - * The feerate for the commitment transaction set by the channel initiator + * 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. */ -uint32_t OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); /** - * The feerate for the commitment transaction set by the channel initiator + * Calls the free function if one is set */ -void OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); /** - * Part of the channel value contributed by the channel initiator + * Calls the free function if one is set */ -uint64_t OpenChannelV2_get_funding_satoshis(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); /** - * Part of the channel value contributed by the channel initiator + * Calls the free function if one is set */ -void OpenChannelV2_set_funding_satoshis(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted + * Frees any resources used by the FinalOnionHopData, if is_owned is set and inner is non-NULL. */ -uint64_t OpenChannelV2_get_dust_limit_satoshis(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +void FinalOnionHopData_free(struct LDKFinalOnionHopData this_obj); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. */ -void OpenChannelV2_set_dust_limit_satoshis(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*FinalOnionHopData_get_payment_secret(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr))[32]; /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. */ -uint64_t OpenChannelV2_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +void FinalOnionHopData_set_payment_secret(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. */ -void OpenChannelV2_set_max_htlc_value_in_flight_msat(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +uint64_t FinalOnionHopData_get_total_msat(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr); /** - * The minimum HTLC size incoming to channel initiator, in milli-satoshi + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. */ -uint64_t OpenChannelV2_get_htlc_minimum_msat(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +void FinalOnionHopData_set_total_msat(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, uint64_t val); /** - * The minimum HTLC size incoming to channel initiator, in milli-satoshi + * Constructs a new FinalOnionHopData given each field */ -void OpenChannelV2_set_htlc_minimum_msat(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyTwoBytes payment_secret_arg, uint64_t total_msat_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 FinalOnionHopData */ -uint16_t OpenChannelV2_get_to_self_delay(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig); /** - * 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 OnionPacket, if is_owned is set and inner is non-NULL. */ -void OpenChannelV2_set_to_self_delay(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint16_t val); +void OnionPacket_free(struct LDKOnionPacket this_obj); /** - * The maximum number of inbound HTLCs towards channel initiator + * BOLT 4 version number. */ -uint16_t OpenChannelV2_get_max_accepted_htlcs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +uint8_t OnionPacket_get_version(const struct LDKOnionPacket *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards channel initiator + * BOLT 4 version number. */ -void OpenChannelV2_set_max_accepted_htlcs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint16_t val); +void OnionPacket_set_version(struct LDKOnionPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * The locktime for the funding transaction + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. + * + * Returns a copy of the field. */ -uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCResult_PublicKeySecp256k1ErrorZ OnionPacket_get_public_key(const struct LDKOnionPacket *NONNULL_PTR this_ptr); /** - * The locktime for the funding transaction + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. */ -void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +void OnionPacket_set_public_key(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKCResult_PublicKeySecp256k1ErrorZ val); /** - * The channel initiator's key controlling the funding transaction + * HMAC to verify the integrity of hop_data. */ -struct LDKPublicKey OpenChannelV2_get_funding_pubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +const uint8_t (*OnionPacket_get_hmac(const struct LDKOnionPacket *NONNULL_PTR this_ptr))[32]; /** - * The channel initiator's key controlling the funding transaction + * HMAC to verify the integrity of hop_data. */ -void OpenChannelV2_set_funding_pubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void OnionPacket_set_hmac(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Creates a copy of the OnionPacket */ -struct LDKPublicKey OpenChannelV2_get_revocation_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKOnionPacket OnionPacket_clone(const struct LDKOnionPacket *NONNULL_PTR orig); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Generates a non-cryptographic 64-bit hash of the OnionPacket. */ -void OpenChannelV2_set_revocation_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t OnionPacket_hash(const struct LDKOnionPacket *NONNULL_PTR o); /** - * A payment key to channel initiator for transactions broadcast by counterparty + * Checks if two OnionPackets contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKPublicKey OpenChannelV2_get_payment_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +bool OnionPacket_eq(const struct LDKOnionPacket *NONNULL_PTR a, const struct LDKOnionPacket *NONNULL_PTR b); /** - * A payment key to channel initiator for transactions broadcast by counterparty + * Frees any resources used by the TrampolineOnionPacket, if is_owned is set and inner is non-NULL. */ -void OpenChannelV2_set_payment_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TrampolineOnionPacket_free(struct LDKTrampolineOnionPacket this_obj); /** - * Used to derive a payment key to channel initiator for transactions broadcast by channel - * initiator + * Bolt 04 version number */ -struct LDKPublicKey OpenChannelV2_get_delayed_payment_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +uint8_t TrampolineOnionPacket_get_version(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to channel initiator for transactions broadcast by channel - * initiator + * Bolt 04 version number */ -void OpenChannelV2_set_delayed_payment_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TrampolineOnionPacket_set_version(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * Used to derive an HTLC payment key to channel initiator + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKPublicKey OpenChannelV2_get_htlc_basepoint(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKPublicKey TrampolineOnionPacket_get_public_key(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * Used to derive an HTLC payment key to channel initiator + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -void OpenChannelV2_set_htlc_basepoint(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TrampolineOnionPacket_set_public_key(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The first to-be-broadcast-by-channel-initiator transaction's per commitment point + * Encrypted payload for the next hop + * + * Returns a copy of the field. */ -struct LDKPublicKey OpenChannelV2_get_first_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TrampolineOnionPacket_get_hop_data(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * The first to-be-broadcast-by-channel-initiator transaction's per commitment point + * Encrypted payload for the next hop */ -void OpenChannelV2_set_first_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TrampolineOnionPacket_set_hop_data(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The second to-be-broadcast-by-channel-initiator transaction's per commitment point + * HMAC to verify the integrity of hop_data */ -struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +const uint8_t (*TrampolineOnionPacket_get_hmac(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr))[32]; /** - * The second to-be-broadcast-by-channel-initiator transaction's per commitment point + * HMAC to verify the integrity of hop_data */ -void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void TrampolineOnionPacket_set_hmac(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Channel flags + * Constructs a new TrampolineOnionPacket given each field */ -uint8_t OpenChannelV2_get_channel_flags(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTrampolineOnionPacket TrampolineOnionPacket_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); /** - * Channel flags + * Creates a copy of the TrampolineOnionPacket */ -void OpenChannelV2_set_channel_flags(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint8_t val); +struct LDKTrampolineOnionPacket TrampolineOnionPacket_clone(const struct LDKTrampolineOnionPacket *NONNULL_PTR orig); /** - * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we - * collaboratively close + * Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket. */ -struct LDKCOption_CVec_u8ZZ OpenChannelV2_get_shutdown_scriptpubkey(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +uint64_t TrampolineOnionPacket_hash(const struct LDKTrampolineOnionPacket *NONNULL_PTR o); /** - * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we - * collaboratively close + * Checks if two TrampolineOnionPackets 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 OpenChannelV2_set_shutdown_scriptpubkey(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +bool TrampolineOnionPacket_eq(const struct LDKTrampolineOnionPacket *NONNULL_PTR a, const struct LDKTrampolineOnionPacket *NONNULL_PTR b); /** - * 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 + * Serialize the TrampolineOnionPacket object into a byte array which can be read by TrampolineOnionPacket_read */ -struct LDKChannelTypeFeatures OpenChannelV2_get_channel_type(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TrampolineOnionPacket_write(const struct LDKTrampolineOnionPacket *NONNULL_PTR obj); /** - * 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 + * Get the string representation of a DecodeError object */ -void OpenChannelV2_set_channel_type(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +struct LDKStr DecodeError_to_str(const struct LDKDecodeError *NONNULL_PTR o); /** - * Optionally, a requirement that only confirmed inputs can be added + * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ -enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); /** - * Optionally, a requirement that only confirmed inputs can be added + * Read a AcceptChannel from a byte array, created by AcceptChannel_write */ -void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); /** - * Constructs a new OpenChannelV2 given each field - * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read */ -MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKThirtyTwoBytes temporary_channel_id_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj); /** - * Creates a copy of the OpenChannelV2 + * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write */ -struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig); +struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser); /** - * Checks if two OpenChannelV2s 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 Stfu object into a byte array which can be read by Stfu_read */ -bool OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b); +struct LDKCVec_u8Z Stfu_write(const struct LDKStfu *NONNULL_PTR obj); /** - * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. + * Read a Stfu from a byte array, created by Stfu_write */ -void AcceptChannel_free(struct LDKAcceptChannel this_obj); +struct LDKCResult_StfuDecodeErrorZ Stfu_read(struct LDKu8slice ser); /** - * A temporary channel ID, until the funding outpoint is announced + * Serialize the SpliceInit object into a byte array which can be read by SpliceInit_read */ -const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z SpliceInit_write(const struct LDKSpliceInit *NONNULL_PTR obj); /** - * A temporary channel ID, until the funding outpoint is announced + * Read a SpliceInit from a byte array, created by SpliceInit_write */ -void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_SpliceInitDecodeErrorZ SpliceInit_read(struct LDKu8slice ser); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read */ -uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z SpliceAck_write(const struct LDKSpliceAck *NONNULL_PTR obj); /** - * The threshold below which outputs on transactions broadcast by sender will be omitted + * Read a SpliceAck from a byte array, created by SpliceAck_write */ -void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_SpliceAckDecodeErrorZ SpliceAck_read(struct LDKu8slice ser); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read */ -uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z SpliceLocked_write(const struct LDKSpliceLocked *NONNULL_PTR obj); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * Read a SpliceLocked from a byte array, created by SpliceLocked_write */ -void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_SpliceLockedDecodeErrorZ SpliceLocked_read(struct LDKu8slice ser); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Read a TxAddInput from a byte array, created by TxAddInput_write */ -void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read */ -uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Read a TxAddOutput from a byte array, created by TxAddOutput_write */ -void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser); /** - * Minimum depth of the funding transaction before the channel is considered open + * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read */ -uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj); /** - * Minimum depth of the funding transaction before the channel is considered open + * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write */ -void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read */ -uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction + * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write */ -void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser); /** - * The maximum number of inbound HTLCs towards sender + * Serialize the TxComplete object into a byte array which can be read by TxComplete_read */ -uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj); /** - * The maximum number of inbound HTLCs towards sender + * Read a TxComplete from a byte array, created by TxComplete_write */ -void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser); /** - * The sender's key controlling the funding transaction + * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read */ -struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj); /** - * The sender's key controlling the funding transaction + * Read a TxSignatures from a byte array, created by TxSignatures_write */ -void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read */ -struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Read a TxInitRbf from a byte array, created by TxInitRbf_write */ -void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser); /** - * A payment key to sender for transactions broadcast by counterparty + * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read */ -struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj); /** - * A payment key to sender for transactions broadcast by counterparty + * Read a TxAckRbf from a byte array, created by TxAckRbf_write */ -void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Serialize the TxAbort object into a byte array which can be read by TxAbort_read */ -struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj); /** - * Used to derive a payment key to sender for transactions broadcast by sender + * Read a TxAbort from a byte array, created by TxAbort_write */ -void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser); /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read */ -struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); /** - * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty + * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write */ -void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read */ -struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); /** - * The first to-be-broadcast-by-sender transaction's per commitment point + * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write */ -void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); /** - * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close + * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read */ -struct LDKCOption_CVec_u8ZZ AcceptChannel_get_shutdown_scriptpubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); /** - * A request to pre-set the to-sender output's scriptPubkey for when we collaboratively close + * Read a ClosingSigned from a byte array, created by ClosingSigned_write */ -void AcceptChannel_set_shutdown_scriptpubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); /** - * 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 + * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read */ -struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); /** - * 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 + * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write */ -void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); /** - * Constructs a new AcceptChannel given each field - * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the CommitmentSignedBatch object into a byte array which can be read by CommitmentSignedBatch_read */ -MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t channel_reserve_satoshis_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +struct LDKCVec_u8Z CommitmentSignedBatch_write(const struct LDKCommitmentSignedBatch *NONNULL_PTR obj); /** - * Creates a copy of the AcceptChannel + * Read a CommitmentSignedBatch from a byte array, created by CommitmentSignedBatch_write */ -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CommitmentSignedBatch_read(struct LDKu8slice ser); /** - * 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. + * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read */ -bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); /** - * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL. + * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write */ -void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); /** - * The same `temporary_channel_id` received from the initiator's `open_channel2` message. + * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read */ -const uint8_t (*AcceptChannelV2_get_temporary_channel_id(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); /** - * The same `temporary_channel_id` received from the initiator's `open_channel2` message. + * Read a FundingCreated from a byte array, created by FundingCreated_write */ -void AcceptChannelV2_set_temporary_channel_id(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); /** - * Part of the channel value contributed by the channel acceptor + * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read */ -uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); /** - * Part of the channel value contributed by the channel acceptor + * Read a FundingSigned from a byte array, created by FundingSigned_write */ -void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); /** - * The threshold below which outputs on transactions broadcast by the channel acceptor will be - * omitted + * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read */ -uint64_t AcceptChannelV2_get_dust_limit_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); /** - * The threshold below which outputs on transactions broadcast by the channel acceptor will be - * omitted + * Read a ChannelReady from a byte array, created by ChannelReady_write */ -void AcceptChannelV2_set_dust_limit_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); /** - * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi + * Serialize the Init object into a byte array which can be read by Init_read */ -uint64_t AcceptChannelV2_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); /** - * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi + * Read a Init from a byte array, created by Init_write */ -void AcceptChannelV2_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); /** - * The minimum HTLC size incoming to channel acceptor, in milli-satoshi + * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read */ -uint64_t AcceptChannelV2_get_htlc_minimum_msat(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); /** - * The minimum HTLC size incoming to channel acceptor, in milli-satoshi + * Read a OpenChannel from a byte array, created by OpenChannel_write */ -void AcceptChannelV2_set_htlc_minimum_msat(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); /** - * Minimum depth of the funding transaction before the channel is considered open + * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read */ -uint32_t AcceptChannelV2_get_minimum_depth(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj); /** - * Minimum depth of the funding transaction before the channel is considered open + * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write */ -void AcceptChannelV2_set_minimum_depth(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read */ -uint16_t AcceptChannelV2_get_to_self_delay(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write */ -void AcceptChannelV2_set_to_self_delay(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); /** - * The maximum number of inbound HTLCs towards channel acceptor + * Serialize the Shutdown object into a byte array which can be read by Shutdown_read */ -uint16_t AcceptChannelV2_get_max_accepted_htlcs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); /** - * The maximum number of inbound HTLCs towards channel acceptor + * Read a Shutdown from a byte array, created by Shutdown_write */ -void AcceptChannelV2_set_max_accepted_htlcs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); /** - * The channel acceptor's key controlling the funding transaction + * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read */ -struct LDKPublicKey AcceptChannelV2_get_funding_pubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); /** - * The channel acceptor's key controlling the funding transaction + * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write */ -void AcceptChannelV2_set_funding_pubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read */ -struct LDKPublicKey AcceptChannelV2_get_revocation_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write */ -void AcceptChannelV2_set_revocation_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); /** - * A payment key to channel acceptor for transactions broadcast by counterparty + * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read */ -struct LDKPublicKey AcceptChannelV2_get_payment_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); /** - * A payment key to channel acceptor for transactions broadcast by counterparty + * Read a UpdateFee from a byte array, created by UpdateFee_write */ -void AcceptChannelV2_set_payment_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); /** - * Used to derive a payment key to channel acceptor for transactions broadcast by channel - * acceptor + * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read */ -struct LDKPublicKey AcceptChannelV2_get_delayed_payment_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); /** - * Used to derive a payment key to channel acceptor for transactions broadcast by channel - * acceptor + * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write */ -void AcceptChannelV2_set_delayed_payment_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); /** - * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty + * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read */ -struct LDKPublicKey AcceptChannelV2_get_htlc_basepoint(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OnionPacket_write(const struct LDKOnionPacket *NONNULL_PTR obj); /** - * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty + * Read a OnionPacket from a byte array, created by OnionPacket_write */ -void AcceptChannelV2_set_htlc_basepoint(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_OnionPacketDecodeErrorZ OnionPacket_read(struct LDKu8slice ser); /** - * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read */ -struct LDKPublicKey AcceptChannelV2_get_first_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); /** - * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write */ -void AcceptChannelV2_set_first_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); /** - * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Read a OnionMessage from a byte array, created by OnionMessage_write */ -struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); /** - * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read */ -void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); /** - * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we - * collaboratively close + * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read */ -struct LDKCOption_CVec_u8ZZ AcceptChannelV2_get_shutdown_scriptpubkey(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z FinalOnionHopData_write(const struct LDKFinalOnionHopData *NONNULL_PTR obj); /** - * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we - * collaboratively close + * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write */ -void AcceptChannelV2_set_shutdown_scriptpubkey(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCResult_FinalOnionHopDataDecodeErrorZ FinalOnionHopData_read(struct LDKu8slice ser); /** - * 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 [`OpenChannelV2::channel_type`]. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the Ping object into a byte array which can be read by Ping_read */ -struct LDKChannelTypeFeatures AcceptChannelV2_get_channel_type(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); /** - * 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 [`OpenChannelV2::channel_type`]. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a Ping from a byte array, created by Ping_write */ -void AcceptChannelV2_set_channel_type(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); /** - * Optionally, a requirement that only confirmed inputs can be added + * Serialize the Pong object into a byte array which can be read by Pong_read */ -enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); /** - * Optionally, a requirement that only confirmed inputs can be added + * Read a Pong from a byte array, created by Pong_write */ -void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); /** - * Constructs a new AcceptChannelV2 given each field - * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read */ -MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, uint64_t funding_satoshis_arg, uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t minimum_depth_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg, struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_basepoint_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg, struct LDKPublicKey first_per_commitment_point_arg, struct LDKPublicKey second_per_commitment_point_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); /** - * Creates a copy of the AcceptChannelV2 + * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write */ -struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); /** - * Checks if two AcceptChannelV2s 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 ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read */ -bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); /** - * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. + * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write */ -void FundingCreated_free(struct LDKFundingCreated this_obj); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); /** - * A temporary channel ID, until the funding is established + * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read */ -const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); /** - * A temporary channel ID, until the funding is established + * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write */ -void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); /** - * The funding transaction ID + * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read */ -const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); /** - * The funding transaction ID + * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write */ -void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); /** - * The specific output index funding this channel + * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read */ -uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); /** - * The specific output index funding this channel + * Read a ErrorMessage from a byte array, created by ErrorMessage_write */ -void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read */ -struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * Read a WarningMessage from a byte array, created by WarningMessage_write */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); /** - * Constructs a new FundingCreated given each field + * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read */ -MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_arg); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); /** - * Creates a copy of the FundingCreated + * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write */ -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); /** - * 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. + * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read */ -bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); /** - * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. + * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write */ -void FundingSigned_free(struct LDKFundingSigned this_obj); +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); /** - * The channel ID + * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write */ -const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read */ -void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read */ -struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); /** - * Constructs a new FundingSigned 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 LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg); +MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); /** - * Creates a copy of the FundingSigned + * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read */ -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); /** - * 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. + * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write */ -bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); /** - * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. + * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write */ -void ChannelReady_free(struct LDKChannelReady 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 (*ChannelReady_get_channel_id(const struct LDKChannelReady *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 ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); /** - * The per-commitment point of the second commitment transaction + * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write */ -struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); /** - * The per-commitment point of the second commitment transaction + * Calls the free function if one is set */ -void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void CustomMessageHandler_free(struct LDKCustomMessageHandler 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. + * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); +void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); /** - * 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. + * Constructs a new IgnoringMessageHandler given each field */ -void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); /** - * Constructs a new ChannelReady given each field + * 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 struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); +struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelReady + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); +struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * 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. + * 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 */ -bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); +struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL. + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is */ -void TxAddInput_free(struct LDKTxAddInput this_obj); +struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The channel ID + * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is */ -const uint8_t (*TxAddInput_get_channel_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr))[32]; +struct LDKAsyncPaymentsMessageHandler IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(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 TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * A randomly chosen unique identifier for this input, which is even for initiators and odd for - * non-initiators. + * 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 TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * A randomly chosen unique identifier for this input, which is even for initiators and odd for - * non-initiators. + * 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 TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Serialized transaction that contains the output this input spends to verify that it is non - * malleable. + * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. */ -struct LDKTransactionU16LenLimited TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); /** - * Serialized transaction that contains the output this input spends to verify that it is non - * malleable. + * Constructs a new ErroringMessageHandler */ -void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKTransactionU16LenLimited val); +MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); /** - * The index of the output being spent + * 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 */ -uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * The index of the output being spent + * 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 TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); +struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * The sequence number of this input + * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. */ -uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +void MessageHandler_free(struct LDKMessageHandler this_obj); /** - * The sequence number of this input + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Constructs a new TxAddInput given each field + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg, struct LDKTransactionU16LenLimited prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** - * Creates a copy of the TxAddInput + * 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 LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Checks if two TxAddInputs 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 updating our knowledge of the network channel + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. + * + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ -bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); /** - * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL. + * A message handler which handles onion messages. This should generally be an + * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ -void TxAddOutput_free(struct LDKTxAddOutput this_obj); +const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * The channel ID + * A message handler which handles onion messages. This should generally be an + * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ -const uint8_t (*TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr))[32]; +void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); /** - * The channel ID + * A message handler which handles custom messages. The only LDK-provided implementation is + * [`IgnoringMessageHandler`]. */ -void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * A randomly chosen unique identifier for this output, which is even for initiators and odd for - * non-initiators. + * A message handler which handles custom messages. The only LDK-provided implementation is + * [`IgnoringMessageHandler`]. */ -uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val); /** - * A randomly chosen unique identifier for this output, which is even for initiators and odd for - * non-initiators. + * Constructs a new MessageHandler given each field */ -void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg, struct LDKCustomMessageHandler custom_message_handler_arg); /** - * The satoshi value of the output + * Creates a copy of a SocketDescriptor */ -uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** - * The satoshi value of the output + * Calls the free function if one is set */ -void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); +void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); /** - * The scriptPubKey for the output + * Frees any resources used by the PeerDetails, if is_owned is set and inner is non-NULL. */ -struct LDKu8slice TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +void PeerDetails_free(struct LDKPeerDetails this_obj); /** - * The scriptPubKey for the output + * The node id of the peer. + * + * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`PeerManager::new_outbound_connection`]. */ -void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKPublicKey PeerDetails_get_counterparty_node_id(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Constructs a new TxAddOutput given each field + * The node id of the peer. + * + * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`PeerManager::new_outbound_connection`]. */ -MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg); +void PeerDetails_set_counterparty_node_id(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the TxAddOutput + * The socket address the peer provided in the initial handshake. + * + * Will only be `Some` if an address had been previously provided to + * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. + * + * Returns a copy of the field. */ -struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig); +struct LDKCOption_SocketAddressZ PeerDetails_get_socket_address(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Checks if two TxAddOutputs 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 socket address the peer provided in the initial handshake. + * + * Will only be `Some` if an address had been previously provided to + * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. */ -bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b); +void PeerDetails_set_socket_address(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** - * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL. + * The features the peer provided in the initial handshake. */ -void TxRemoveInput_free(struct LDKTxRemoveInput this_obj); +struct LDKInitFeatures PeerDetails_get_init_features(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * The channel ID + * The features the peer provided in the initial handshake. */ -const uint8_t (*TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr))[32]; +void PeerDetails_set_init_features(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * The channel ID + * Indicates the direction of the peer connection. + * + * Will be `true` for inbound connections, and `false` for outbound connections. */ -void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool PeerDetails_get_is_inbound_connection(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * The serial ID of the input to be removed + * Indicates the direction of the peer connection. + * + * Will be `true` for inbound connections, and `false` for outbound connections. */ -uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); +void PeerDetails_set_is_inbound_connection(struct LDKPeerDetails *NONNULL_PTR this_ptr, bool val); /** - * The serial ID of the input to be removed + * Constructs a new PeerDetails given each field */ -void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPeerDetails PeerDetails_new(struct LDKPublicKey counterparty_node_id_arg, struct LDKCOption_SocketAddressZ socket_address_arg, struct LDKInitFeatures init_features_arg, bool is_inbound_connection_arg); /** - * Constructs a new TxRemoveInput given each field + * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg); +void PeerHandleError_free(struct LDKPeerHandleError this_obj); /** - * Creates a copy of the TxRemoveInput + * Constructs a new PeerHandleError given each field */ -struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); /** - * Checks if two TxRemoveInputs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Creates a copy of the PeerHandleError */ -bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); /** - * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL. + * Get the string representation of a PeerHandleError object */ -void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj); +struct LDKStr PeerHandleError_to_str(const struct LDKPeerHandleError *NONNULL_PTR o); /** - * The channel ID + * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. */ -const uint8_t (*TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr))[32]; +void PeerManager_free(struct LDKPeerManager this_obj); /** - * The channel ID + * 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. */ -void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +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 LDKNodeSigner node_signer); /** - * The serial ID of the output to be removed + * Returns a list of [`PeerDetails`] for connected peers that have completed the initial + * handshake. */ -uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_PeerDetailsZ PeerManager_list_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * The serial ID of the output to be removed + * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake. + * + * Will return `None` if the peer is unknown or it hasn't completed the initial handshake. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPeerDetails PeerManager_peer_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id); /** - * Constructs a new TxRemoveOutput given each field + * 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 */ -MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t serial_id_arg); +MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); /** - * Creates a copy of the TxRemoveOutput + * 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 */ -struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); /** - * Checks if two TxRemoveOutputs 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. + * 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 */ -bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL. + * 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 TxComplete_free(struct LDKTxComplete this_obj); +MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** - * The channel ID + * 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 (*TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr))[32]; +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * The channel ID + * Indicates that the given socket descriptor's connection is now closed. */ -void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * Constructs a new TxComplete given each field + * 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 */ -MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKThirtyTwoBytes channel_id_arg); +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * Creates a copy of the TxComplete + * 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. */ -struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig); +void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Checks if two TxCompletes 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. + * 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 */ -bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b); +void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL. + * 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 TxSignatures_free(struct LDKTxSignatures this_obj); +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); /** - * The channel ID + * Gets the weight for an HTLC-Success transaction. */ -const uint8_t (*TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32]; +uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * The channel ID + * Gets the weight for an HTLC-Timeout transaction. */ -void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * The TXID + * Creates a copy of the HTLCClaim */ -const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32]; +enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); /** - * The TXID + * Utility method to constructs a new OfferedTimeout-variant HTLCClaim */ -void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +enum LDKHTLCClaim HTLCClaim_offered_timeout(void); /** - * The list of witnesses - * - * Returns a copy of the field. + * Utility method to constructs a new OfferedPreimage-variant HTLCClaim */ -struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_offered_preimage(void); /** - * The list of witnesses + * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim */ -void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val); +enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); /** - * Constructs a new TxSignatures given each field + * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim */ -MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg); +enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); /** - * Creates a copy of the TxSignatures + * Utility method to constructs a new Revocation-variant HTLCClaim */ -struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig); +enum LDKHTLCClaim HTLCClaim_revocation(void); /** - * Checks if two TxSignaturess contain equal inner contents. + * Checks if two HTLCClaims 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 TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b); +bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); /** - * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL. + * Check if a given input witness attempts to claim a HTLC. */ -void TxInitRbf_free(struct LDKTxInitRbf this_obj); +MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); /** - * The channel ID + * Build the commitment secret from the seed and the commitment number */ -const uint8_t (*TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr))[32]; +struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); /** - * The channel ID + * Build a closing transaction */ -void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +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 locktime of the transaction + * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. */ -uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); /** - * The locktime of the transaction + * Creates a copy of the CounterpartyCommitmentSecrets */ -void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); /** - * The feerate of the transaction + * Creates a new empty `CounterpartyCommitmentSecrets` structure. */ -uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); /** - * The feerate of the transaction + * Returns the minimum index of all stored secrets. Note that indexes start + * at 1 << 48 and get decremented by one for each new secret. */ -void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret + * was generated in accordance with BOLT 3 and is consistent with previous secrets. */ -struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); -/** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction +/** + * 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 */ -void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); +MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); /** - * Constructs a new TxInitRbf given each field + * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read */ -MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg); +struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); /** - * Creates a copy of the TxInitRbf + * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write */ -struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig); +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); /** - * Checks if two TxInitRbfs 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. + * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) + * from the base secret and the per_commitment_point. */ -bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b); +struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** - * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL. + * 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 TxAckRbf_free(struct LDKTxAckRbf this_obj); +struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** - * The channel ID + * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. */ -const uint8_t (*TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr))[32]; +void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); /** - * The channel ID + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * 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 TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); +struct LDKRevocationKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Constructs a new TxAckRbf given each field + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKRevocationKey val); /** - * Creates a copy of the TxAckRbf + * Broadcaster's HTLC Key */ -struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig); +struct LDKHtlcKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Checks if two TxAckRbfs 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. + * Broadcaster's HTLC Key */ -bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b); +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** - * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL. + * Countersignatory's HTLC Key */ -void TxAbort_free(struct LDKTxAbort this_obj); +struct LDKHtlcKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * The channel ID + * Countersignatory's HTLC Key */ -const uint8_t (*TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr))[32]; +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** - * The channel ID + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKDelayedPaymentKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Message data - * - * Returns a copy of the field. + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentKey val); /** - * Message data + * Constructs a new TxCreationKeys given each field */ -void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKRevocationKey revocation_key_arg, struct LDKHtlcKey broadcaster_htlc_key_arg, struct LDKHtlcKey countersignatory_htlc_key_arg, struct LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg); /** - * Constructs a new TxAbort given each field + * 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. */ -MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg); +bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); /** - * Creates a copy of the TxAbort + * Creates a copy of the TxCreationKeys */ -struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); /** - * Checks if two TxAborts 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 TxCreationKeys object into a byte array which can be read by TxCreationKeys_read */ -bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b); +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); /** - * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. + * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write */ -void Shutdown_free(struct LDKShutdown this_obj); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); /** - * The channel ID + * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. */ -const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32]; +void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); /** - * The channel ID + * 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 Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The destination of this peer's funds on closing. - * - * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. + * 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. */ -struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The destination of this peer's funds on closing. - * - * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. + * The base point which is used (with [`RevocationKey::from_basepoint`]) 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 Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKRevocationBasepoint ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Constructs a new Shutdown given each field + * The base point which is used (with [`RevocationKey::from_basepoint`]) 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. */ -MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKRevocationBasepoint val); /** - * Creates a copy of the Shutdown + * 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. */ -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * 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. + * 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. */ -bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. + * 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 ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); +struct LDKDelayedPaymentBasepoint ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * 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). */ -uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentBasepoint val); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * 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 ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +struct LDKHtlcBasepoint ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * 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. */ -uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKHtlcBasepoint val); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Constructs a new ChannelPublicKeys given each field */ -void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKRevocationBasepoint revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg, struct LDKHtlcBasepoint htlc_basepoint_arg); /** - * Constructs a new ClosingSignedFeeRange given each field + * Creates a copy of the ChannelPublicKeys */ -MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); /** - * Creates a copy of the ClosingSignedFeeRange + * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. */ -struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); +uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); /** - * Checks if two ClosingSignedFeeRanges contain equal inner contents. + * 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. */ -bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); +bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); /** - * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. + * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read */ -void ClosingSigned_free(struct LDKClosingSigned this_obj); +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); /** - * The channel ID + * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write */ -const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); /** - * The channel ID + * Create per-state keys from channel base points and the per-commitment point. + * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR broadcaster_delayed_payment_base, const struct LDKHtlcBasepoint *NONNULL_PTR broadcaster_htlc_base, const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_revocation_base, const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_htlc_base); /** - * The proposed total fee for the closing transaction + * 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. */ -uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +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 proposed total fee for the closing transaction + * 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. */ -void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z get_revokeable_redeemscript(const struct LDKRevocationKey *NONNULL_PTR revocation_key, uint16_t contest_delay, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key); /** - * A signature on the closing transaction + * Returns the script for the counterparty's output on a holder's commitment transaction based on + * the channel type. */ -struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); /** - * A signature on the closing transaction + * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); /** - * 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 + * 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 LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * 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 + * 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 ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** - * Constructs a new ClosingSigned given each field - * - * Note that fee_range_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Creates a copy of the ClosingSigned + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * The CLTV lock-time at which this HTLC expires. */ -bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. + * The CLTV lock-time at which this HTLC expires. */ -void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID + * The hash of the preimage which unlocks this HTLC. */ -const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** - * The channel ID + * The hash of the preimage which unlocks this HTLC. */ -void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The HTLC ID + * 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). */ -uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * The HTLC ID + * 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 UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * The HTLC value in milli-satoshi + * Constructs a new HTLCOutputInCommitment given each field */ -uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +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); /** - * The HTLC value in milli-satoshi + * Creates a copy of the HTLCOutputInCommitment */ -void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); /** - * The payment hash, the pre-image of which controls HTLC redemption + * 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. */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); /** - * The payment hash, the pre-image of which controls HTLC redemption + * Converts HTLC's value with millisatoshi precision into [bitcoin::Amount] with satoshi precision. + * Typically this conversion is needed when transitioning from LN into base-layer Bitcoin, + * e. g. in commitment transactions. */ -void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES uint64_t HTLCOutputInCommitment_to_bitcoin_amount(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_arg); /** - * The expiry height of the HTLC + * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); /** - * The expiry height of the HTLC + * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write */ -void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); /** - * The extra fee skimmed by the sender of this message. See - * [`ChannelConfig::accept_underpaying_htlcs`]. - * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc + * does not need to have its previous_output_index filled. */ -struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** - * The extra fee skimmed by the sender of this message. See - * [`ChannelConfig::accept_underpaying_htlcs`]. - * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * Gets the redeemscript for a funding output from the two funding public keys. + * Note that the order of funding public keys does not matter. */ -void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** - * Creates a copy of the UpdateAddHTLC + * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC + * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the + * transaction which needs signing, and can be used to construct an HTLC transaction which is + * broadcastable given a counterparty HTLC signature. + * + * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the + * commitment transaction). */ -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key, const struct LDKRevocationKey *NONNULL_PTR revocation_key); /** - * 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. + * Returns the witness required to satisfy and spend a HTLC input. */ -bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); +struct LDKWitness build_htlc_input_witness(struct LDKECDSASignature local_sig, struct LDKECDSASignature remote_sig, struct LDKCOption_ThirtyTwoBytesZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. + * Gets the witnessScript for the to_remote output when anchors are enabled. */ -void OnionMessage_free(struct LDKOnionMessage this_obj); +struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); /** - * Used in decrypting the onion packet's payload. + * Gets the witnessScript for an anchor output from the funding public key. + * The witness in the spending input must be: + * + * After 16 blocks of confirmation, an alternative satisfying witness could be: + * <> + * (empty vector required to satisfy compliance with MINIMALIF-standard rule) */ -struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** - * Used in decrypting the onion packet's payload. + * Returns the witness required to satisfy and spend an anchor input. */ -void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); /** - * The full onion packet including hop data, pubkey, and hmac + * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); /** - * The full onion packet including hop data, pubkey, and hmac + * Holder public keys */ -void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Constructs a new OnionMessage given each field + * Holder public keys */ -MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Creates a copy of the OnionMessage + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * 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. + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The channel ID + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); /** - * The channel ID + * 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 UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The HTLC ID + * 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 */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); /** - * The HTLC ID + * 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 UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The pre-image of the payment hash, allowing HTLC redemption + * The late-bound funding outpoint + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The pre-image of the payment hash, allowing HTLC redemption + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. */ -void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Constructs a new UpdateFulfillHTLC given each field + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. */ -MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); +void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Creates a copy of the UpdateFulfillHTLC + * Constructs a new ChannelTransactionParameters given each field + * + * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, struct LDKChannelTypeFeatures channel_type_features_arg); /** - * 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. + * Creates a copy of the ChannelTransactionParameters */ -bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); /** - * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. */ -void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); +uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); /** - * The channel ID + * 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. */ -const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32]; +bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b); /** - * The channel ID + * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); /** - * The HTLC ID + * Counter-party public keys */ -uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The HTLC ID + * Counter-party public keys */ -void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Creates a copy of the UpdateFailHTLC + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * 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. + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. + * Constructs a new CounterpartyChannelTransactionParameters given each field */ -void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); +MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); /** - * The channel ID + * Creates a copy of the CounterpartyChannelTransactionParameters */ -const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32]; +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); /** - * The channel ID + * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. */ -void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); /** - * The HTLC ID + * 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. */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b); /** - * The HTLC ID + * Whether the late bound parameters are populated. */ -void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The failure code + * 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. */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The failure code + * 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. */ -void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Creates a copy of the UpdateFailMalformedHTLC + * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read */ -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *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 CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write */ -bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); /** - * Frees any resources used by the CommitmentSigned, 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 CommitmentSigned_free(struct LDKCommitmentSigned this_obj); +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); /** - * The channel ID + * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write */ -const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32]; +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); /** - * The channel ID + * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); /** - * A signature on the commitment transaction + * Get the channel pubkeys for the broadcaster */ -struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * A signature on the commitment transaction + * Get the channel pubkeys for the countersignatory */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Signatures on the HTLC transactions - * - * Returns a copy of the field. + * Get the contest delay applicable to the transactions. + * Note that the contest delay was selected by the countersignatory. */ -struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Signatures on the HTLC transactions + * 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 CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Constructs a new CommitmentSigned given each field + * The funding outpoint */ -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg); +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Creates a copy of the CommitmentSigned + * Whether to use anchors for this channel */ -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * 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. + * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); +void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); /** - * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. + * Our counterparty's signature for the transaction */ -void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); +struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * The channel ID + * Our counterparty's signature for the transaction */ -const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * The channel ID + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * + * Returns a copy of the field. */ -void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * The secret corresponding to the per-commitment point + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** - * The secret corresponding to the per-commitment point + * Creates a copy of the HolderCommitmentTransaction */ -void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read */ -struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write */ -void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); /** - * Constructs a new RevokeAndACK given each field + * Create a new holder transaction with the given counterparty signatures. + * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ -MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); +MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKECDSASignature counterparty_sig, struct LDKCVec_ECDSASignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); /** - * Creates a copy of the RevokeAndACK + * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_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. + * The commitment transaction */ -bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. + * The commitment transaction */ -void UpdateFee_free(struct LDKUpdateFee this_obj); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** - * The channel ID + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32]; +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; /** - * The channel ID + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Fee rate per 1000-weight of the transaction + * Constructs a new BuiltCommitmentTransaction given each field */ -uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); /** - * Fee rate per 1000-weight of the transaction + * Creates a copy of the BuiltCommitmentTransaction */ -void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); /** - * Constructs a new UpdateFee given each field + * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read */ -MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg); +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); /** - * Creates a copy of the UpdateFee + * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write */ -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** - * 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. + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. + * Signs the counterparty's commitment transaction. */ -void ChannelReestablish_free(struct LDKChannelReestablish this_obj); +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * The channel ID + * Signs the holder commitment transaction because we are about to broadcast it. */ -const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * The channel ID + * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. */ -void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ClosingTransaction_free(struct LDKClosingTransaction this_obj); /** - * The next commitment number for the sender + * Creates a copy of the ClosingTransaction */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); /** - * The next commitment number for the sender + * Generates a non-cryptographic 64-bit hash of the ClosingTransaction. */ -void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); /** - * The next commitment number for the recipient + * 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. */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); /** - * The next commitment number for the recipient + * Construct an object of the class */ -void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t 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); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * 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. */ -const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * 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. */ -void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); /** - * The sender's per-commitment point for their current commitment transaction + * The value to be sent to the holder, or zero if the output will be omitted */ -struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The sender's per-commitment point for their current commitment transaction + * The value to be sent to the counterparty, or zero if the output will be omitted */ -void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The next funding transaction ID + * The destination of the holder's output */ -struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The next funding transaction ID + * The destination of the counterparty's output */ -void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Constructs a new ChannelReestablish given each field + * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t next_local_commitment_number_arg, uint64_t next_remote_commitment_number_arg, struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg, struct LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg); +void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); /** - * Creates a copy of the ChannelReestablish + * The pre-built Bitcoin commitment transaction */ -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *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. + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); +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); /** - * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. */ -void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); +MUST_USE_RES struct LDKECDSASignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * The channel ID + * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. */ -const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32]; +void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); /** - * The channel ID + * Creates a copy of the CommitmentTransaction */ -void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); /** - * The short channel ID + * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read */ -uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); /** - * The short channel ID + * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write */ -void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); /** - * A signature by the node key + * The backwards-counting commitment number */ -struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * A signature by the node key + * The per commitment point used by the broadcaster. */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * A signature by the funding key + * The value to be sent to the broadcaster */ -struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * A signature by the funding key + * The value to be sent to the counterparty */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Constructs a new AnnouncementSignatures given each field + * The feerate paid per 1000-weight-unit in this commitment transaction. */ -MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); +MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Creates a copy of the AnnouncementSignatures + * 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 LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * 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. + * 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. */ -bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); +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); /** - * Frees any resources used by the SocketAddress + * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void SocketAddress_free(struct LDKSocketAddress this_ptr); +void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); /** - * Creates a copy of the SocketAddress + * The transaction ID of the built Bitcoin transaction */ -struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Utility method to constructs a new TcpIpV4-variant SocketAddress + * The pre-built Bitcoin commitment transaction */ -struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Utility method to constructs a new TcpIpV6-variant SocketAddress + * The pre-calculated transaction creation public keys. */ -struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OnionV2-variant SocketAddress + * Should anchors be used. */ -struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); +MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OnionV3-variant SocketAddress + * 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 LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +MUST_USE_RES struct LDKCResult_CVec_ECDSASignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Utility method to constructs a new Hostname-variant SocketAddress + * Returns the index of the revokeable output, i.e. the `to_local` output sending funds to + * the broadcaster, in the built transaction, if any exists. + * + * There are two cases where this may return `None`: + * - The balance of the revokeable output is below the dust limit (only found on commitments + * early in the channel's lifetime, i.e. before the channel reserve is met). + * - This commitment was created before LDK 0.0.117. In this case, the + * commitment transaction previously didn't contain enough information to locate the + * revokeable output. */ -struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); +MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * Checks if two SocketAddresss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Helper method to build an unsigned justice transaction spending the revokeable + * `to_local` output to a destination script. Fee estimation accounts for the expected + * revocation witness data that will be added when signed. + * + * This method will error if the given fee rate results in a fee greater than the value + * of the output being spent, or if there exists no revokeable `to_local` output on this + * commitment transaction. See [`Self::revokeable_output_index`] for more details. + * + * The built transaction will allow fee bumping with RBF, and this method takes + * `feerate_per_kw` as an input such that multiple copies of a justice transaction at different + * fee rates may be built. */ -bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_build_to_local_justice_tx(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, uint64_t feerate_per_kw, struct LDKCVec_u8Z destination_script); /** - * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_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 SocketAddress_write(const struct LDKSocketAddress *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 SocketAddress from a byte array, created by SocketAddress_write + * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read */ -struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); /** - * Creates a copy of the SocketAddressParseError + * Read a InitFeatures from a byte array, created by InitFeatures_write */ -enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError + * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read */ -enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); /** - * Utility method to constructs a new InvalidInput-variant SocketAddressParseError + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); /** - * Utility method to constructs a new InvalidPort-variant SocketAddressParseError + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); /** - * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError + * Read a NodeFeatures from a byte array, created by NodeFeatures_write */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); /** - * Checks if two SocketAddressParseErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read */ -bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); +struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); /** - * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. - * - * The host part must end with \".onion\". + * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); /** - * Get the string representation of a SocketAddress object + * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read */ -struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); +struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); /** - * Read a SocketAddress object from a string + * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); /** - * Frees any resources used by the UnsignedGossipMessage + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read */ -void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); +struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); /** - * Creates a copy of the UnsignedGossipMessage + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); /** - * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); /** - * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); /** - * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage + * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); +void ShutdownScript_free(struct LDKShutdownScript this_obj); /** - * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read + * Creates a copy of the ShutdownScript */ -struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); +struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); /** - * Frees any resources used by the UnsignedNodeAnnouncement, 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 UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); +bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); /** - * The advertised features + * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. */ -struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); /** - * The advertised features + * 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 UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +struct LDKCVec_u8Z InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** - * A strictly monotonic announcement counter, with gaps allowed + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * A strictly monotonic announcement counter, with gaps allowed + * Constructs a new InvalidShutdownScript given each field */ -void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); /** - * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back - * to this node). + * Creates a copy of the InvalidShutdownScript */ -struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); /** - * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back - * to this node). + * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); /** - * An RGB color for UI purposes + * Read a ShutdownScript from a byte array, created by ShutdownScript_write */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; +struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); /** - * An RGB color for UI purposes + * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. */ -void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); /** - * An alias, for UI purposes. - * - * This should be sanitized before use. There is no guarantee of uniqueness. + * Generates a P2WSH script pubkey from the given [`WScriptHash`]. */ -struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); /** - * An alias, for UI purposes. + * Generates a witness script pubkey from the given segwit version and program. * - * This should be sanitized before use. There is no guarantee of uniqueness. + * 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`. */ -void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessProgram witness_program); /** - * List of addresses on which this node is reachable - * - * Returns a copy of the field. + * Converts the shutdown script into the underlying [`ScriptBuf`]. */ -struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); /** - * List of addresses on which this node is reachable + * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); +MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); /** - * Creates a copy of the UnsignedNodeAnnouncement + * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. + * + * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. */ -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); +MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); /** - * 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. + * Get the string representation of a ShutdownScript object */ -bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); +struct LDKStr ShutdownScript_to_str(const struct LDKShutdownScript *NONNULL_PTR o); /** - * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelId, if is_owned is set and inner is non-NULL. */ -void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); +void ChannelId_free(struct LDKChannelId this_obj); + +const uint8_t (*ChannelId_get_a(const struct LDKChannelId *NONNULL_PTR this_ptr))[32]; + +void ChannelId_set_a(struct LDKChannelId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The signature by the node key + * Constructs a new ChannelId given each field */ -struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelId ChannelId_new(struct LDKThirtyTwoBytes a_arg); /** - * The signature by the node key + * Creates a copy of the ChannelId */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKChannelId ChannelId_clone(const struct LDKChannelId *NONNULL_PTR orig); /** - * The actual content of the announcement + * Checks if two ChannelIds 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 LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +bool ChannelId_eq(const struct LDKChannelId *NONNULL_PTR a, const struct LDKChannelId *NONNULL_PTR b); /** - * The actual content of the announcement + * Generates a non-cryptographic 64-bit hash of the ChannelId. */ -void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); +uint64_t ChannelId_hash(const struct LDKChannelId *NONNULL_PTR o); /** - * Constructs a new NodeAnnouncement given each field + * Create _v1_ channel ID based on a funding TX ID and output index */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_txid(const uint8_t (*txid)[32], uint16_t output_index); /** - * Creates a copy of the NodeAnnouncement + * Create _v1_ channel ID from a funding tx outpoint */ -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_outpoint(struct LDKOutPoint outpoint); /** - * 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. + * Create a _temporary_ channel ID randomly, based on an entropy source. */ -bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b); +MUST_USE_RES struct LDKChannelId ChannelId_temporary_from_entropy_source(const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Generic constructor; create a new channel ID from the provided data. + * Use a more specific `*_from_*` constructor when possible. */ -void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); +MUST_USE_RES struct LDKChannelId ChannelId_from_bytes(struct LDKThirtyTwoBytes data); /** - * The advertised channel features + * Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder). */ -struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelId ChannelId_new_zero(void); /** - * The advertised channel features + * Check whether ID is consisting of all zeros (uninitialized) */ -void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +MUST_USE_RES bool ChannelId_is_zero(const struct LDKChannelId *NONNULL_PTR this_arg); /** - * The genesis hash of the blockchain where the channel is to be opened + * Create _v2_ channel ID by concatenating the holder revocation basepoint with the counterparty + * revocation basepoint and hashing the result. The basepoints will be concatenated in increasing + * sorted order. */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKChannelId ChannelId_v2_from_revocation_basepoints(const struct LDKRevocationBasepoint *NONNULL_PTR ours, const struct LDKRevocationBasepoint *NONNULL_PTR theirs); /** - * The genesis hash of the blockchain where the channel is to be opened + * Create temporary _v2_ channel ID by concatenating a zeroed out basepoint with the holder + * revocation basepoint and hashing the result. */ -void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKChannelId ChannelId_temporary_v2_from_revocation_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR our_revocation_basepoint); /** - * The short channel ID + * Serialize the ChannelId object into a byte array which can be read by ChannelId_read */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelId_write(const struct LDKChannelId *NONNULL_PTR obj); /** - * The short channel ID + * Read a ChannelId from a byte array, created by ChannelId_write */ -void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ChannelIdDecodeErrorZ ChannelId_read(struct LDKu8slice ser); /** - * One of the two `node_id`s which are endpoints of this channel + * Get the string representation of a ChannelId object */ -struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKStr ChannelId_to_str(const struct LDKChannelId *NONNULL_PTR o); /** - * One of the two `node_id`s which are endpoints of this channel + * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" + * See [`PhantomKeysManager`] for more information on phantom node payments. + * + * `phantom_route_hints` parameter: + * * Contains channel info for all nodes participating in the phantom invoice + * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice + * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared + * down + * + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. + * + * `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). + * + * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`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 + * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::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. */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** - * The other of the two `node_id`s which are endpoints of this channel + * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" + * See [`PhantomKeysManager`] for more information on phantom node payments. + * + * `phantom_route_hints` parameter: + * * Contains channel info for all nodes participating in the phantom invoice + * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum + * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected + * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node + * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as + * desired, but note that some nodes will be trimmed if more than 3 nodes are provided. + * + * `description_hash` is a SHA-256 hash of the description text + * + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. + * + * `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). + * + * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`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 + * [`PhantomRouteHints::channels`]: crate::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. */ -struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); /** - * The other of the two `node_id`s which are endpoints of this channel + * Utility to construct an invoice. Generally, unless you want to do something like a custom + * cltv_expiry, this is what you should be using to create an invoice. The reason being, this + * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user + * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify + * that the payment secret is valid when the invoice is paid. + * + * `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`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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); /** - * The funding key for the first node + * Utility to construct an invoice. Generally, unless you want to do something like a custom + * cltv_expiry, this is what you should be using to create an invoice. The reason being, this + * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user + * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify + * that the payment secret is valid when the invoice is paid. + * Use this variant if you want to pass the `description_hash` to the invoice. + * + * `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`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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); /** - * The funding key for the first node + * 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. */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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); /** - * The funding key for the second node + * 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 LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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); /** - * The funding key for the second node + * See [`create_invoice_from_channelmanager_and_duration_since_epoch`] + * This version allows for providing a custom [`PaymentHash`] for the invoice. + * This may be useful if you're building an on-chain swap or involving another protocol where + * the payment hash is also involved outside the scope of lightning. */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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); /** - * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. + * Builds the necessary parameters to pay or pre-flight probe the given zero-amount + * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or + * [`ChannelManager::send_preflight_probes`]. * - * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. * - * Returns a copy of the field. + * Will always succeed unless the invoice has an amount specified, in which case + * [`payment_parameters_from_invoice`] should be used. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat); /** - * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. + * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using + * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. * - * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the + * same [`PaymentHash`] has never been paid before. + * + * Will always succeed unless the invoice has no amount specified, in which case + * [`payment_parameters_from_zero_amount_invoice`] should be used. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes */ -void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice); /** - * Constructs a new UnsignedChannelAnnouncement given each field + * Frees any resources used by the Retry */ -MUST_USE_RES struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_new(struct LDKChannelFeatures features_arg, struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, struct LDKNodeId node_id_1_arg, struct LDKNodeId node_id_2_arg, struct LDKNodeId bitcoin_key_1_arg, struct LDKNodeId bitcoin_key_2_arg, struct LDKCVec_u8Z excess_data_arg); +void Retry_free(struct LDKRetry this_ptr); /** - * Creates a copy of the UnsignedChannelAnnouncement + * Creates a copy of the Retry */ -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new Attempts-variant Retry */ -bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); +struct LDKRetry Retry_attempts(uint32_t a); /** - * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Timeout-variant Retry */ -void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); +struct LDKRetry Retry_timeout(uint64_t a); /** - * Authentication of the announcement by the first public node + * Checks if two Retrys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); /** - * Authentication of the announcement by the first public node + * Generates a non-cryptographic 64-bit hash of the Retry. */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); /** - * Authentication of the announcement by the second public node + * Serialize the Retry object into a byte array which can be read by Retry_read */ -struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); /** - * Authentication of the announcement by the second public node + * Read a Retry from a byte array, created by Retry_write */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); /** - * Proof of funding UTXO ownership by the first public node + * Creates a copy of the RetryableSendFailure */ -struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); /** - * Proof of funding UTXO ownership by the first public node + * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); /** - * Proof of funding UTXO ownership by the second public node + * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure */ -struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); /** - * Proof of funding UTXO ownership by the second public node + * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); /** - * The actual announcement + * Utility method to constructs a new OnionPacketSizeExceeded-variant RetryableSendFailure */ -struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +enum LDKRetryableSendFailure RetryableSendFailure_onion_packet_size_exceeded(void); /** - * The actual announcement + * Checks if two RetryableSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); +bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b); /** - * Constructs a new ChannelAnnouncement given each field + * Frees any resources used by the PaymentSendFailure */ -MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKECDSASignature node_signature_1_arg, struct LDKECDSASignature node_signature_2_arg, struct LDKECDSASignature bitcoin_signature_1_arg, struct LDKECDSASignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg); +void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); /** - * Creates a copy of the ChannelAnnouncement + * Creates a copy of the PaymentSendFailure */ -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new ParameterError-variant PaymentSendFailure */ -bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); +struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); /** - * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new PathParameterError-variant PaymentSendFailure */ -void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); +struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); /** - * The genesis hash of the blockchain where the channel is to be opened + * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; +struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); /** - * The genesis hash of the blockchain where the channel is to be opened + * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure */ -void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); /** - * The short channel ID + * Utility method to constructs a new PartialFailure-variant PaymentSendFailure */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); /** - * The short channel ID + * Checks if two PaymentSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * Frees any resources used by the Bolt12PaymentError */ -uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void Bolt12PaymentError_free(struct LDKBolt12PaymentError this_ptr); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * Creates a copy of the Bolt12PaymentError */ -void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKBolt12PaymentError Bolt12PaymentError_clone(const struct LDKBolt12PaymentError *NONNULL_PTR orig); /** - * Channel flags + * Utility method to constructs a new UnexpectedInvoice-variant Bolt12PaymentError */ -uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKBolt12PaymentError Bolt12PaymentError_unexpected_invoice(void); /** - * Channel flags + * Utility method to constructs a new DuplicateInvoice-variant Bolt12PaymentError */ -void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); +struct LDKBolt12PaymentError Bolt12PaymentError_duplicate_invoice(void); /** - * 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. + * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12PaymentError */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKBolt12PaymentError Bolt12PaymentError_unknown_required_features(void); /** - * 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. + * Utility method to constructs a new SendingFailed-variant Bolt12PaymentError */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); +struct LDKBolt12PaymentError Bolt12PaymentError_sending_failed(enum LDKRetryableSendFailure a); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Checks if two Bolt12PaymentErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +bool Bolt12PaymentError_eq(const struct LDKBolt12PaymentError *NONNULL_PTR a, const struct LDKBolt12PaymentError *NONNULL_PTR b); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * Frees any resources used by the ProbeSendFailure */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. - * - * This used to be optional. + * Creates a copy of the ProbeSendFailure */ -uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. - * - * This used to be optional. + * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure */ -void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Utility method to constructs a new SendingFailed-variant ProbeSendFailure */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Checks if two ProbeSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); /** - * The amount to fee multiplier, in micro-satoshi + * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); /** - * The amount to fee multiplier, in micro-satoshi + * 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. + * + * Some implementations may reject spontaneous payments with payment secrets, so you may only + * want to provide a secret for a spontaneous payment if MPP is needed and you know your + * recipient will not reject it. */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. + * 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 is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * 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. * - * Returns a copy of the field. + * Some implementations may reject spontaneous payments with payment secrets, so you may only + * want to provide a secret for a spontaneous payment if MPP is needed and you know your + * recipient will not reject it. */ -struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Excess data which was signed as a part of the message which we do not (yet) understand how - * to decode. + * 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. * - * This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. + * 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. */ -void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * Constructs a new UnsignedChannelUpdate given each field + * 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. */ -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); +void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Creates a copy of the UnsignedChannelUpdate + * Creates a copy of the RecipientOnionFields */ -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig); /** - * Checks if two UnsignedChannelUpdates contain equal inner contents. + * 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. */ -bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); - -/** - * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. - */ -void ChannelUpdate_free(struct LDKChannelUpdate this_obj); - -/** - * A signature of the channel update - */ -struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); - -/** - * A signature of the channel update - */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b); /** - * The actual channel update + * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read */ -struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj); /** - * The actual channel update + * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write */ -void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser); /** - * Constructs a new ChannelUpdate given each field + * 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 struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret); /** - * Creates a copy of the ChannelUpdate + * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create + * payable HTLCs except for single-path spontaneous payments, i.e. this should generally + * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending + * a spontaneous MPP this will not work as all MPP require payment secrets; you may + * instead want to use [`RecipientOnionFields::secret_only`]. + * + * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment + * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only */ -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); /** - * 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. + * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each + * TLV is provided as a `(u64, Vec)` for the type number and serialized value + * respectively. TLV type numbers must be unique and within the range + * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`. + * + * This method will also error for types in the experimental range which have been + * standardized within the protocol, which only includes 5482373484 (keysend) for now. + * + * See [`Self::custom_tlvs`] for more info. */ -bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); /** - * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. + * Gets the custom TLVs that will be sent or have been received. + * + * Custom TLVs allow sending extra application-specific data with a payment. They provide + * additional flexibility on top of payment metadata, as while other implementations may + * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs + * do not have this restriction. + * + * Note that if this field is non-empty, it will contain strictly increasing TLVs, each + * represented by a `(u64, Vec)` for its type number and serialized value respectively. + * This is validated when setting this field using [`Self::with_custom_tlvs`]. */ -void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); +MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); /** - * The genesis hash of the blockchain being queried + * Calls the free function if one is set */ -const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; +void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); /** - * The genesis hash of the blockchain being queried + * Creates a copy of a Type */ -void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); /** - * The height of the first block for the channel UTXOs being queried + * Calls the free function if one is set */ -uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +void Type_free(struct LDKType this_ptr); /** - * The height of the first block for the channel UTXOs being queried + * Frees any resources used by the OfferId, if is_owned is set and inner is non-NULL. */ -void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void OfferId_free(struct LDKOfferId this_obj); -/** - * The number of blocks to include in the query results - */ -uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +const uint8_t (*OfferId_get_a(const struct LDKOfferId *NONNULL_PTR this_ptr))[32]; -/** - * The number of blocks to include in the query results - */ -void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void OfferId_set_a(struct LDKOfferId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new QueryChannelRange given each field + * Constructs a new OfferId given each field */ -MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); +MUST_USE_RES struct LDKOfferId OfferId_new(struct LDKThirtyTwoBytes a_arg); /** - * Creates a copy of the QueryChannelRange + * Creates a copy of the OfferId */ -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +struct LDKOfferId OfferId_clone(const struct LDKOfferId *NONNULL_PTR orig); /** - * Checks if two QueryChannelRanges contain equal inner contents. + * Checks if two OfferIds 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 QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); - -/** - * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. - */ -void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); - -/** - * The genesis hash of the blockchain being queried - */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; - -/** - * The genesis hash of the blockchain being queried - */ -void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool OfferId_eq(const struct LDKOfferId *NONNULL_PTR a, const struct LDKOfferId *NONNULL_PTR b); /** - * The height of the first block in the range of the reply + * Serialize the OfferId object into a byte array which can be read by OfferId_read */ -uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OfferId_write(const struct LDKOfferId *NONNULL_PTR obj); /** - * The height of the first block in the range of the reply + * Read a OfferId from a byte array, created by OfferId_write */ -void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_OfferIdDecodeErrorZ OfferId_read(struct LDKu8slice ser); /** - * The number of blocks included in the range of the reply + * Frees any resources used by the OfferWithExplicitMetadataBuilder, if is_owned is set and inner is non-NULL. */ -uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void OfferWithExplicitMetadataBuilder_free(struct LDKOfferWithExplicitMetadataBuilder this_obj); /** - * The number of blocks included in the range of the reply + * Creates a copy of the OfferWithExplicitMetadataBuilder */ -void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_clone(const struct LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR orig); /** - * True when this is the final reply for a query + * Frees any resources used by the OfferWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. */ -bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void OfferWithDerivedMetadataBuilder_free(struct LDKOfferWithDerivedMetadataBuilder this_obj); /** - * True when this is the final reply for a query + * Creates a copy of the OfferWithDerivedMetadataBuilder */ -void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_clone(const struct LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * The `short_channel_id`s in the channel range + * Creates a new builder for an offer using the [`Offer::signing_pubkey`] for signing invoices. + * The associated secret key must be remembered while the offer is valid. * - * Returns a copy of the field. - */ -struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); - -/** - * The `short_channel_id`s in the channel range - */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); - -/** - * Constructs a new ReplyChannelRange given each field - */ -MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); - -/** - * Creates a copy of the ReplyChannelRange + * Use a different pubkey per offer to avoid correlating offers. + * + * # Note + * + * If constructing an [`Offer`] for use with a [`ChannelManager`], use + * [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder */ -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +MUST_USE_RES struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_new(struct LDKPublicKey signing_pubkey); /** - * 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. + * Sets the [`Offer::metadata`] to the given bytes. + * + * Successive calls to this method will override the previous setting. */ -bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_metadata(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKCVec_u8Z metadata); /** - * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. + * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, + * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. + * + * See [`Offer::chains`] on how this relates to the payment currency. + * + * Successive calls to this method will add another chain hash. */ -void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_chain(struct LDKOfferWithExplicitMetadataBuilder this_arg, enum LDKNetwork network); /** - * The genesis hash of the blockchain being queried + * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. + * + * Successive calls to this method will override the previous setting. */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES void OfferWithExplicitMetadataBuilder_amount_msats(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t amount_msats); /** - * The genesis hash of the blockchain being queried + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has + * already passed is valid and can be checked for using [`Offer::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_absolute_expiry(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * The short_channel_ids that are being queried + * Sets the [`Offer::description`]. * - * Returns a copy of the field. + * Successive calls to this method will override the previous setting. */ -struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_description(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr description); /** - * The short_channel_ids that are being queried + * Sets the [`Offer::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_issuer(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr issuer); /** - * Constructs a new QueryShortChannelIds given each field + * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by + * private channels or if [`Offer::signing_pubkey`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_path(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * Creates a copy of the QueryShortChannelIds + * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to + * [`Quantity::One`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_supported_quantity(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKQuantity quantity); /** - * 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. + * Builds an [`Offer`] from the builder's settings. */ -bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_build(struct LDKOfferWithExplicitMetadataBuilder this_arg); /** - * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. + * Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing + * pubkey is derived from the given [`ExpandedKey`] and [`Nonce`]. This provides recipient + * privacy by using a different signing pubkey for each offer. Otherwise, the provided + * `node_id` is used for the signing pubkey. + * + * Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by + * [`InvoiceRequest::verify_using_metadata`] to determine if the request was produced for the + * offer given an [`ExpandedKey`]. However, if [`OfferBuilder::path`] is called, then the + * metadata will not be set and must be included in each [`BlindedMessagePath`] instead. In this case, + * use [`InvoiceRequest::verify_using_recipient_data`]. + * + * [`InvoiceRequest::verify_using_metadata`]: crate::offers::invoice_request::InvoiceRequest::verify_using_metadata + * [`InvoiceRequest::verify_using_recipient_data`]: crate::offers::invoice_request::InvoiceRequest::verify_using_recipient_data + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); +MUST_USE_RES struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce); /** - * The genesis hash of the blockchain that was queried + * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, + * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. + * + * See [`Offer::chains`] on how this relates to the payment currency. + * + * Successive calls to this method will add another chain hash. */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES void OfferWithDerivedMetadataBuilder_chain(struct LDKOfferWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); /** - * The genesis hash of the blockchain that was queried + * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. + * + * Successive calls to this method will override the previous setting. */ -void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_amount_msats(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t amount_msats); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the `chain_hash` + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has + * already passed is valid and can be checked for using [`Offer::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_absolute_expiry(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the `chain_hash` + * Sets the [`Offer::description`]. + * + * Successive calls to this method will override the previous setting. */ -void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_description(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr description); /** - * Constructs a new ReplyShortChannelIdsEnd given each field + * Sets the [`Offer::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_issuer(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); /** - * Creates a copy of the ReplyShortChannelIdsEnd + * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by + * private channels or if [`Offer::signing_pubkey`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_path(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * 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. + * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to + * [`Quantity::One`]. + * + * Successive calls to this method will override the previous setting. */ -bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_supported_quantity(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKQuantity quantity); /** - * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. + * Builds an [`Offer`] from the builder's settings. */ -void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); +MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithDerivedMetadataBuilder_build(struct LDKOfferWithDerivedMetadataBuilder this_arg); /** - * The genesis hash of the blockchain for channel and node information + * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; +void Offer_free(struct LDKOffer this_obj); /** - * The genesis hash of the blockchain for channel and node information + * Creates a copy of the Offer */ -void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); /** - * The starting unix timestamp + * 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. */ -uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); /** - * The starting unix timestamp + * 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`. */ -void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); /** - * The range of information in seconds + * The minimum amount required for a successful payment of a single item. */ -uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_AmountZ Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); /** - * The range of information in seconds + * 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. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Constructs a new GossipTimestampFilter given each field + * Features pertaining to the offer. */ -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 LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Creates a copy of the GossipTimestampFilter + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. */ -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *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. + * 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 */ -bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); +MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Frees any resources used by the ErrorAction + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -void ErrorAction_free(struct LDKErrorAction this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Creates a copy of the ErrorAction + * The quantity of items supported. */ -struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); +MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DisconnectPeer-variant ErrorAction + * The public key used by the recipient to sign invoices. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); +MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction + * Returns the id of the offer. */ -struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg); +MUST_USE_RES struct LDKOfferId Offer_id(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new IgnoreError-variant ErrorAction + * Returns whether the given chain is supported by the offer. */ -struct LDKErrorAction ErrorAction_ignore_error(void); +MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); /** - * Utility method to constructs a new IgnoreAndLog-variant ErrorAction + * Whether the offer has expired. */ -struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); +MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction + * Whether the offer has expired given the duration since the Unix epoch. */ -struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); +MUST_USE_RES bool Offer_is_expired_no_std(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Utility method to constructs a new SendErrorMessage-variant ErrorAction + * Returns whether the given quantity is valid for the offer. */ -struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); +MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); /** - * Utility method to constructs a new SendWarningMessage-variant ErrorAction + * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); +MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. + * Similar to [`Offer::request_invoice`] except it: + * - derives the [`InvoiceRequest::payer_id`] such that a different key can be used for each + * request, + * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build`] is called + * such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine if the + * invoice was requested using a base [`ExpandedKey`] from which the payer id was derived, + * and + * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can + * be used when sending the payment for the requested invoice. + * + * Useful to protect the sender's privacy. + * + * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id + * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata + * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -void LightningError_free(struct LDKLightningError this_obj); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_payer_id(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); /** - * A human-readable message describing the error + * Similar to [`Offer::request_invoice_deriving_payer_id`] except uses `payer_id` for the + * [`InvoiceRequest::payer_id`] instead of deriving a different key for each request. + * + * Useful for recurring payments using the same `payer_id` with different invoices. + * + * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id */ -struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_metadata(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKPublicKey payer_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); /** - * A human-readable message describing the error + * Creates an [`InvoiceRequestBuilder`] for the offer with the given `metadata` and `payer_id`, + * which will be reflected in the `Bolt12Invoice` response. + * + * The `metadata` is useful for including information about the derivation of `payer_id` such + * that invoice response handling can be stateless. Also serves as payer-provided entropy while + * hashing in the signature calculation. + * + * This should not leak any information such as by using a simple BIP-32 derivation path. + * Otherwise, payments may be correlated. + * + * Errors if the offer contains unknown required features. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id); /** - * The action which should be taken against the offending peer. + * Generates a non-cryptographic 64-bit hash of the Offer. */ -struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); +uint64_t Offer_hash(const struct LDKOffer *NONNULL_PTR o); /** - * The action which should be taken against the offending peer. + * Read a Offer from a byte array, created by Offer_write */ -void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); +struct LDKCResult_OfferDecodeErrorZ Offer_read(struct LDKu8slice ser); /** - * Constructs a new LightningError given each field + * Serialize the Offer object into a byte array which can be read by Offer_read */ -MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); +struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); /** - * Creates a copy of the LightningError + * Frees any resources used by the Amount */ -struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); +void Amount_free(struct LDKAmount this_ptr); /** - * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. + * Creates a copy of the Amount */ -void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); +struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); /** - * `update_add_htlc` messages which should be sent + * Utility method to constructs a new Bitcoin-variant Amount */ -struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKAmount Amount_bitcoin(uint64_t amount_msats); /** - * `update_add_htlc` messages which should be sent + * Utility method to constructs a new Currency-variant Amount */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); +struct LDKAmount Amount_currency(struct LDKThreeBytes iso4217_code, uint64_t amount); /** - * `update_fulfill_htlc` messages which should be sent + * Frees any resources used by the Quantity */ -struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +void Quantity_free(struct LDKQuantity this_ptr); /** - * `update_fulfill_htlc` messages which should be sent + * Creates a copy of the Quantity */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); +struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); /** - * `update_fail_htlc` messages which should be sent + * Utility method to constructs a new Bounded-variant Quantity */ -struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKQuantity Quantity_bounded(uint64_t a); /** - * `update_fail_htlc` messages which should be sent + * Utility method to constructs a new Unbounded-variant Quantity */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); +struct LDKQuantity Quantity_unbounded(void); /** - * `update_fail_malformed_htlc` messages which should be sent + * Utility method to constructs a new One-variant Quantity */ -struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKQuantity Quantity_one(void); /** - * `update_fail_malformed_htlc` messages which should be sent + * Read a Offer object from a string */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); +struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); /** - * 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 + * Get the string representation of a Offer object */ -struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKStr Offer_to_str(const struct LDKOffer *NONNULL_PTR o); /** - * 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 + * Frees any resources used by the InvoiceWithExplicitSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); +void InvoiceWithExplicitSigningPubkeyBuilder_free(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj); /** - * A `commitment_signed` message which should be sent + * Frees any resources used by the InvoiceWithDerivedSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +void InvoiceWithDerivedSigningPubkeyBuilder_free(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj); /** - * A `commitment_signed` message which should be sent + * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. It can be signed by + * [`UnsignedBolt12Invoice::sign`]. */ -void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); +MUST_USE_RES struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ InvoiceWithExplicitSigningPubkeyBuilder_build(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); /** - * Constructs a new CommitmentUpdate given each field + *Sets the [`Bolt12Invoice::relative_expiry`] + *as seconds since [`Bolt12Invoice::created_at`]. + *Any expiry that has already passed is valid and can be checked for using + *[`Bolt12Invoice::is_expired`]. * - * Note that update_fee_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Successive calls to this method will override the previous setting. */ -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 void InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); /** - * Creates a copy of the CommitmentUpdate + *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. */ -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); /** - * 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. + *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. */ -bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); /** - * Calls the free function if one is set + *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. */ -void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); /** - * Calls the free function if one is set + *Sets [`Bolt12Invoice::invoice_features`] + *to indicate MPP may be used. Otherwise, MPP is disallowed. */ -void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); /** - * Calls the free function if one is set + * Builds a signed [`Bolt12Invoice`] after checking for valid semantics. */ -void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); +MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); /** - * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read + *Sets the [`Bolt12Invoice::relative_expiry`] + *as seconds since [`Bolt12Invoice::created_at`]. + *Any expiry that has already passed is valid and can be checked for using + *[`Bolt12Invoice::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); /** - * Read a AcceptChannel from a byte array, created by AcceptChannel_write + *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. */ -struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); /** - * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read + *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. */ -struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); /** - * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write + *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); /** - * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read + *Sets [`Bolt12Invoice::invoice_features`] + *to indicate MPP may be used. Otherwise, MPP is disallowed. */ -struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); /** - * Read a TxAddInput from a byte array, created by TxAddInput_write + * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser); +void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); /** - * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read + * Creates a copy of the UnsignedBolt12Invoice */ -struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj); +struct LDKUnsignedBolt12Invoice UnsignedBolt12Invoice_clone(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR orig); /** - * Read a TxAddOutput from a byte array, created by TxAddOutput_write + * Calls the free function if one is set */ -struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser); +void SignBolt12InvoiceFn_free(struct LDKSignBolt12InvoiceFn this_ptr); /** - * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read + * Returns the [`TaggedHash`] of the invoice to sign. */ -struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj); +MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write + * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser); +void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); /** - * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read + * Creates a copy of the Bolt12Invoice */ -struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj); +struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); /** - * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write + * Duration since the Unix epoch when the invoice was created. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the TxComplete object into a byte array which can be read by TxComplete_read + * Duration since + *[`Bolt12Invoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxComplete from a byte array, created by TxComplete_write + * Whether the invoice has expired. */ -struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser); +MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_StrZ UnsignedBolt12Invoice_fallbacks(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxSignatures from a byte array, created by TxSignatures_write + * Features pertaining to paying an invoice. */ -struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read + * The public key corresponding to the key used to sign the invoice. */ -struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxInitRbf from a byte array, created by TxInitRbf_write + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains */ -struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain */ -struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxAckRbf from a byte array, created by TxAckRbf_write + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ -struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the TxAbort object into a byte array which can be read by TxAbort_read + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount */ -struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_AmountZ UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a TxAbort from a byte array, created by TxAbort_write + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity */ -struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_QuantityZ UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a ClosingSigned from a byte array, created by ClosingSigned_write + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. */ -struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. */ -struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths */ -struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. */ -struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a FundingCreated from a byte array, created by FundingCreated_write + * The minimum amount required for a successful payment of the invoice. */ -struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read + * Duration since the Unix epoch when the invoice was created. */ -struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); +MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a FundingSigned from a byte array, created by FundingSigned_write + * Duration since + *[`Bolt12Invoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read + * Whether the invoice has expired. */ -struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); +MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a ChannelReady from a byte array, created by ChannelReady_write + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCVec_StrZ Bolt12Invoice_fallbacks(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the Init object into a byte array which can be read by Init_read + * Features pertaining to paying an invoice. */ -struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a Init from a byte array, created by Init_write + * The public key corresponding to the key used to sign the invoice. */ -struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read + * The chains that may be used when paying a requested invoice. + * + * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * + * [`Offer::chains`]: crate::offers::offer::Offer::chains */ -struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a OpenChannel from a byte array, created by OpenChannel_write + * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the + * invoice originated from an offer. + * + * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * + * [`offer_chains`]: Self::offer_chains + * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain */ -struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read + * Opaque bytes set by the originating [`Offer`]. + * + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ -struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount */ -struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_AmountZ Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read + * Features pertaining to the originating [`Offer`]. + * + * From [`Offer::offer_features`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); +MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write + * A complete description of the purpose of the originating offer or refund. + * + * From [`Offer::description`] or [`Refund::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the Shutdown object into a byte array which can be read by Shutdown_read + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry */ -struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a Shutdown from a byte array, created by Shutdown_write + * The issuer of the offer or refund. + * + * From [`Offer::issuer`] or [`Refund::issuer`]. + * + * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write + * The quantity of items supported. + * + * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a + * [`Refund`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_QuantityZ Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. */ -struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); +MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. */ -struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a UpdateFee from a byte array, created by UpdateFee_write + * A possibly transient pubkey used to sign the invoice request or to send an invoice for a + * refund in case there are no [`message_paths`]. + * + * [`message_paths`]: Self::message_paths */ -struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read + * A payer-provided note reflected back in the invoice. + * + * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read + * The minimum amount required for a successful payment of the invoice. */ -struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); +MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write + * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a OnionMessage from a byte array, created by OnionMessage_write + * Hash that was used for signing the invoice. */ -struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read + * Verifies that the invoice was for a request or refund created using the given key by + * checking the payer metadata from the invoice request. + * + * Returns the associated [`PaymentId`] to use when sending the payment. */ -struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Serialize the Ping object into a byte array which can be read by Ping_read + * Verifies that the invoice was for a request or refund created using the given key by + * checking a payment id and nonce included with the [`BlindedMessagePath`] for which the invoice was + * sent through. */ -struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_payer_data(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Read a Ping from a byte array, created by Ping_write + * Generates a non-cryptographic 64-bit hash of the Bolt12Invoice. */ -struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); +uint64_t Bolt12Invoice_hash(const struct LDKBolt12Invoice *NONNULL_PTR o); /** - * Serialize the Pong object into a byte array which can be read by Pong_read + * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read */ -struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); +struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); /** - * Read a Pong from a byte array, created by Pong_write + * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read */ -struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); +struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj); /** - * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read + * Read a Bolt12Invoice from a byte array, created by Bolt12Invoice_write */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); +struct LDKCResult_Bolt12InvoiceDecodeErrorZ Bolt12Invoice_read(struct LDKu8slice ser); /** - * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write + * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +void InvoiceError_free(struct LDKInvoiceError this_obj); /** - * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); +struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr); /** - * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); +void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val); /** - * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read + * An explanation of the error. */ -struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); +struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr); /** - * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write + * An explanation of the error. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); +void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val); /** - * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read + * Constructs a new InvoiceError given each field + * + * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); +MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); /** - * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write + * Creates a copy of the InvoiceError */ -struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); +struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig); /** - * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read + * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); +void ErroneousField_free(struct LDKErroneousField this_obj); /** - * Read a ErrorMessage from a byte array, created by ErrorMessage_write + * The type number of the TLV field containing the error. */ -struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); +uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr); /** - * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read + * The type number of the TLV field containing the error. */ -struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); +void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a WarningMessage from a byte array, created by WarningMessage_write + * A value to use for the TLV field to avoid the error. + * + * Returns a copy of the field. */ -struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); +struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr); /** - * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read + * A value to use for the TLV field to avoid the error. */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); +void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write + * Constructs a new ErroneousField given each field */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg); /** - * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read + * Creates a copy of the ErroneousField */ -struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); +struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); /** - * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write + * Creates an [`InvoiceError`] with the given message. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); /** - * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write + * Get the string representation of a InvoiceError object */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); +struct LDKStr InvoiceError_to_str(const struct LDKInvoiceError *NONNULL_PTR o); /** - * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read + * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read */ -struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); +struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj); /** - * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read + * Read a InvoiceError from a byte array, created by InvoiceError_write */ -struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); +struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); /** - * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write + * Frees any resources used by the InvoiceRequestWithExplicitPayerIdBuilder, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +void InvoiceRequestWithExplicitPayerIdBuilder_free(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj); /** - * Calculates the overflow safe ending block height for the query. - * - * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. + * Frees any resources used by the InvoiceRequestWithDerivedPayerIdBuilder, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); +void InvoiceRequestWithDerivedPayerIdBuilder_free(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj); /** - * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read + * Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed + * by [`UnsignedInvoiceRequest::sign`]. */ -struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_build(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg); /** - * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write + * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not + * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported + * by the offer. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_chain(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, enum LDKNetwork network); /** - * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write + * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is + * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). + * + * Successive calls to this method will override the previous setting. + * + * [`quantity`]: Self::quantity */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t amount_msats); /** - * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read + * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` + * does not conform to [`Offer::is_valid_quantity`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_quantity(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t quantity); /** - * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + * Sets the [`InvoiceRequest::payer_note`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); +MUST_USE_RES void InvoiceRequestWithExplicitPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, struct LDKStr payer_note); /** - * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write + * Builds a signed [`InvoiceRequest`] after checking for valid semantics. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg); /** - * Calls the free function if one is set + * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not + * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported + * by the offer. + * + * Successive calls to this method will override the previous setting. */ -void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, enum LDKNetwork network); /** - * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. + * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is + * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). + * + * Successive calls to this method will override the previous setting. + * + * [`quantity`]: Self::quantity */ -void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t amount_msats); /** - * Constructs a new IgnoringMessageHandler given each field + * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` + * does not conform to [`Offer::is_valid_quantity`]. + * + * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t quantity); /** - * 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 + * Sets the [`InvoiceRequest::payer_note`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +MUST_USE_RES void InvoiceRequestWithDerivedPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, struct LDKStr payer_note); /** - * 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 UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. */ -struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); /** - * 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 + * Creates a copy of the UnsignedInvoiceRequest */ -struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKUnsignedInvoiceRequest UnsignedInvoiceRequest_clone(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR orig); /** - * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + * Calls the free function if one is set */ -struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void SignInvoiceRequestFn_free(struct LDKSignInvoiceRequestFn this_ptr); /** - * 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 + * Returns the [`TaggedHash`] of the invoice to sign. */ -struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *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 + * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. */ -struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); /** - * 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 + * Creates a copy of the InvoiceRequest */ -struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); /** - * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. + * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. */ -void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); +void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); /** - * Constructs a new ErroringMessageHandler + * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. */ -MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); +struct LDKOfferId VerifiedInvoiceRequest_get_offer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. */ -struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +void VerifiedInvoiceRequest_set_offer_id(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKOfferId 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 + * Creates a copy of the VerifiedInvoiceRequest */ -struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); /** - * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. + * 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. */ -void MessageHandler_free(struct LDKMessageHandler this_obj); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *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 + * 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`. */ -const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *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 + * The minimum amount required for a successful payment of a single item. */ -void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); +MUST_USE_RES struct LDKCOption_AmountZ UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *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`]. + * 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. * - * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *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 + * Features pertaining to the offer. */ -void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); +MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * A message handler which handles onion messages. This should generally be an - * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. + * Duration since the Unix epoch when an invoice should no longer be requested. * - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * If `None`, the offer does not expire. */ -const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * A message handler which handles onion messages. This should generally be an - * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. + * 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. * - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * A message handler which handles custom messages. The only LDK-provided implementation is - * [`IgnoringMessageHandler`]. + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * A message handler which handles custom messages. The only LDK-provided implementation is - * [`IgnoringMessageHandler`]. + * The quantity of items supported. */ -void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val); +MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Constructs a new MessageHandler given each field + * The public key used by the recipient to sign invoices. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg, struct LDKCustomMessageHandler custom_message_handler_arg); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of a SocketDescriptor + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); +MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * A chain from [`Offer::chains`] that the offer is valid for. */ -void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeerHandleError, 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 PeerHandleError_free(struct LDKPeerHandleError this_obj); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Constructs a new PeerHandleError given each field + * Features pertaining to requesting an invoice. */ -MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the PeerHandleError + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. + * A possibly transient pubkey used to sign the invoice request. */ -void PeerManager_free(struct LDKPeerManager this_obj); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * 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. + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. * - * `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. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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 LDKNodeSigner node_signer); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * 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`]. + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. */ -MUST_USE_RES struct LDKCVec_C2Tuple_PublicKeyCOption_SocketAddressZZZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *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 + * Opaque bytes set by the originator. Useful for authentication and validating fields since it + * is reflected in `invoice_request` messages along with all the other fields from the `offer`. */ -MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *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 + * The minimum amount required for a successful payment of a single item. */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_SocketAddressZ remote_network_address); +MUST_USE_RES struct LDKCOption_AmountZ InvoiceRequest_amount(const struct LDKInvoiceRequest *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! + * 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. * - * [`send_data`]: SocketDescriptor::send_data - * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *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). - * - * 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 + * Features pertaining to the offer. */ -MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); +MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *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. + * Duration since the Unix epoch when an invoice should no longer be requested. * - * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - * [`send_data`]: SocketDescriptor::send_data - */ -void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); - -/** - * Indicates that the given socket descriptor's connection is now closed. + * If `None`, the offer does not expire. */ -void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * 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. + * 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. * - * [`disconnect_socket`]: SocketDescriptor::disconnect_socket + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *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. + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *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 + * The quantity of items supported. */ -void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *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). + * The public key used by the recipient to sign invoices. * - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events - */ -void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); - -/** - * Gets the weight for an HTLC-Success transaction. - */ -uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); - -/** - * Gets the weight for an HTLC-Timeout transaction. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCClaim + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); +MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OfferedTimeout-variant HTLCClaim + * A chain from [`Offer::chains`] that the offer is valid for. */ -enum LDKHTLCClaim HTLCClaim_offered_timeout(void); +MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OfferedPreimage-variant HTLCClaim + * 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 */ -enum LDKHTLCClaim HTLCClaim_offered_preimage(void); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim + * Features pertaining to requesting an invoice. */ -enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Revocation-variant HTLCClaim + * A possibly transient pubkey used to sign the invoice request. */ -enum LDKHTLCClaim HTLCClaim_revocation(void); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *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. + * 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 */ -bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Check if a given input witness attempts to claim a HTLC. + * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the + * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. + * + * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned + * creation time is used for the `created_at` parameter. + * + * [`Duration`]: core::time::Duration */ -MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * Build the commitment secret from the seed and the commitment number + * Creates an [`InvoiceBuilder`] for the request with the given required fields. + * + * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds + * where [`std::time::SystemTime`] is not available. + * + * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment + * for the invoice. + * + * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It + * must contain one or more elements ordered from most-preferred to least-preferred, if there's + * a preference. Note, however, that any privacy is lost if a public node id was used for + * [`Offer::signing_pubkey`]. + * + * Errors if the request contains unknown required features. + * + * # Note + * + * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], + * then first use [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods + * instead. + * + * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at + * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey */ -struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with_no_std(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * Build a closing transaction + * Verifies that the request was for an offer created using the given key by checking the + * metadata from the offer. + * + * Returns the verified request which contains the derived keys needed to sign a + * [`Bolt12Invoice`] for the request if they could be extracted from the metadata. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct 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 struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_metadata(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. + * Verifies that the request was for an offer created using the given key by checking a nonce + * included with the [`BlindedMessagePath`] for which the request was sent through. + * + * Returns the verified request which contains the derived keys needed to sign a + * [`Bolt12Invoice`] for the request if they could be extracted from the metadata. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); +MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_recipient_data(struct LDKInvoiceRequest this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Creates a copy of the CounterpartyCommitmentSecrets + * Signature of the invoice request using [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); +MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a new empty `CounterpartyCommitmentSecrets` structure. + * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). + * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) + * for the selected chain. */ -MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *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. + * 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 uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *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. + * The minimum amount required for a successful payment of a single item. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); +MUST_USE_RES struct LDKCOption_AmountZ VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the secret at `idx`. - * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. + * 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. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read + * Features pertaining to the offer. */ -struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); +MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *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. + * 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 */ -struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *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. + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *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. + * The quantity of items 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 struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *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. + * The public key used by the recipient to sign invoices. * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxCreationKeys, 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 TxCreationKeys_free(struct LDKTxCreationKeys this_obj); +MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * A chain from [`Offer::chains`] that the offer is valid for. */ -struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * 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 TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *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. + * Features pertaining to requesting an invoice. */ -struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *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. + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Broadcaster's HTLC Key + * A possibly transient pubkey used to sign the invoice request. */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Broadcaster's HTLC Key + * 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 */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Countersignatory's HTLC Key + * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the + * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. + * + * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned + * creation time is used for the `created_at` parameter. + * + * [`Duration`]: core::time::Duration */ -struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * Countersignatory's HTLC Key + * Creates an [`InvoiceBuilder`] for the request with the given required fields. + * + * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds + * where [`std::time::SystemTime`] is not available. + * + * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment + * for the invoice. + * + * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It + * must contain one or more elements ordered from most-preferred to least-preferred, if there's + * a preference. Note, however, that any privacy is lost if a public node id was used for + * [`Offer::signing_pubkey`]. + * + * Errors if the request contains unknown required features. + * + * # Note + * + * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], + * then first use [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods + * instead. + * + * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at + * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses + * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use + * the same [`ExpandedKey`] as the one used to create the offer. + * + * See [`InvoiceRequest::respond_with`] for further details. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses + * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use + * the same [`ExpandedKey`] as the one used to create the offer. + * + * See [`InvoiceRequest::respond_with_no_std`] for further details. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * Constructs a new TxCreationKeys given each field + * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read */ -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); +struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); /** - * 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. + * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read */ -bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); +struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); /** - * Creates a copy of the TxCreationKeys + * Frees any resources used by the InvoiceRequestFields, if is_owned is set and inner is non-NULL. */ -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); +void InvoiceRequestFields_free(struct LDKInvoiceRequestFields this_obj); /** - * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read + * A possibly transient pubkey used to sign the invoice request. */ -struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); +struct LDKPublicKey InvoiceRequestFields_get_payer_id(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write + * A possibly transient pubkey used to sign the invoice request. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); +void InvoiceRequestFields_set_payer_id(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); +struct LDKCOption_u64Z InvoiceRequestFields_get_quantity(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * 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. + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void InvoiceRequestFields_set_quantity(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * 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. + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKUntrustedString InvoiceRequestFields_get_payer_note_truncated(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * 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. + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void InvoiceRequestFields_set_payer_note_truncated(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKUntrustedString val); /** - * 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. + * Constructs a new InvoiceRequestFields given each field + * + * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_id_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_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. + * Creates a copy of the InvoiceRequestFields */ -struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKInvoiceRequestFields InvoiceRequestFields_clone(const struct LDKInvoiceRequestFields *NONNULL_PTR orig); /** - * 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. + * Checks if two InvoiceRequestFieldss 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 ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +bool InvoiceRequestFields_eq(const struct LDKInvoiceRequestFields *NONNULL_PTR a, const struct LDKInvoiceRequestFields *NONNULL_PTR b); /** - * 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). + * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read */ -struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z InvoiceRequestFields_write(const struct LDKInvoiceRequestFields *NONNULL_PTR obj); /** - * 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). + * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write */ -void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ InvoiceRequestFields_read(struct LDKu8slice ser); /** - * 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. + * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void TaggedHash_free(struct LDKTaggedHash this_obj); /** - * 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. + * Creates a copy of the TaggedHash */ -void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKTaggedHash TaggedHash_clone(const struct LDKTaggedHash *NONNULL_PTR orig); /** - * Constructs a new ChannelPublicKeys given each field + * Returns the digest to sign. */ -MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg); +MUST_USE_RES const uint8_t (*TaggedHash_as_digest(const struct LDKTaggedHash *NONNULL_PTR this_arg))[32]; /** - * Creates a copy of the ChannelPublicKeys + * Returns the tag used in the tagged hash. */ -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +MUST_USE_RES struct LDKStr TaggedHash_tag(const struct LDKTaggedHash *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. + * Returns the merkle root used in the tagged hash. */ -uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); +MUST_USE_RES struct LDKThirtyTwoBytes TaggedHash_merkle_root(const struct LDKTaggedHash *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. + * Frees any resources used by the SignError */ -bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); +void SignError_free(struct LDKSignError this_ptr); /** - * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read + * Creates a copy of the SignError */ -struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); +struct LDKSignError SignError_clone(const struct LDKSignError *NONNULL_PTR orig); /** - * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write + * Utility method to constructs a new Signing-variant SignError */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); +struct LDKSignError SignError_signing(void); /** - * 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. + * Utility method to constructs a new Verification-variant SignError */ -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); +struct LDKSignError SignError_verification(enum LDKSecp256k1Error a); /** - * 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. + * Frees any resources used by the Nonce, if is_owned is set and inner is non-NULL. */ -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 Nonce_free(struct LDKNonce this_obj); /** - * 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. + * Creates a copy of the Nonce */ -struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key); +struct LDKNonce Nonce_clone(const struct LDKNonce *NONNULL_PTR orig); /** - * Returns the script for the counterparty's output on a holder's commitment transaction based on - * the channel type. + * Checks if two Nonces 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 get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); +bool Nonce_eq(const struct LDKNonce *NONNULL_PTR a, const struct LDKNonce *NONNULL_PTR b); /** - * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. + * Creates a `Nonce` from the given [`EntropySource`]. */ -void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); +MUST_USE_RES struct LDKNonce Nonce_from_entropy_source(struct LDKEntropySource entropy_source); /** - * 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. + * Returns a slice of the underlying bytes of size [`Nonce::LENGTH`]. */ -bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKu8slice Nonce_as_slice(const struct LDKNonce *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. + * Serialize the Nonce object into a byte array which can be read by Nonce_read */ -void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); +struct LDKCVec_u8Z Nonce_write(const struct LDKNonce *NONNULL_PTR obj); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Read a Nonce from a byte array, created by Nonce_write */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKCResult_NonceDecodeErrorZ Nonce_read(struct LDKu8slice ser); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. */ -void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); +void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj); /** - * The CLTV lock-time at which this HTLC expires. + * Creates a copy of the Bolt12ParseError */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig); /** - * The CLTV lock-time at which this HTLC expires. + * Creates a copy of the Bolt12SemanticError */ -void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); +enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig); /** - * The hash of the preimage which unlocks this HTLC. + * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; +enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void); /** - * The hash of the preimage which unlocks this HTLC. + * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError */ -void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void); /** - * 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). + * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError */ -struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void); /** - * 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). + * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError */ -void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void); /** - * Constructs a new HTLCOutputInCommitment given each field + * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError */ -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); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void); /** - * Creates a copy of the HTLCOutputInCommitment + * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError */ -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); +enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void); /** - * 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. + * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError */ -bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void); /** - * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read + * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError */ -struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); +enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void); /** - * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write + * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); +enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void); /** - * 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. + * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError */ -struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKTxCreationKeys *NONNULL_PTR keys); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void); /** - * Gets the redeemscript for a funding output from the two funding public keys. - * Note that the order of funding public keys does not matter. + * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError */ -struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void); /** - * 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). + * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); /** - * Returns the witness required to satisfy and spend a HTLC input. + * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError */ -struct LDKWitness build_htlc_input_witness(struct LDKECDSASignature local_sig, struct LDKECDSASignature remote_sig, struct LDKCOption_ThirtyTwoBytesZ preimage, struct LDKu8slice redeem_script, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); /** - * Gets the witnessScript for the to_remote output when anchors are enabled. + * Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError */ -struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_signing_pubkey(void); /** - * 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) + * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError */ -struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void); /** - * Returns the witness required to satisfy and spend an anchor input. + * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError */ -struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void); /** - * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError */ -void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void); /** - * Holder public keys + * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError */ -struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void); /** - * Holder public keys + * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError */ -uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError */ -bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void); /** - * 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 + * Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError */ -struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_paths(void); /** - * 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 + * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void); /** - * The late-bound funding outpoint - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError */ -struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void); /** - * The late-bound funding outpoint - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void); /** - * This channel's type, as negotiated during channel open. For old objects where this field - * wasn't serialized, it will default to static_remote_key at deserialization. + * Utility method to constructs a new UnexpectedPaymentHash-variant Bolt12SemanticError */ -struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_payment_hash(void); /** - * This channel's type, as negotiated during channel open. For old objects where this field - * wasn't serialized, it will default to static_remote_key at deserialization. + * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError */ -void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void); /** - * Constructs a new ChannelTransactionParameters given each field - * - * Note that counterparty_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that funding_outpoint_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the RefundMaybeWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, struct LDKChannelTypeFeatures channel_type_features_arg); +void RefundMaybeWithDerivedMetadataBuilder_free(struct LDKRefundMaybeWithDerivedMetadataBuilder this_obj); /** - * Creates a copy of the ChannelTransactionParameters + * Creates a copy of the RefundMaybeWithDerivedMetadataBuilder */ -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBuilder_clone(const struct LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. + * Creates a new builder for a refund using the [`Refund::payer_id`] for the public node id to + * send to if no [`Refund::paths`] are set. Otherwise, it may be a transient pubkey. + * + * Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], + * and [`Refund::amount_msats`]. + * + * # Note + * + * If constructing a [`Refund`] for use with a [`ChannelManager`], use + * [`ChannelManager::create_refund_builder`] instead of [`RefundBuilder::new`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder */ -uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id, uint64_t amount_msats); /** - * 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. + * Similar to [`RefundBuilder::new`] except, if [`RefundBuilder::path`] is called, the payer id + * is derived from the given [`ExpandedKey`] and nonce. This provides sender privacy by using a + * different payer id for each refund, assuming a different nonce is used. Otherwise, the + * provided `node_id` is used for the payer id. + * + * Also, sets the metadata when [`RefundBuilder::build`] is called such that it can be used by + * [`Bolt12Invoice::verify_using_metadata`] to determine if the invoice was produced for the + * refund given an [`ExpandedKey`]. However, if [`RefundBuilder::path`] is called, then the + * metadata must be included in each [`BlindedMessagePath`] instead. In this case, use + * [`Bolt12Invoice::verify_using_payer_data`]. + * + * The `payment_id` is encrypted in the metadata and should be unique. This ensures that only + * one invoice will be paid for the refund and that payments can be uniquely identified. + * + * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata + * [`Bolt12Invoice::verify_using_payer_data`]: crate::offers::invoice::Bolt12Invoice::verify_using_payer_data + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); /** - * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Sets the [`Refund::description`]. + * + * Successive calls to this method will override the previous setting. */ -void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_description(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr description); /** - * Counter-party public keys + * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has + * already passed is valid and can be checked for using [`Refund::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * Counter-party public keys + * Sets the [`Refund::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_issuer(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected + * by private channels or if [`Refund::payer_id`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_path(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * Sets the [`Refund::chain`] of the given [`Network`] for paying an invoice. If not + * called, [`Network::Bitcoin`] is assumed. + * + * Successive calls to this method will override the previous setting. */ -void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_chain(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); /** - * Constructs a new CounterpartyChannelTransactionParameters given each field + * Sets [`Refund::quantity`] of items. This is purely for informational purposes. It is useful + * when the refund pertains to a [`Bolt12Invoice`] that paid for more than one item from an + * [`Offer`] as specified by [`InvoiceRequest::quantity`]. + * + * Successive calls to this method will override the previous setting. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`Offer`]: crate::offers::offer::Offer */ -MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_quantity(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t quantity); /** - * Creates a copy of the CounterpartyChannelTransactionParameters + * Sets the [`Refund::payer_note`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_payer_note(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr payer_note); /** - * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. + * Builds a [`Refund`] after checking for valid semantics. */ -uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_RefundBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_build(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg); /** - * 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. + * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL. */ -bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b); +void Refund_free(struct LDKRefund this_obj); /** - * Whether the late bound parameters are populated. + * Creates a copy of the Refund */ -MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig); /** - * 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. + * 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. */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the counterparty is the broadcaster. + * Duration since the Unix epoch when an invoice should no longer be sent. * - * self.is_populated() must be true before calling this function. - */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); - -/** - * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read + * If `None`, the refund does not expire. */ -struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write + * Whether the refund has expired. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); +MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read + * Whether the refund has expired given the duration since the Unix epoch. */ -struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); +MUST_USE_RES bool Refund_is_expired_no_std(const struct LDKRefund *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write + * 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 */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender + * privacy by obfuscating its node id. */ -void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Get the channel pubkeys for the broadcaster + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_id`]. + * + * [`payer_id`]: Self::payer_id */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Get the channel pubkeys for the countersignatory + * A chain that the refund is valid for. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Get the contest delay applicable to the transactions. - * Note that the contest delay was selected by the countersignatory. + * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]). + * + * [`chain`]: Self::chain */ -MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *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. + * Features pertaining to requesting an invoice. */ -MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The funding outpoint + * The quantity of an item that refund is for. */ -MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Whether to use anchors for this channel + * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly + * transient pubkey. + * + * [`paths`]: Self::paths */ -MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. + * 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 HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); +MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Our counterparty's signature for the transaction + * Generates a non-cryptographic 64-bit hash of the Refund. */ -struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +uint64_t Refund_hash(const struct LDKRefund *NONNULL_PTR o); /** - * Our counterparty's signature for the transaction + * Read a Refund from a byte array, created by Refund_write */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKCResult_RefundDecodeErrorZ Refund_read(struct LDKu8slice ser); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction - * - * Returns a copy of the field. + * Serialize the Refund object into a byte array which can be read by Refund_read */ -struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * Read a Refund object from a string */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); +struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s); /** - * Creates a copy of the HolderCommitmentTransaction + * Get the string representation of a Refund object */ -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); +struct LDKStr Refund_to_str(const struct LDKRefund *NONNULL_PTR o); /** - * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read + * Creates a copy of the UtxoLookupError */ -struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); +enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); /** - * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write + * Utility method to constructs a new UnknownChain-variant UtxoLookupError */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); +enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); /** - * 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. + * Utility method to constructs a new UnknownTx-variant UtxoLookupError */ -MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKECDSASignature counterparty_sig, struct LDKCVec_ECDSASignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key); +enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); /** - * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Frees any resources used by the UtxoResult */ -void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); +void UtxoResult_free(struct LDKUtxoResult this_ptr); /** - * The commitment transaction + * Creates a copy of the UtxoResult */ -struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); /** - * The commitment transaction + * Utility method to constructs a new Sync-variant UtxoResult */ -void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); +struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Utility method to constructs a new Async-variant UtxoResult */ -const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; +struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Calls the free function if one is set */ -void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UtxoLookup_free(struct LDKUtxoLookup this_ptr); /** - * Constructs a new BuiltCommitmentTransaction given each field + * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); +void UtxoFuture_free(struct LDKUtxoFuture this_obj); /** - * Creates a copy of the BuiltCommitmentTransaction + * Creates a copy of the UtxoFuture */ -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); +struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); /** - * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read + * Builds a new future for later resolution. */ -struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); +MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); /** - * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write + * 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 */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); +void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** - * Get the SIGHASH_ALL sighash value of the transaction. + * Resolves this future against the given `graph` and with the given `result`. * - * This can be used to verify a signature. + * 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 */ -MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +void 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); /** - * Signs the counterparty's commitment transaction. + * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +void NodeId_free(struct LDKNodeId this_obj); /** - * Signs the holder commitment transaction because we are about to broadcast it. + * Creates a copy of the NodeId */ -MUST_USE_RES struct LDKECDSASignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source); +struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); /** - * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. + * Checks if two NodeIds 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 ClosingTransaction_free(struct LDKClosingTransaction this_obj); +bool NodeId_eq(const struct LDKNodeId *NONNULL_PTR a, const struct LDKNodeId *NONNULL_PTR b); /** - * Creates a copy of the ClosingTransaction + * Create a new NodeId from a public key */ -struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); +MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); /** - * Generates a non-cryptographic 64-bit hash of the ClosingTransaction. + * Create a new NodeId from a slice of bytes */ -uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NodeIdDecodeErrorZ NodeId_from_slice(struct LDKu8slice bytes); /** - * 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. + * Get the public key slice from this NodeId */ -bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); +MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * Construct an object of the class + * Get the public key as an array from this NodeId */ -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); +MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR this_arg))[33]; /** - * 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. + * Get the public key from this NodeId */ -MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * 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. + * Get the string representation of a NodeId object */ -MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); +struct LDKStr NodeId_to_str(const struct LDKNodeId *NONNULL_PTR o); /** - * The value to be sent to the holder, or zero if the output will be omitted + * Generates a non-cryptographic 64-bit hash of the NodeId. */ -MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); /** - * The value to be sent to the counterparty, or zero if the output will be omitted + * Serialize the NodeId object into a byte array which can be read by NodeId_read */ -MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); /** - * The destination of the holder's output + * Read a NodeId from a byte array, created by NodeId_write */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); /** - * The destination of the counterparty's output + * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +void NetworkGraph_free(struct LDKNetworkGraph this_obj); /** - * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. */ -void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); +void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); /** - * The pre-built Bitcoin commitment transaction + * Frees any resources used by the NetworkUpdate */ -MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); +void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); /** - * Get the SIGHASH_ALL sighash value of the transaction. - * - * This can be used to verify a signature. + * Creates a copy of the NetworkUpdate */ -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); +struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); /** - * Sign a transaction, either because we are counter-signing the counterparty's transaction or - * because we are about to broadcast a holder transaction. + * Utility method to constructs a new ChannelFailure-variant NetworkUpdate */ -MUST_USE_RES struct LDKECDSASignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); /** - * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new NodeFailure-variant NetworkUpdate */ -void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); +struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); /** - * Creates a copy of the CommitmentTransaction + * Checks if two NetworkUpdates contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); +bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); /** - * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read + * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read */ -struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); +struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); /** - * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write + * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); /** - * The backwards-counting commitment number + * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); /** - * The per commitment point used by the broadcaster. + * 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. */ -MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *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); /** - * The value to be sent to the broadcaster + * 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 uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * The value to be sent to the counterparty + * Handles any network updates originating from [`Event`]s. + * + * [`Event`]: crate::events::Event */ -MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. + * Gets the chain hash for this network graph. */ -MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Trust our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. + * Verifies the signature of a [`NodeAnnouncement`]. * - * 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. + * Returns an error if it is invalid. */ -MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Verify our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. + * Verifies all signatures included in a [`ChannelAnnouncement`]. * - * An external validating signer must call this method before signing - * or using the built transaction. + * Returns an error if one of the signatures is invalid. */ -MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** - * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. + * 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 TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); +struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * The transaction ID of the built Bitcoin transaction + * 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 struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * The pre-built Bitcoin commitment transaction + * Frees any resources used by the ChannelUpdateInfo, 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 ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); /** - * The pre-calculated transaction creation public keys. + * The minimum value, which must be relayed to the next hop via the channel */ -MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Should anchors be used. + * The minimum value, which must be relayed to the next hop via the channel */ -MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_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. + * The maximum value which may be relayed to the next hop via the channel. */ -MUST_USE_RES struct LDKCResult_CVec_ECDSASignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source); +uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Returns the index of the revokeable output, i.e. the `to_local` output sending funds to - * the broadcaster, in the built transaction, if any exists. - * - * There are two cases where this may return `None`: - * - The balance of the revokeable output is below the dust limit (only found on commitments - * early in the channel's lifetime, i.e. before the channel reserve is met). - * - This commitment was created before LDK 0.0.117. In this case, the - * commitment transaction previously didn't contain enough information to locate the - * revokeable output. + * The maximum value which may be relayed to the next hop via the channel. */ -MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Helper method to build an unsigned justice transaction spending the revokeable - * `to_local` output to a destination script. Fee estimation accounts for the expected - * revocation witness data that will be added when signed. - * - * This method will error if the given fee rate results in a fee greater than the value - * of the output being spent, or if there exists no revokeable `to_local` output on this - * commitment transaction. See [`Self::revokeable_output_index`] for more details. - * - * The built transaction will allow fee bumping with RBF, and this method takes - * `feerate_per_kw` as an input such that multiple copies of a justice transaction at different - * fee rates may be built. + * Fees charged when the channel is used for routing */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_build_to_local_justice_tx(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, uint64_t feerate_per_kw, struct LDKCVec_u8Z destination_script); +struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *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. + * Fees charged when the channel is used for routing */ -uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); +void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees 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. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); +uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *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. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); +void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_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 difference in CLTV values that you must have when routing through this channel. */ -bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); +uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Checks if two Bolt11InvoiceFeaturess 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 difference in CLTV values that you must have when routing through this channel. */ -bool Bolt11InvoiceFeatures_eq(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR b); +void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_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. + * Whether the channel can be currently used for payments (in this one direction). */ -bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); +bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *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. + * Whether the channel can be currently used for payments (in this one direction). */ -bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); +void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); /** - * 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. + * 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 */ -bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); +struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * 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. + * 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 */ -bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); +void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate 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. + * Constructs a new ChannelUpdateInfo given each field + * + * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, uint32_t last_update_arg, uint16_t cltv_expiry_delta_arg, bool enabled_arg, struct LDKChannelUpdate last_update_message_arg); /** - * Creates a copy of the InitFeatures + * Creates a copy of the ChannelUpdateInfo */ -struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); +struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); /** - * Creates a copy of the NodeFeatures + * 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. */ -struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); +bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); /** - * Creates a copy of the ChannelFeatures + * Get the string representation of a ChannelUpdateInfo object */ -struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); +struct LDKStr ChannelUpdateInfo_to_str(const struct LDKChannelUpdateInfo *NONNULL_PTR o); /** - * Creates a copy of the Bolt11InvoiceFeatures + * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read */ -struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); /** - * Creates a copy of the OfferFeatures + * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write */ -struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); /** - * Creates a copy of the InvoiceRequestFeatures + * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. */ -struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); +void ChannelInfo_free(struct LDKChannelInfo this_obj); /** - * Creates a copy of the Bolt12InvoiceFeatures + * Protocol features of a channel communicated during its announcement */ -struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the BlindedHopFeatures + * Protocol features of a channel communicated during its announcement */ -struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Creates a copy of the ChannelTypeFeatures + * Source node of the first direction of a channel */ -struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); +struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. + * Source node of the first direction of a channel */ -void InitFeatures_free(struct LDKInitFeatures this_obj); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. + * Source node of the second direction of a channel */ -void NodeFeatures_free(struct LDKNodeFeatures this_obj); +struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. + * Source node of the second direction of a channel */ -void ChannelFeatures_free(struct LDKChannelFeatures this_obj); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL. + * The channel capacity as seen on-chain, if chain lookup is available. */ -void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj); +struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. + * The channel capacity as seen on-chain, if chain lookup is available. */ -void OfferFeatures_free(struct LDKOfferFeatures this_obj); +void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. + * 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 */ -void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); +struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. + * Details about the first direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. + * 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 */ -void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); +struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. + * 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 ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Create a blank Features with no features set + * 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 struct LDKInitFeatures InitFeatures_empty(void); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * 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 InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Creates a copy of the ChannelInfo */ -MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * 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. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Get the string representation of a ChannelInfo object */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKStr ChannelInfo_to_str(const struct LDKChannelInfo *NONNULL_PTR o); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); /** - * Create a blank Features with no features set + * Read a ChannelInfo from a byte array, created by ChannelInfo_write */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); +void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Creates a copy of the DirectedChannelInfo */ -MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Returns information for the channel. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Returns the [`EffectiveCapacity`] of the channel in the direction. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * 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. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Returns the `node_id` of the source hop. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Refers to the `node_id` forwarding the payment to the next hop. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKNodeId DirectedChannelInfo_source(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Returns the `node_id` of the target hop. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Refers to the `node_id` receiving the payment from the previous hop. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKNodeId DirectedChannelInfo_target(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * Frees any resources used by the EffectiveCapacity */ -MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); +void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Creates a copy of the EffectiveCapacity */ -MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); +struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity */ -MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Utility method to constructs a new Total-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Utility method to constructs a new Infinite-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat); /** - * Create a blank Features with no features set + * Utility method to constructs a new Unknown-variant EffectiveCapacity */ -MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void); +struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Returns the effective capacity denominated in millisatoshi. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); +MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Read a RoutingFees from a byte array, created by RoutingFees_write */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Frees any resources used by the NodeAnnouncementDetails, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeAnnouncementDetails_free(struct LDKNodeAnnouncementDetails this_obj); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Protocol features the node announced support for */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKNodeFeatures NodeAnnouncementDetails_get_features(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Protocol features the node announced support for */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeAnnouncementDetails_set_features(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Create a blank Features with no features set + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); +uint32_t NodeAnnouncementDetails_get_last_update(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); +void NodeAnnouncementDetails_set_last_update(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Color assigned to the node */ -MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +const uint8_t (*NodeAnnouncementDetails_get_rgb(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr))[3]; /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Color assigned to the node */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeAnnouncementDetails_set_rgb(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKNodeAlias NodeAnnouncementDetails_get_alias(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeAnnouncementDetails_set_alias(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Internet-level addresses via which one can connect to the node * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCVec_SocketAddressZ NodeAnnouncementDetails_get_addresses(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Create a blank Features with no features set + * Internet-level addresses via which one can connect to the node */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); +void NodeAnnouncementDetails_set_addresses(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Constructs a new NodeAnnouncementDetails given each field */ -MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); +MUST_USE_RES struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Creates a copy of the NodeAnnouncementDetails */ -MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_clone(const struct LDKNodeAnnouncementDetails *NONNULL_PTR orig); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Checks if two NodeAnnouncementDetailss 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_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +bool NodeAnnouncementDetails_eq(const struct LDKNodeAnnouncementDetails *NONNULL_PTR a, const struct LDKNodeAnnouncementDetails *NONNULL_PTR b); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Frees any resources used by the NodeAnnouncementInfo */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Creates a copy of the NodeAnnouncementInfo */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Utility method to constructs a new Relayed-variant NodeAnnouncementInfo */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_relayed(struct LDKNodeAnnouncement a); /** - * Create a blank Features with no features set + * Utility method to constructs a new Local-variant NodeAnnouncementInfo */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_local(struct LDKNodeAnnouncementDetails a); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Checks if two NodeAnnouncementInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); +bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Protocol features the node announced support for */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeFeatures NodeAnnouncementInfo_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * When the last known update to the node state was issued. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Value may or may not be a timestamp, depending on the policy of the origin node. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES uint32_t NodeAnnouncementInfo_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Color assigned to the node */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKThreeBytes NodeAnnouncementInfo_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Moniker assigned to the node. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * May be invalid or malicious (eg control chars), should not be exposed to the user. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKNodeAlias NodeAnnouncementInfo_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. + * Internet-level addresses via which one can connect to the node + */ +MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); + +/** + * An initial announcement of the node * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Not stored if contains excess data to prevent DoS. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncementInfo_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read */ -MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write */ -MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *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); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Constructs a new NodeAlias given each field */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Creates a copy of the NodeAlias */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Generates a non-cryptographic 64-bit hash of the NodeAlias. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * 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. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); /** - * Create a blank Features with no features set + * Get the string representation of a NodeAlias object */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); +struct LDKStr NodeAlias_to_str(const struct LDKNodeAlias *NONNULL_PTR o); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read */ -MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); +struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Read a NodeAlias from a byte array, created by NodeAlias_write */ -MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeInfo_free(struct LDKNodeInfo this_obj); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * All valid channels a node has announced * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * All valid channels a node has announced */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * 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. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCOption_NodeAnnouncementInfoZ NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read + * 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. */ -struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCOption_NodeAnnouncementInfoZ val); /** - * Read a InitFeatures from a byte array, created by InitFeatures_write + * Creates a copy of the NodeInfo */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); /** - * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read + * 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 LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); +bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); /** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + * Returns whether the node has only announced Tor addresses. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeInfo_is_tor_only(const struct LDKNodeInfo *NONNULL_PTR this_arg); /** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + * Get the string representation of a NodeInfo object */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); +struct LDKStr NodeInfo_to_str(const struct LDKNodeInfo *NONNULL_PTR o); /** - * Read a NodeFeatures from a byte array, created by NodeFeatures_write + * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read */ -struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); /** - * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read + * Read a NodeInfo from a byte array, created by NodeInfo_write */ -struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); /** - * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write + * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); /** - * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read + * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ -struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); /** - * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write + * Get the string representation of a NetworkGraph object */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKStr NetworkGraph_to_str(const struct LDKNetworkGraph *NONNULL_PTR o); /** - * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read + * Creates a new, empty, network graph. */ -struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); /** - * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write + * Returns a read-only view of the network graph. */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + * The unix timestamp provided by the most recent rapid gossip sync. + * It will be set by the rapid sync process after every sync completion. */ -struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + * 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. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); +void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); /** - * Set this feature as optional. + * 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. */ -void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Set this feature as required. + * 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 InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is supported. + * 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. */ -MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +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); /** - * Set this feature as optional. + * 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. + * + * This will skip verification of if the channel is actually on-chain. */ -void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement_no_lookup(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** - * Set this feature as required. + * 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 NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is supported. + * 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. */ -MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is required. + * 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 bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * Checks if this feature is required. + * Marks a node in the graph as permanently failed, effectively removing it and its channels + * from local storage. */ -MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * Set this feature as optional. + * 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. */ -void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Set this feature as required. + * 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. */ -void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); /** - * Checks if this feature is supported. + * 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. */ -MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Set this feature as optional. + * 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 InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); /** - * Set this feature as required. + * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. + * + * This checks whether the update currently is applicable by [`Self::update_channel`]. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Checks if this feature is supported. + * 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 */ -MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * Set this feature as optional. + * Returns the list of channels in the graph */ -void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * Set this feature as required. + * 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 */ -void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Checks if this feature is supported. + * Returns the list of nodes in the graph */ -MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Get network addresses by node id. + * Returns None if the requested node is completely unknown, + * or if node announcement for the node was never received. */ -MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** - * Checks if this feature is required. + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void DefaultRouter_free(struct LDKDefaultRouter this_obj); /** - * Set this feature as optional. + * Creates a new router. */ -void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); /** - * Set this feature as required. + * 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 */ -void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Constructs a new MessageRouter which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is */ -MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKMessageRouter DefaultRouter_as_MessageRouter(const struct LDKDefaultRouter *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Calls the free function if one is set */ -void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Router_free(struct LDKRouter this_ptr); /** - * Set this feature as required. + * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); /** - * Checks if this feature is supported. + * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ -MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); /** - * Checks if this feature is required. + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); /** - * Set this feature as optional. + * Creates a copy of the InFlightHtlcs */ -void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); /** - * Set this feature as required. + * Constructs an empty `InFlightHtlcs`. */ -void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); /** - * Checks if this feature is supported. + * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`. */ -MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id); /** - * Set this feature as optional. + * Adds a known HTLC given the public key of the HTLC source, target, and short channel + * id. */ -void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void InFlightHtlcs_add_inflight_htlc(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid, uint64_t used_msat); /** - * Set this feature as required. + * Returns liquidity in msat given the public key of the HTLC source, target, and short channel + * id. */ -void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is supported. + * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read */ -MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); /** - * Set this feature as optional. + * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write */ -void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); /** - * Set this feature as required. + * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. */ -void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void RouteHop_free(struct LDKRouteHop this_obj); /** - * Checks if this feature is supported. + * The node_id of the node at this hop. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * The node_id of the node at this hop. */ -MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if this feature is required. + * 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. */ -MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * 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. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Set this feature as optional. + * The channel that should be used from the previous hop to reach this node. */ -void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The channel that should be used from the previous hop to reach this node. */ -void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if this feature is supported. + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Set this feature as required. + * 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 [`BlindedPaymentPath`], 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 */ -void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * 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 [`BlindedPaymentPath`], 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 */ -MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Set this feature as optional. + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded + * path + * * otherwise, this is the CLTV delta expected at the destination */ -void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded + * path + * * otherwise, this is the CLTV delta expected at the destination */ -void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is supported. + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Indicates whether this hop is possibly announced in the public network graph. + * + * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we + * either know for sure it's announced in the public graph, or if any public channels exist + * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe + * the channel to be unannounced. + * + * Will be `true` for objects serialized with LDK version 0.0.116 and before. */ -MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); /** - * Checks if this feature is required. + * Constructs a new RouteHop given each field */ -MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg, bool maybe_announced_channel_arg); /** - * Checks if this feature is required. + * Creates a copy of the RouteHop */ -MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the RouteHop. */ -void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); /** - * Set this feature as required. + * 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. */ -void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Serialize the RouteHop object into a byte array which can be read by RouteHop_read */ -MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); /** - * Set this feature as optional. + * Read a RouteHop from a byte array, created by RouteHop_write */ -void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); /** - * Set this feature as required. + * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void BlindedTail_free(struct LDKBlindedTail this_obj); /** - * Checks if this feature is supported. + * The hops of the [`BlindedPaymentPath`] provided by the recipient. */ -MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The hops of the [`BlindedPaymentPath`] provided by the recipient. */ -void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); /** - * Set this feature as required. + * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. */ -void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if this feature is required. + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is required. + * The total amount paid on this [`Path`], excluding the fees. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The total amount paid on this [`Path`], excluding the fees. */ -void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val); /** - * Set this feature as required. + * Constructs a new BlindedTail given each field */ -void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +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); /** - * Checks if this feature is supported. + * Creates a copy of the BlindedTail */ -MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the BlindedTail. */ -void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o); /** - * Set this feature as required. + * 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. */ -void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read */ -MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj); /** - * Set this feature as optional. + * Read a BlindedTail from a byte array, created by BlindedTail_write */ -void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser); /** - * Set this feature as required. + * Frees any resources used by the Path, if is_owned is set and inner is non-NULL. */ -void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void Path_free(struct LDKPath this_obj); /** - * Checks if this feature is supported. + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val); /** - * Set this feature as required. + * 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 */ -void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * 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 bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val); /** - * Checks if this feature is required. + * Constructs a new Path given each field + * + * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); /** - * Checks if this feature is required. + * Creates a copy of the Path */ -MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Generates a non-cryptographic 64-bit hash of the Path. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o); /** - * Checks if this feature is required. + * 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. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b); /** - * Set this feature as optional. + * Gets the fees for a given path, excluding any excess paid to the recipient. */ -void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Gets the total amount paid on this [`Path`], excluding the fees. */ -void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Gets the final hop's CLTV expiry delta. */ -MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Route_free(struct LDKRoute this_obj); /** - * Set this feature as required. + * 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 NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * 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 bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); /** - * Checks if this feature is required. + * The `route_params` parameter passed to [`find_route`]. + * + * This is used by `ChannelManager` to track information which may be required for retries. + * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * The `route_params` parameter passed to [`find_route`]. + * + * This is used by `ChannelManager` to track information which may be required for retries. + * + * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); /** - * Set this feature as optional. + * Constructs a new Route given each field + * + * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); /** - * Set this feature as required. + * Creates a copy of the Route */ -void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Generates a non-cryptographic 64-bit hash of the Route. */ -MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); /** - * Set this feature as optional. + * 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. */ -void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); /** - * Set this feature as required. + * Returns the total amount of fees paid on this [`Route`]. + * + * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to + * the recipient, which can happen in excess of the amount passed to [`find_route`] via + * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ -void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns the total amount paid on this [`Route`], excluding the fees. + * + * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if + * we had to reach the [`htlc_minimum_msat`] limits. + * + * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message */ -MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Get the string representation of a Route object */ -void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKStr Route_to_str(const struct LDKRoute *NONNULL_PTR o); /** - * Set this feature as required. + * Serialize the Route object into a byte array which can be read by Route_read */ -void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); /** - * Checks if this feature is supported. + * Read a Route from a byte array, created by Route_write */ -MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); /** - * Checks if this feature is required. + * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void RouteParameters_free(struct LDKRouteParameters this_obj); /** - * Checks if this feature is required. + * The parameters of the failed payment path. */ -MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * The parameters of the failed payment path. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); /** - * Set this feature as optional. + * The amount in msats sent on the failed payment path. */ -void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The amount in msats sent on the failed payment path. */ -void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if this feature is supported. + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. */ -MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The maximum total fees, in millisatoshi, that may accrue during route finding. + * + * This limit also applies to the total fees that may arise while retrying failed payment + * paths. + * + * Note that values below a few sats may result in some paths being spuriously ignored. */ -void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Set this feature as required. + * Constructs a new RouteParameters given each field */ -void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg); /** - * Checks if this feature is supported. + * Creates a copy of the RouteParameters */ -MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the RouteParameters. */ -void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); /** - * Set this feature as required. + * 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. */ -void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. + * + * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats */ -MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); /** - * Checks if this feature is required. + * Sets the maximum number of hops that can be included in a payment path, based on the provided + * [`RecipientOnionFields`] and blinded paths. */ -MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ RouteParameters_set_max_path_length(struct LDKRouteParameters *NONNULL_PTR this_arg, const struct LDKRecipientOnionFields *NONNULL_PTR recipient_onion, bool is_keysend, uint32_t best_block_height); /** - * Checks if this feature is required. + * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ -MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); /** - * Checks if this feature is required. + * Read a RouteParameters from a byte array, created by RouteParameters_write */ -MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); /** - * Set this feature as optional. + * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void PaymentParameters_free(struct LDKPaymentParameters this_obj); /** - * Set this feature as required. + * Information about the payee, such as their features and route hints for their channels. */ -void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * Information about the payee, such as their features and route hints for their channels. */ -MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val); /** - * Set this feature as optional. + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Checks if this feature is supported. + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is required. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Set this feature as required. + * The maximum number of [`Path::hops`] in any returned path. + * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. */ -void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint8_t PaymentParameters_get_max_path_length(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The maximum number of [`Path::hops`] in any returned path. + * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. */ -MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_max_path_length(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Set this feature as optional. + * 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 NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * 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 NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Checks if this feature is supported. + * 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. */ -MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * 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 ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Set this feature as required. + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. + * + * Returns a copy of the field. */ -void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_blinded_path_idxs(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void PaymentParameters_set_previously_failed_blinded_path_idxs(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Checks if this feature is required. + * Constructs a new PaymentParameters given each field */ -MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_path_length_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, struct LDKCVec_u64Z previously_failed_blinded_path_idxs_arg); /** - * Checks if this feature is required. + * Creates a copy of the PaymentParameters */ -MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Generates a non-cryptographic 64-bit hash of the PaymentParameters. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); /** - * Set this feature as optional. + * 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. */ -void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); /** - * Set this feature as required. + * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read */ -void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); /** - * Checks if this feature is supported. + * Read a PaymentParameters from a byte array, created by PaymentParameters_write */ -MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); /** - * Set this feature as optional. + * 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. */ -void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** - * Set this feature as required. + * 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. + * + * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose + * whether your router will be allowed to find a multi-part route for this payment. If you + * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via + * [`RecipientOnionFields::secret_only`]. + * + * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only */ -void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp); /** - * Checks if this feature is supported. + * Creates parameters for paying to a blinded payee from the provided invoice. Sets + * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and + * [`PaymentParameters::expiry_time`]. */ -MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); /** - * Checks if this feature is required. + * Creates parameters for paying to a blinded payee from the provided blinded route hints. */ -MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_BlindedPaymentPathZ blinded_route_hints); /** - * Checks if this feature is required. + * Frees any resources used by the Payee */ -MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Payee_free(struct LDKPayee this_ptr); /** - * Set this feature as optional. + * Creates a copy of the Payee */ -void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); /** - * Set this feature as required. + * Utility method to constructs a new Blinded-variant Payee */ -void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKPayee Payee_blinded(struct LDKCVec_BlindedPaymentPathZ route_hints, struct LDKBolt12InvoiceFeatures features); /** - * Checks if this feature is supported. + * Utility method to constructs a new Clear-variant Payee */ -MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the Payee. */ -void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); /** - * Set this feature as required. + * Checks if two Payees contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Serialize the RouteHint object into a byte array which can be read by RouteHint_read */ -MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); /** - * Checks if this feature is required. + * Read a RouteHint from a byte array, created by RouteHint_write */ -MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); /** - * Checks if this feature is required. + * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read */ -MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); /** - * Set this feature as optional. + * Read a RouteHintHop from a byte array, created by RouteHintHop_write */ -void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); /** - * Set this feature as required. + * Frees any resources used by the FirstHopCandidate, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void FirstHopCandidate_free(struct LDKFirstHopCandidate this_obj); /** - * Checks if this feature is supported. + * Creates a copy of the FirstHopCandidate */ -MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKFirstHopCandidate FirstHopCandidate_clone(const struct LDKFirstHopCandidate *NONNULL_PTR orig); /** - * Set this feature as optional. + * Frees any resources used by the PublicHopCandidate, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void PublicHopCandidate_free(struct LDKPublicHopCandidate this_obj); /** - * Set this feature as required. + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. */ -void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t PublicHopCandidate_get_short_channel_id(const struct LDKPublicHopCandidate *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. */ -MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void PublicHopCandidate_set_short_channel_id(struct LDKPublicHopCandidate *NONNULL_PTR this_ptr, uint64_t val); /** - * Set this feature as optional. + * Creates a copy of the PublicHopCandidate */ -void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKPublicHopCandidate PublicHopCandidate_clone(const struct LDKPublicHopCandidate *NONNULL_PTR orig); /** - * Set this feature as required. + * Frees any resources used by the PrivateHopCandidate, if is_owned is set and inner is non-NULL. */ -void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void PrivateHopCandidate_free(struct LDKPrivateHopCandidate this_obj); /** - * Checks if this feature is supported. + * Creates a copy of the PrivateHopCandidate */ -MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKPrivateHopCandidate PrivateHopCandidate_clone(const struct LDKPrivateHopCandidate *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Frees any resources used by the BlindedPathCandidate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void BlindedPathCandidate_free(struct LDKBlindedPathCandidate this_obj); /** - * Checks if this feature is required. + * Creates a copy of the BlindedPathCandidate */ -MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKBlindedPathCandidate BlindedPathCandidate_clone(const struct LDKBlindedPathCandidate *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Frees any resources used by the OneHopBlindedPathCandidate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void OneHopBlindedPathCandidate_free(struct LDKOneHopBlindedPathCandidate this_obj); /** - * Set this feature as optional. + * Creates a copy of the OneHopBlindedPathCandidate */ -void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKOneHopBlindedPathCandidate OneHopBlindedPathCandidate_clone(const struct LDKOneHopBlindedPathCandidate *NONNULL_PTR orig); /** - * Set this feature as required. + * Frees any resources used by the CandidateRouteHop */ -void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void CandidateRouteHop_free(struct LDKCandidateRouteHop this_ptr); /** - * Checks if this feature is supported. + * Creates a copy of the CandidateRouteHop */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_clone(const struct LDKCandidateRouteHop *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Utility method to constructs a new FirstHop-variant CandidateRouteHop */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_first_hop(struct LDKFirstHopCandidate a); /** - * Set this feature as optional. + * Utility method to constructs a new PublicHop-variant CandidateRouteHop */ -void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_public_hop(struct LDKPublicHopCandidate a); /** - * Set this feature as required. + * Utility method to constructs a new PrivateHop-variant CandidateRouteHop */ -void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_private_hop(struct LDKPrivateHopCandidate a); /** - * Checks if this feature is supported. + * Utility method to constructs a new Blinded-variant CandidateRouteHop */ -MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_blinded(struct LDKBlindedPathCandidate a); /** - * Set this feature as optional. + * Utility method to constructs a new OneHopBlinded-variant CandidateRouteHop */ -void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCandidateRouteHop CandidateRouteHop_one_hop_blinded(struct LDKOneHopBlindedPathCandidate a); /** - * Set this feature as required. + * Returns the globally unique short channel ID for this hop, if one is known. + * + * This only returns `Some` if the channel is public (either our own, or one we've learned + * from the public network graph), and thus the short channel ID we have for this channel is + * globally unique and identifies this channel in a global namespace. */ -void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z CandidateRouteHop_globally_unique_short_channel_id(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns the required difference in HTLC CLTV expiry between the [`Self::source`] and the + * next-hop for an HTLC taking this hop. + * + * This is the time that the node(s) in this hop have to claim the HTLC on-chain if the + * next-hop goes on chain with a payment preimage. */ -MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint32_t CandidateRouteHop_cltv_expiry_delta(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns the minimum amount that can be sent over this hop, in millisatoshis. */ -void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t CandidateRouteHop_htlc_minimum_msat(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns the fees that must be paid to route an HTLC over this channel. */ -void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRoutingFees CandidateRouteHop_fees(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns the source node id of current hop. + * + * Source node id refers to the node forwarding the HTLC through this hop. + * + * For [`Self::FirstHop`] we return payer's node id. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeId CandidateRouteHop_source(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns the target node id of this hop, if known. + * + * Target node id refers to the node receiving the HTLC after this hop. + * + * For [`Self::Blinded`] we return `None` because the ultimate destination after the blinded + * path is unknown. + * + * For [`Self::OneHopBlinded`] we return `None` because the target is the same as the source, + * and such a return value would be somewhat nonsensical. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeId CandidateRouteHop_target(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * 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 the `payee` field + * in the given [`RouteParameters::payment_params`]. + * 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 the `payee` field + * of [`RouteParameters::payment_params`]. + * + * 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. + * + * # Panics + * + * Panics if first_hops contains channels without `short_channel_id`s; + * [`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 bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScoreLookUp *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); /** - * Checks if this feature is required. + * 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. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +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]); /** - * Set this feature as optional. + * Calls the free function if one is set */ -void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); /** - * Set this feature as required. + * Calls the free function if one is set */ -void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); /** - * Checks if this feature is supported. + * Calls the free function if one is set */ -MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Score_free(struct LDKScore this_ptr); /** - * Checks if this feature is required. + * Calls the free function if one is set */ -MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void LockableScore_free(struct LDKLockableScore this_ptr); /** - * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void ShutdownScript_free(struct LDKShutdownScript this_obj); +void WriteableScore_free(struct LDKWriteableScore this_ptr); /** - * Creates a copy of the ShutdownScript + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. */ -struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); /** - * 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. + * 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 */ -bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); +struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. + * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read */ -void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); +struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); /** - * 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 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 */ -struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); +struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ -void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * Constructs a new InvalidShutdownScript given each field + * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); +void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); /** - * Creates a copy of the InvalidShutdownScript + * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. */ -struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); +void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); /** - * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); +struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); /** - * Read a ShutdownScript from a byte array, created by ShutdownScript_write + * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read */ -struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); +struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); /** - * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); +struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); /** - * Generates a P2WSH script pubkey from the given [`WScriptHash`]. + * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); +void ChannelUsage_free(struct LDKChannelUsage this_obj); /** - * 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`. + * The amount to send through the channel, denominated in millisatoshis. */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program); +uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Converts the shutdown script into the underlying [`Script`]. + * The amount to send through the channel, denominated in millisatoshis. */ -MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); +void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * 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 + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); +uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. - * - * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the Retry + * The effective capacity of the channel. */ -void Retry_free(struct LDKRetry this_ptr); +struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Creates a copy of the Retry + * The effective capacity of the channel. */ -struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); +void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); /** - * Utility method to constructs a new Attempts-variant Retry + * Constructs a new ChannelUsage given each field */ -struct LDKRetry Retry_attempts(uint32_t a); +MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); /** - * Utility method to constructs a new Timeout-variant Retry + * Creates a copy of the ChannelUsage */ -struct LDKRetry Retry_timeout(uint64_t a); +struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); /** - * Checks if two Retrys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. */ -bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); +void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); /** - * Generates a non-cryptographic 64-bit hash of the Retry. + * Creates a copy of the FixedPenaltyScorer */ -uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); +struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); /** - * Serialize the Retry object into a byte array which can be read by Retry_read + * Creates a new scorer using `penalty_msat`. */ -struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); +MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** - * Read a Retry from a byte array, created by Retry_write + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); +struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * Creates a copy of the RetryableSendFailure + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); +struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read */ -enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); +struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); /** - * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write */ -enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); /** - * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure + * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. */ -enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); +void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); /** - * Checks if two RetryableSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL. */ -bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b); +void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj); /** - * Frees any resources used by the PaymentSendFailure + * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat */ -void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); +uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the PaymentSendFailure + * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat */ -struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); +void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new ParameterError-variant PaymentSendFailure + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat */ -struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); +uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PathParameterError-variant PaymentSendFailure + * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty + * applied to each channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment + * amount plus the amount of any other HTLCs flowing we sent over the same channel). + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat */ -struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); +void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure + * 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`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life */ -struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); +uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure + * 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`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life */ -struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); +void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new PartialFailure-variant PaymentSendFailure + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * 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 */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); +uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Checks if two PaymentSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined by our + * latest estimates of the channel's liquidity, to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative + * `log10` of the success probability. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * 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 */ -bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b); +void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the ProbeSendFailure + * 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 ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); +uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the ProbeSendFailure + * 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 */ -struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); +void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost for + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. + * + * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead + * of using only our latest estimate for the current liquidity available in the channel, it + * 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 LDKProbeSendFailure ProbeSendFailure_route_not_found(void); +uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendingFailed-variant ProbeSendFailure + * A multiplier used in conjunction with the total amount flowing over a channel and the + * negative `log10` of the channel's success probability for the payment, as determined based + * on the history of our estimates of the channel's available liquidity, to determine a + * penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost for + * large payments. The penalty is computed as the product of this multiplier and `2^20`ths + * of the amount flowing over this channel, weighted by the negative `log10` of the success + * probability. + * + * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead + * of using only our latest estimate for the current liquidity available in the channel, it + * 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 LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a); +void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two ProbeSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us + * 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 */ -bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); +uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the RecipientOnionFields, 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, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us + * prefer nodes with a smaller `htlc_maximum_msat`. We treat such nodes preferentially + * as this makes balance discovery attacks harder to execute, thereby creating an incentive + * to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat */ -void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); +void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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 penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * - * 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 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. * - * Some implementations may reject spontaneous payments with payment secrets, so you may only - * want to provide a secret for a spontaneous payment if MPP is needed and you know your - * recipient will not reject it. + * 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 */ -struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * 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 penalty is applied when the total amount flowing over a channel exceeds our current + * estimate of the channel's available liquidity. The total amount is the amount of the + * current HTLC plus any HTLCs which we've sent over the same channel. * - * 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 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. * - * Some implementations may reject spontaneous payments with payment secrets, so you may only - * want to provide a secret for a spontaneous payment if MPP is needed and you know your - * recipient will not reject it. + * 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 RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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 order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. * - * 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. + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. * - * 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. + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. * - * Returns a copy of the field. + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false */ -struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * 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 order to calculate most of the scores above, we must first convert a lower and upper + * bound on the available liquidity in a channel into the probability that we think a payment + * will succeed. That probability is derived from a Probability Density Function for where we + * think the liquidity in a channel likely lies, given such bounds. * - * 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. + * If this flag is set, that PDF is simply a constant - we assume that the actual available + * liquidity in a channel is just as likely to be at any point between our lower and upper + * bounds. * - * 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. + * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an + * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This + * matches experimental results - most routing nodes do not aggressively rebalance their + * channels and flows in the network are often unbalanced, leaving liquidity usually + * unavailable. + * + * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number + * of floating-point multiplications in the hottest routing code, which may lead to routing + * performance degradation on some machines. + * + * Default value: false */ -void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); /** - * Creates a copy of the RecipientOnionFields + * Creates a copy of the ProbabilisticScoringFeeParameters */ -struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig); +struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig); /** - * 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. + * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used. */ -bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b); +MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void); /** - * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read + * Marks the node with the given `node_id` as banned, + * i.e it will be avoided during path finding. */ -struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj); +void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write + * Marks all nodes in the given list as banned, i.e., + * they will be avoided during path finding. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser); +void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); /** - * 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. + * Removes the node with the given `node_id` from the list of nodes to avoid. */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret); +void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create - * payable HTLCs except for single-path spontaneous payments, i.e. this should generally - * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending - * a spontaneous MPP this will not work as all MPP require payment secrets; you may - * instead want to use [`RecipientOnionFields::secret_only`]. - * - * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment - * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only + * Sets a manual penalty for the given node. */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); +void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); /** - * Creates a new [`RecipientOnionFields`] from an existing one, adding custom TLVs. Each - * TLV is provided as a `(u64, Vec)` for the type number and serialized value - * respectively. TLV type numbers must be unique and within the range - * reserved for custom types, i.e. >= 2^16, otherwise this method will return `Err(())`. - * - * This method will also error for types in the experimental range which have been - * standardized within the protocol, which only includes 5482373484 (keysend) for now. - * - * See [`Self::custom_tlvs`] for more info. + * Removes the node with the given `node_id` from the list of manual penalties. */ -MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); +void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Gets the custom TLVs that will be sent or have been received. - * - * Custom TLVs allow sending extra application-specific data with a payment. They provide - * additional flexibility on top of payment metadata, as while other implementations may - * require `payment_metadata` to reflect metadata provided in an invoice, custom TLVs - * do not have this restriction. - * - * Note that if this field is non-empty, it will contain strictly increasing TLVs, each - * represented by a `(u64, Vec)` for its type number and serialized value respectively. - * This is validated when setting this field using [`Self::with_custom_tlvs`]. + * Clears the list of manual penalties that are applied during path finding. */ -MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL. */ -void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj); /** - * Creates a copy of a Type + * 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. + * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] + * + * Note that after 16 or more half lives all historical data will be completely gone. + * + * Default value: 14 days + * + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ -struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); +uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * 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. + * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] + * + * Note that after 16 or more half lives all historical data will be completely gone. + * + * Default value: 14 days + * + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ -void Type_free(struct LDKType this_ptr); +void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + * 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 Offer_free(struct LDKOffer this_obj); +uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the Offer + * 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 LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); +void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * Constructs a new ProbabilisticScoringDecayParameters given each field */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg); /** - * Opaque bytes set by the originator. Useful for authentication and validating fields since it - * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + * Creates a copy of the ProbabilisticScoringDecayParameters */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig); /** - * 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 + * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used. */ -MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void); /** - * 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. + * Creates a new scorer using the given scoring parameters for sending payments from a node + * through a network graph. */ -MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); /** - * Features pertaining to the offer. + * 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. */ -MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); +void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * Query the estimated minimum and maximum liquidity available for sending a payment over the + * channel with `scid` towards the given `target` node. */ -MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); +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); /** - * 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. + * Query the historical estimated minimum and maximum liquidity available for sending a + * payment over the channel with `scid` towards the given `target` node. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns two sets of 32 buckets. The first set describes the lower-bound liquidity history, + * the second set describes the upper-bound liquidity history. Each bucket describes the + * relative frequency at which we've seen a liquidity bound in the bucket's range relative to + * the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed, + * more recent data points are weighted more heavily than older datapoints. + * + * Note that the range of each bucket varies by its location to provide more granular results + * at the edges of a channel's capacity, where it is more likely to sit. + * + * When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket + * is calculated by dividing that bucket's value with the total value of all buckets. + * + * For example, using a lower bucket count for illustrative purposes, a value of + * `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very + * close to the channel's capacity to be 100%, and have never (recently) seen it in any other + * bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both + * in the top and bottom bucket, and roughly with similar (recent) frequency. + * + * Because the datapoints are decayed slowly over time, values will eventually return to + * `Some(([0; 32], [0; 32]))` or `None` if no data remains for a channel. + * + * In order to fetch a single success probability from the buckets provided here, as used in + * the scoring model, see [`Self::historical_estimated_payment_success_probability`]. */ -MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * Query the probability of payment success sending the given `amount_msat` over the channel + * with `scid` towards the given `target` node, based on the historical estimated liquidity + * bounds. + * + * These are the same bounds as returned by + * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by + * [`Self::estimated_channel_liquidity_range`]). */ -MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); /** - * The quantity of items supported. + * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is */ -MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is */ -MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Returns whether the given chain is supported by the offer. + * 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 */ -MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); +struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Whether the offer has expired. + * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read */ -MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); /** - * Returns whether the given quantity is valid for the offer. + * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ -MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); +struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); /** - * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); /** - * Serialize the Offer object into a byte array which can be read by Offer_read + * The outpoint which is spendable. */ -struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); +struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL. + * The outpoint which is spendable. */ -void Amount_free(struct LDKAmount this_obj); +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Creates a copy of the Amount + * Per commitment point to derive the delayed payment key by key holder. */ -struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL. + * Per commitment point to derive the delayed payment key by key holder. */ -void Quantity_free(struct LDKQuantity this_obj); +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the Quantity + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Read a Offer object from a string + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. + * The output which is referenced by the given outpoint. */ -void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); +struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Returns the [`TaggedHash`] of the invoice to sign. + * The output which is referenced by the given outpoint. */ -MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); +struct LDKRevocationKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Creates a copy of the Bolt12Invoice + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKRevocationKey val); /** - * The chains that may be used when paying a requested invoice. - * - * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. - * - * [`Offer::chains`]: crate::offers::offer::Offer::chains + * 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. */ -MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the - * invoice originated from an offer. - * - * From [`InvoiceRequest::chain`] or [`Refund::chain`]. - * - * [`offer_chains`]: Self::offer_chains - * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + * 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. */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Opaque bytes set by the originating [`Offer`]. - * - * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or - * if the [`Offer`] did not set it. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + * The value of the channel which this output originated from, possibly indirectly. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The minimum amount required for a successful payment of a single item. - * - * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if - * the [`Offer`] did not set it. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::amount`]: crate::offers::offer::Offer::amount - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The value of the channel which this output originated from, possibly indirectly. */ -MUST_USE_RES struct LDKAmount UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Features pertaining to the originating [`Offer`]. + * The channel public keys and other parameters needed to generate a spending transaction or + * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. * - * From [`Offer::offer_features`]; `None` if the invoice was created in response to a - * [`Refund`]. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features + * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); - -/** - * A complete description of the purpose of the originating offer or refund. - * - * From [`Offer::description`] or [`Refund::description`]. - * - * [`Offer::description`]: crate::offers::offer::Offer::description - */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKChannelTransactionParameters DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Duration since the Unix epoch when an invoice should no longer be requested. + * The channel public keys and other parameters needed to generate a spending transaction or + * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. * - * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. * - * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * The issuer of the offer or refund. - * - * From [`Offer::issuer`] or [`Refund::issuer`]. - * - * [`Offer::issuer`]: crate::offers::offer::Offer::issuer + * Constructs a new DelayedPaymentOutputDescriptor given each field * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKRevocationKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); /** - * Paths to the recipient originating from publicly reachable nodes. - * - * From [`Offer::paths`] or [`Refund::paths`]. - * - * [`Offer::paths`]: crate::offers::offer::Offer::paths + * Creates a copy of the DelayedPaymentOutputDescriptor */ -MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); /** - * The quantity of items supported. - * - * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a - * [`Refund`]. - * - * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. */ -MUST_USE_RES struct LDKQuantity UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); /** - * An unpredictable series of bytes from the payer. - * - * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + * 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. */ -MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); /** - * Features pertaining to requesting an invoice. - * - * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read */ -MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); /** - * The quantity of items requested or refunded for. - * - * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * A possibly transient pubkey used to sign the invoice request or to send an invoice for a - * refund in case there are no [`message_paths`]. - * - * [`message_paths`]: Self::message_paths + * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); /** - * A payer-provided note reflected back in the invoice. - * - * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The outpoint which is spendable. */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Duration since the Unix epoch when the invoice was created. + * The outpoint which is spendable. */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore - * should no longer be paid. + * The output which is referenced by the given outpoint. */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Whether the invoice has expired. + * The output which is referenced by the given outpoint. */ -MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + * 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. */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * The minimum amount required for a successful payment of the invoice. + * 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. */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Features pertaining to paying an invoice. + * The value of the channel which this transactions spends. */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The public key corresponding to the key used to sign the invoice. + * The value of the channel which this transactions spends. */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * The chains that may be used when paying a requested invoice. + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. * - * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. * - * [`Offer::chains`]: crate::offers::offer::Offer::chains + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the - * invoice originated from an offer. + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. * - * From [`InvoiceRequest::chain`] or [`Refund::chain`]. + * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. * - * [`offer_chains`]: Self::offer_chains - * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * Opaque bytes set by the originating [`Offer`]. - * - * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or - * if the [`Offer`] did not set it. + * Constructs a new StaticPaymentOutputDescriptor given each field * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); /** - * The minimum amount required for a successful payment of a single item. - * - * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if - * the [`Offer`] did not set it. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::amount`]: crate::offers::offer::Offer::amount - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the StaticPaymentOutputDescriptor */ -MUST_USE_RES struct LDKAmount Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); /** - * Features pertaining to the originating [`Offer`]. - * - * From [`Offer::offer_features`]; `None` if the invoice was created in response to a - * [`Refund`]. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. */ -MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); /** - * A complete description of the purpose of the originating offer or refund. - * - * From [`Offer::description`] or [`Refund::description`]. - * - * [`Offer::description`]: crate::offers::offer::Offer::description + * 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. */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. + * Returns the `witness_script` of the spendable output. * - * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry + * Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that + * originated from an anchor outputs channel, as they take the form of a P2WSH script. */ -MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); /** - * The issuer of the offer or refund. - * - * From [`Offer::issuer`] or [`Refund::issuer`]. - * - * [`Offer::issuer`]: crate::offers::offer::Offer::issuer - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The maximum length a well-formed witness spending one of these should have. + * Note: If you have the grind_signatures feature enabled, this will be at least 1 byte + * shorter. */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); /** - * Paths to the recipient originating from publicly reachable nodes. - * - * From [`Offer::paths`] or [`Refund::paths`]. - * - * [`Offer::paths`]: crate::offers::offer::Offer::paths + * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read */ -MUST_USE_RES struct LDKCVec_BlindedPathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); /** - * The quantity of items supported. - * - * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a - * [`Refund`]. - * - * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write */ -MUST_USE_RES struct LDKQuantity Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * An unpredictable series of bytes from the payer. - * - * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + * Frees any resources used by the SpendableOutputDescriptor */ -MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); /** - * Features pertaining to requesting an invoice. - * - * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + * Creates a copy of the SpendableOutputDescriptor */ -MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); /** - * The quantity of items requested or refunded for. - * - * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor */ -MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output, struct LDKThirtyTwoBytes channel_keys_id); /** - * A possibly transient pubkey used to sign the invoice request or to send an invoice for a - * refund in case there are no [`message_paths`]. - * - * [`message_paths`]: Self::message_paths + * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); /** - * A payer-provided note reflected back in the invoice. - * - * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); /** - * Duration since the Unix epoch when the invoice was created. + * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. */ -MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); /** - * Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore - * should no longer be paid. + * Checks if two SpendableOutputDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); /** - * Whether the invoice has expired. + * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read */ -MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); /** - * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); /** - * The minimum amount required for a successful payment of the invoice. + * Creates an unsigned [`Psbt`] which spends the given descriptors to + * the given outputs, plus an output to the given change destination (if sufficient + * change value remains). The PSBT will have a feerate, at least, of the given value. + * + * The `locktime` argument is used to set the transaction's locktime. If `None`, the + * transaction will have a locktime of 0. It it recommended to set this to the current block + * height to avoid fee sniping, unless you have some specific reason to use a different + * locktime. + * + * Returns the PSBT and expected max transaction weight. + * + * 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. */ -MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); /** - * Features pertaining to paying an invoice. + * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); /** - * The public key corresponding to the key used to sign the invoice. + * The value in satoshis of the channel we're attempting to spend the anchor output of. */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); /** - * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. + * The value in satoshis of the channel we're attempting to spend the anchor output of. */ -MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Hash that was used for signing the invoice. + * The unique identifier to re-derive the signer for the associated channel. */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; /** - * Verifies that the invoice was for a request or refund created using the given key. Returns - * the associated [`PaymentId`] to use when sending the payment. + * The unique identifier to re-derive the signer for the associated channel. */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. */ -struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); +struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); /** - * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read + * The necessary channel parameters that need to be provided to the re-derived signer through + * [`ChannelSigner::provide_channel_parameters`]. */ -struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj); +void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL. + * Constructs a new ChannelDerivationParameters given each field */ -void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj); +MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); /** - * Base fee charged (in millisatoshi) for the entire blinded path. + * Creates a copy of the ChannelDerivationParameters */ -uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); /** - * Base fee charged (in millisatoshi) for the entire blinded path. + * Checks if two ChannelDerivationParameterss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); +bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); /** - * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path - * (i.e., 10,000 is 1%). + * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read */ -uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); /** - * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path - * (i.e., 10,000 is 1%). + * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write */ -void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded - * path. + * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. */ -uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded - * path. + * The parameters required to derive the signer for the HTLC input. */ -void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * 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. + * The parameters required to derive the signer for the HTLC input. */ -uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); /** - * 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. + * The txid of the commitment transaction in which the HTLC output lives. */ -void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*HTLCDescriptor_get_commitment_txid(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The txid of the commitment transaction in which the HTLC output lives. */ -uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +void HTLCDescriptor_set_commitment_txid(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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. + * The number of the commitment transaction in which the HTLC output lives. */ -void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); +uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an - * onion payload. + * The number of the commitment transaction in which the HTLC output lives. */ -struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an - * onion payload. + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. */ -void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); +struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Constructs a new BlindedPayInfo given each field + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. */ -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); +void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the BlindedPayInfo + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. */ -struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig); +uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. */ -uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o); +void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); /** - * 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. + * The details of the HTLC as it appears in the commitment transaction. */ -bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b); +struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read + * The details of the HTLC as it appears in the commitment transaction. */ -struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj); +void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); /** - * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser); +struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL. + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. */ -void InvoiceError_free(struct LDKInvoiceError this_obj); +void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The counterparty's signature required to spend the HTLC output. */ -struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr); +struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The counterparty's signature required to spend the HTLC output. */ -void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val); +void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * An explanation of the error. + * Constructs a new HTLCDescriptor given each field */ -struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKHTLCDescriptor HTLCDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKThirtyTwoBytes commitment_txid_arg, uint64_t per_commitment_number_arg, struct LDKPublicKey per_commitment_point_arg, uint32_t feerate_per_kw_arg, struct LDKHTLCOutputInCommitment htlc_arg, struct LDKCOption_ThirtyTwoBytesZ preimage_arg, struct LDKECDSASignature counterparty_sig_arg); /** - * An explanation of the error. + * Creates a copy of the HTLCDescriptor */ -void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val); +struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); /** - * Constructs a new InvoiceError given each field - * - * Note that erroneous_field_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two HTLCDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); +bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); /** - * Creates a copy of the InvoiceError + * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read */ -struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig); +struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); /** - * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL. + * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write */ -void ErroneousField_free(struct LDKErroneousField this_obj); +struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); /** - * The type number of the TLV field containing the error. + * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint + * being spent by the HTLC input in the HTLC transaction. */ -uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * The type number of the TLV field containing the error. + * Returns the UTXO to be spent by the HTLC input, which can be obtained via + * [`Self::unsigned_tx_input`]. */ -void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * A value to use for the TLV field to avoid the error. - * - * Returns a copy of the field. + * Returns the unsigned transaction input spending the HTLC output in the commitment + * transaction. */ -struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * A value to use for the TLV field to avoid the error. + * Returns the delayed output created as a result of spending the HTLC output in the commitment + * transaction. */ -void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Constructs a new ErroneousField given each field + * Returns the witness script of the HTLC output in the commitment transaction. */ -MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg); +MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Creates a copy of the ErroneousField + * Returns the fully signed witness required to spend the HTLC output in the commitment + * transaction. */ -struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); +MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); /** - * Creates an [`InvoiceError`] with the given message. + * Derives the channel signer required to sign the HTLC input. */ -MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); +MUST_USE_RES struct LDKEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); /** - * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read + * Calls the free function if one is set */ -struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj); +void ChannelSigner_free(struct LDKChannelSigner this_ptr); /** - * Read a InvoiceError from a byte array, created by InvoiceError_write + * Creates a copy of the Recipient */ -struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); +enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); /** - * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Node-variant Recipient */ -void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); +enum LDKRecipient Recipient_node(void); /** - * Returns the [`TaggedHash`] of the invoice to sign. + * Utility method to constructs a new PhantomNode-variant Recipient */ -MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +enum LDKRecipient Recipient_phantom_node(void); /** - * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); +void EntropySource_free(struct LDKEntropySource this_ptr); /** - * Creates a copy of the InvoiceRequest + * Calls the free function if one is set */ -struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); +void NodeSigner_free(struct LDKNodeSigner this_ptr); /** - * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); +void OutputSpender_free(struct LDKOutputSpender this_ptr); /** - * Keys used for signing a [`Bolt12Invoice`] if they can be derived. - * - * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call - * [`respond_with`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`respond_using_derived_keys`]: Self::respond_using_derived_keys - * [`respond_with`]: Self::respond_with + * Calls the free function if one is set */ -struct LDKCOption_SecretKeyZ VerifiedInvoiceRequest_get_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); +void SignerProvider_free(struct LDKSignerProvider this_ptr); /** - * Keys used for signing a [`Bolt12Invoice`] if they can be derived. - * - * If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call - * [`respond_with`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`respond_using_derived_keys`]: Self::respond_using_derived_keys - * [`respond_with`]: Self::respond_with + * Calls the free function if one is set */ -void VerifiedInvoiceRequest_set_keys(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKCOption_SecretKeyZ val); +void ChangeDestinationSource_free(struct LDKChangeDestinationSource this_ptr); /** - * Creates a copy of the VerifiedInvoiceRequest + * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. */ -struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); +void InMemorySigner_free(struct LDKInMemorySigner this_obj); /** - * 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. + * 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. */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * 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`. + * 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. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * 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 + * Holder secret key for blinded revocation pubkey. */ -MUST_USE_RES struct LDKAmount UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * 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. + * Holder secret key for blinded revocation pubkey. */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Features pertaining to the offer. + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ -MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * 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 + * Holder secret key used in an HTLC transaction. */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * Holder secret key used in an HTLC transaction. */ -MUST_USE_RES struct LDKCVec_BlindedPathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * The quantity of items supported. + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * The public key used by the recipient to sign invoices. + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. - * - * [`payer_id`]: Self::payer_id + * Commitment seed. */ -MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * A chain from [`Offer::chains`] that the offer is valid for. + * Commitment seed. */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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 + * Creates a copy of the InMemorySigner */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Features pertaining to requesting an invoice. + * Creates a new [`InMemorySigner`]. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +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); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Returns the counterparty's pubkeys. + * + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * A possibly transient pubkey used to sign the invoice request. + * 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 return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * A payer-provided note which will be seen by the recipient and reflected back in the invoice - * response. + * 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. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). - * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) - * for the selected chain. + * Returns whether the holder is the initiator. + * + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Opaque bytes set by the originator. Useful for authentication and validating fields since it - * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + * Funding outpoint + * + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The minimum amount required for a successful payment of a single item. + * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or + * building transactions. + * + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKAmount InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * A complete description of the purpose of the payment. Intended to be displayed to the user - * but with the caveat that it has not been verified in any way. + * Returns the channel type features of the channel parameters. Should be helpful for + * determining a channel's category, i. e. legacy/anchors/taproot/etc. + * + * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. + * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Features pertaining to the offer. + * 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 */ -MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * Duration since the Unix epoch when an invoice should no longer be requested. + * 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. * - * If `None`, the offer does not expire. + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], does not have a + * sequence set to [`descriptor.to_self_delay`], or if an output descriptor + * `script_pubkey` does not match the one we can spend. + * + * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint + * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * 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 + * 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 struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * 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 */ -MUST_USE_RES struct LDKCVec_BlindedPathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The quantity of items supported. + * 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 */ -MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. - * - * [`payer_id`]: Self::payer_id + * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ -MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg); /** - * A chain from [`Offer::chains`] that the offer is valid for. + * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +void KeysManager_free(struct LDKKeysManager this_obj); /** - * 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. + * 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). * - * [`chain`]: Self::chain + * 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 */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * Features pertaining to requesting an invoice. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Derive an old [`EcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +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]); /** - * A possibly transient pubkey used to sign the invoice request. + * Signs the given [`Psbt`] which spends the given [`SpendableOutputDescriptor`]s. + * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there + * are no other inputs that need signing. + * + * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to sign. + * + * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used + * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_CVec_u8ZNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); /** - * 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 + * 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 struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Signature of the invoice request using [`payer_id`]. - * - * [`payer_id`]: Self::payer_id + * 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 */ -MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Verifies that the request was for an offer created using the given key. Returns the verified - * request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request - * if they could be extracted from the metadata. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Constructs a new OutputSpender which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +struct LDKOutputSpender KeysManager_as_OutputSpender(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). - * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) - * for the selected chain. + * 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 */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Opaque bytes set by the originator. Useful for authentication and validating fields since it - * is reflected in `invoice_request` messages along with all the other fields from the `offer`. + * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); /** - * 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 + * 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 struct LDKAmount VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * A complete description of the purpose of the payment. Intended to be displayed to the user - * but with the caveat that it has not been verified in any way. + * 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 */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Features pertaining to the offer. + * Constructs a new OutputSpender which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is */ -MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKOutputSpender PhantomKeysManager_as_OutputSpender(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * 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 */ -MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be - * displayed to the user but with the caveat that it has not been verified in any way. + * 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. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +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]); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * See [`KeysManager::derive_channel_keys`] for documentation on this method. */ -MUST_USE_RES struct LDKCVec_BlindedPathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +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]); /** - * The quantity of items supported. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. - * - * [`payer_id`]: Self::payer_id + * Frees any resources used by the RandomBytes, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void RandomBytes_free(struct LDKRandomBytes this_obj); /** - * A chain from [`Offer::chains`] that the offer is valid for. + * Creates a new instance using the given seed. */ -MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRandomBytes RandomBytes_new(struct LDKThirtyTwoBytes seed); /** - * 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 + * 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 struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEntropySource RandomBytes_as_EntropySource(const struct LDKRandomBytes *NONNULL_PTR this_arg); /** - * Features pertaining to requesting an invoice. + * Creates a copy of a EcdsaChannelSigner */ -MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKEcdsaChannelSigner EcdsaChannelSigner_clone(const struct LDKEcdsaChannelSigner *NONNULL_PTR orig); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); /** - * A possibly transient pubkey used to sign the invoice request. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void AsyncPaymentsMessageHandler_free(struct LDKAsyncPaymentsMessageHandler this_ptr); /** - * 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 + * Frees any resources used by the AsyncPaymentsMessage */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void AsyncPaymentsMessage_free(struct LDKAsyncPaymentsMessage this_ptr); /** - * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read + * Creates a copy of the AsyncPaymentsMessage */ -struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_clone(const struct LDKAsyncPaymentsMessage *NONNULL_PTR orig); + +/** + * Utility method to constructs a new HeldHtlcAvailable-variant AsyncPaymentsMessage + */ +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_held_htlc_available(struct LDKHeldHtlcAvailable a); /** - * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read + * Utility method to constructs a new ReleaseHeldHtlc-variant AsyncPaymentsMessage */ -struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_release_held_htlc(struct LDKReleaseHeldHtlc a); /** - * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. + * Frees any resources used by the HeldHtlcAvailable, if is_owned is set and inner is non-NULL. */ -void TaggedHash_free(struct LDKTaggedHash this_obj); +void HeldHtlcAvailable_free(struct LDKHeldHtlcAvailable this_obj); /** - * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. + * The secret that will be used by the recipient of this message to release the held HTLC. */ -void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj); +const uint8_t (*HeldHtlcAvailable_get_payment_release_secret(const struct LDKHeldHtlcAvailable *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the Bolt12ParseError + * The secret that will be used by the recipient of this message to release the held HTLC. */ -struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig); +void HeldHtlcAvailable_set_payment_release_secret(struct LDKHeldHtlcAvailable *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Creates a copy of the Bolt12SemanticError + * Constructs a new HeldHtlcAvailable given each field */ -enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig); +MUST_USE_RES struct LDKHeldHtlcAvailable HeldHtlcAvailable_new(struct LDKThirtyTwoBytes payment_release_secret_arg); /** - * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError + * Creates a copy of the HeldHtlcAvailable */ -enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void); +struct LDKHeldHtlcAvailable HeldHtlcAvailable_clone(const struct LDKHeldHtlcAvailable *NONNULL_PTR orig); /** - * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError + * Frees any resources used by the ReleaseHeldHtlc, if is_owned is set and inner is non-NULL. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void); +void ReleaseHeldHtlc_free(struct LDKReleaseHeldHtlc this_obj); /** - * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError + * Used to release the HTLC held upstream if it matches the corresponding + * [`HeldHtlcAvailable::payment_release_secret`]. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void); +const uint8_t (*ReleaseHeldHtlc_get_payment_release_secret(const struct LDKReleaseHeldHtlc *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError + * Used to release the HTLC held upstream if it matches the corresponding + * [`HeldHtlcAvailable::payment_release_secret`]. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void); +void ReleaseHeldHtlc_set_payment_release_secret(struct LDKReleaseHeldHtlc *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError + * Constructs a new ReleaseHeldHtlc given each field */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void); +MUST_USE_RES struct LDKReleaseHeldHtlc ReleaseHeldHtlc_new(struct LDKThirtyTwoBytes payment_release_secret_arg); /** - * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError + * Creates a copy of the ReleaseHeldHtlc */ -enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void); +struct LDKReleaseHeldHtlc ReleaseHeldHtlc_clone(const struct LDKReleaseHeldHtlc *NONNULL_PTR orig); /** - * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void); +struct LDKOnionMessageContents ReleaseHeldHtlc_as_OnionMessageContents(const struct LDKReleaseHeldHtlc *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError + * Serialize the HeldHtlcAvailable object into a byte array which can be read by HeldHtlcAvailable_read */ -enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void); +struct LDKCVec_u8Z HeldHtlcAvailable_write(const struct LDKHeldHtlcAvailable *NONNULL_PTR obj); /** - * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError + * Read a HeldHtlcAvailable from a byte array, created by HeldHtlcAvailable_write */ -enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void); +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ HeldHtlcAvailable_read(struct LDKu8slice ser); /** - * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError + * Serialize the ReleaseHeldHtlc object into a byte array which can be read by ReleaseHeldHtlc_read */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void); +struct LDKCVec_u8Z ReleaseHeldHtlc_write(const struct LDKReleaseHeldHtlc *NONNULL_PTR obj); /** - * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError + * Read a ReleaseHeldHtlc from a byte array, created by ReleaseHeldHtlc_write */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void); +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ ReleaseHeldHtlc_read(struct LDKu8slice ser); /** - * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError + * Returns whether `tlv_type` corresponds to a TLV record for async payment messages. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); +MUST_USE_RES bool AsyncPaymentsMessage_is_known_type(uint64_t tlv_type); /** - * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); +struct LDKOnionMessageContents AsyncPaymentsMessage_as_OnionMessageContents(const struct LDKAsyncPaymentsMessage *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError + * Serialize the AsyncPaymentsMessage object into a byte array which can be read by AsyncPaymentsMessage_read */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_signing_pubkey(void); +struct LDKCVec_u8Z AsyncPaymentsMessage_write(const struct LDKAsyncPaymentsMessage *NONNULL_PTR obj); /** - * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError + * Read a AsyncPaymentsMessage from a byte array, created by AsyncPaymentsMessage_write */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void); +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ AsyncPaymentsMessage_read(struct LDKu8slice ser, uint64_t arg); /** - * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError + * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void); +void OnionMessenger_free(struct LDKOnionMessenger this_obj); /** - * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError + * Frees any resources used by the Responder, if is_owned is set and inner is non-NULL. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void); +void Responder_free(struct LDKResponder this_obj); /** - * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError + * Creates a copy of the Responder */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void); +struct LDKResponder Responder_clone(const struct LDKResponder *NONNULL_PTR orig); /** - * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError + * Checks if two Responders 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. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void); +bool Responder_eq(const struct LDKResponder *NONNULL_PTR a, const struct LDKResponder *NONNULL_PTR b); /** - * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError + * Serialize the Responder object into a byte array which can be read by Responder_read */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); +struct LDKCVec_u8Z Responder_write(const struct LDKResponder *NONNULL_PTR obj); /** - * Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError + * Read a Responder from a byte array, created by Responder_write */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void); +struct LDKCResult_ResponderDecodeErrorZ Responder_read(struct LDKu8slice ser); /** - * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError + * Creates a [`ResponseInstruction`] for responding without including a reply path. + * + * Use when the recipient doesn't need to send back a reply to us. */ -enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); +MUST_USE_RES struct LDKResponseInstruction Responder_respond(struct LDKResponder this_arg); /** - * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError + * Creates a [`ResponseInstruction`] for responding including a reply path. + * + * Use when the recipient needs to send back a reply to us. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void); +MUST_USE_RES struct LDKResponseInstruction Responder_respond_with_reply_path(struct LDKResponder this_arg, struct LDKMessageContext context); /** - * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError + * Frees any resources used by the ResponseInstruction, if is_owned is set and inner is non-NULL. */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void); +void ResponseInstruction_free(struct LDKResponseInstruction this_obj); /** - * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError + * Creates a copy of the ResponseInstruction */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void); +struct LDKResponseInstruction ResponseInstruction_clone(const struct LDKResponseInstruction *NONNULL_PTR orig); /** - * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError + * Frees any resources used by the MessageSendInstructions */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void); +void MessageSendInstructions_free(struct LDKMessageSendInstructions this_ptr); /** - * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError + * Creates a copy of the MessageSendInstructions */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void); +struct LDKMessageSendInstructions MessageSendInstructions_clone(const struct LDKMessageSendInstructions *NONNULL_PTR orig); /** - * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new WithSpecifiedReplyPath-variant MessageSendInstructions */ -void Refund_free(struct LDKRefund this_obj); +struct LDKMessageSendInstructions MessageSendInstructions_with_specified_reply_path(struct LDKDestination destination, struct LDKBlindedMessagePath reply_path); /** - * Creates a copy of the Refund + * Utility method to constructs a new WithReplyPath-variant MessageSendInstructions */ -struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig); +struct LDKMessageSendInstructions MessageSendInstructions_with_reply_path(struct LDKDestination destination, struct LDKMessageContext context); /** - * 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. + * Utility method to constructs a new WithoutReplyPath-variant MessageSendInstructions */ -MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKMessageSendInstructions MessageSendInstructions_without_reply_path(struct LDKDestination destination); /** - * Duration since the Unix epoch when an invoice should no longer be sent. - * - * If `None`, the refund does not expire. + * Utility method to constructs a new ForReply-variant MessageSendInstructions */ -MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKMessageSendInstructions MessageSendInstructions_for_reply(struct LDKResponseInstruction instructions); /** - * Whether the refund has expired. + * Calls the free function if one is set */ -MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); +void MessageRouter_free(struct LDKMessageRouter this_ptr); /** - * 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 + * Frees any resources used by the DefaultMessageRouter, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg); +void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj); /** - * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender - * privacy by obfuscating its node id. + * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`]. */ -MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. - * - * [`payer_id`]: Self::payer_id + * Constructs a new MessageRouter which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is */ -MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg); /** - * A chain that the refund is valid for. + * Frees any resources used by the OnionMessagePath, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg); +void OnionMessagePath_free(struct LDKOnionMessagePath this_obj); /** - * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]). + * Nodes on the path between the sender and the destination. * - * [`chain`]: Self::chain + * Returns a copy of the field. */ -MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKCVec_PublicKeyZ OnionMessagePath_get_intermediate_nodes(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); /** - * Features pertaining to requesting an invoice. + * Nodes on the path between the sender and the destination. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg); +void OnionMessagePath_set_intermediate_nodes(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCVec_PublicKeyZ val); /** - * The quantity of an item that refund is for. + * The recipient of the message. */ -MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKDestination OnionMessagePath_get_destination(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); /** - * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly - * transient pubkey. - * - * [`paths`]: Self::paths + * The recipient of the message. */ -MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg); +void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKDestination val); /** - * Payer provided note to include in the invoice. + * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use + * this to initiate such a connection. + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKCOption_CVec_SocketAddressZZ OnionMessagePath_get_first_node_addresses(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); /** - * Serialize the Refund object into a byte array which can be read by Refund_read + * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. + * + * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use + * this to initiate such a connection. */ -struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); +void OnionMessagePath_set_first_node_addresses(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCOption_CVec_SocketAddressZZ val); /** - * Read a Refund object from a string + * Constructs a new OnionMessagePath given each field */ -struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s); +MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg, struct LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg); /** - * Creates a copy of the UtxoLookupError + * Creates a copy of the OnionMessagePath */ -enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); +struct LDKOnionMessagePath OnionMessagePath_clone(const struct LDKOnionMessagePath *NONNULL_PTR orig); /** - * Utility method to constructs a new UnknownChain-variant UtxoLookupError + * Returns the first node in the path. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); +MUST_USE_RES struct LDKPublicKey OnionMessagePath_first_node(const struct LDKOnionMessagePath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnknownTx-variant UtxoLookupError + * Frees any resources used by the Destination */ -enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); +void Destination_free(struct LDKDestination this_ptr); /** - * Frees any resources used by the UtxoResult + * Creates a copy of the Destination */ -void UtxoResult_free(struct LDKUtxoResult this_ptr); +struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); /** - * Creates a copy of the UtxoResult + * Utility method to constructs a new Node-variant Destination */ -struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); +struct LDKDestination Destination_node(struct LDKPublicKey a); /** - * Utility method to constructs a new Sync-variant UtxoResult + * Utility method to constructs a new BlindedPath-variant Destination */ -struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); +struct LDKDestination Destination_blinded_path(struct LDKBlindedMessagePath a); /** - * Utility method to constructs a new Async-variant UtxoResult + * Generates a non-cryptographic 64-bit hash of the Destination. */ -struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); +uint64_t Destination_hash(const struct LDKDestination *NONNULL_PTR o); /** - * Calls the free function if one is set + * Checks if two Destinations contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void UtxoLookup_free(struct LDKUtxoLookup this_ptr); +bool Destination_eq(const struct LDKDestination *NONNULL_PTR a, const struct LDKDestination *NONNULL_PTR b); /** - * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. + * Attempts to resolve the [`IntroductionNode::DirectedShortChannelId`] of a + * [`Destination::BlindedPath`] to a [`IntroductionNode::NodeId`], if applicable, using the + * provided [`ReadOnlyNetworkGraph`]. */ -void UtxoFuture_free(struct LDKUtxoFuture this_obj); +void Destination_resolve(struct LDKDestination *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * Creates a copy of the UtxoFuture + * Frees any resources used by the SendSuccess */ -struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); +void SendSuccess_free(struct LDKSendSuccess this_ptr); /** - * Builds a new future for later resolution. + * Creates a copy of the SendSuccess */ -MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); +struct LDKSendSuccess SendSuccess_clone(const struct LDKSendSuccess *NONNULL_PTR orig); /** - * 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 + * Utility method to constructs a new Buffered-variant SendSuccess */ -void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); +struct LDKSendSuccess SendSuccess_buffered(void); /** - * 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 + * Utility method to constructs a new BufferedAwaitingConnection-variant SendSuccess */ -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); +struct LDKSendSuccess SendSuccess_buffered_awaiting_connection(struct LDKPublicKey a); /** - * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the SendSuccess. */ -void NodeId_free(struct LDKNodeId this_obj); +uint64_t SendSuccess_hash(const struct LDKSendSuccess *NONNULL_PTR o); /** - * Creates a copy of the NodeId + * Checks if two SendSuccesss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); +bool SendSuccess_eq(const struct LDKSendSuccess *NONNULL_PTR a, const struct LDKSendSuccess *NONNULL_PTR b); /** - * Create a new NodeId from a public key + * Frees any resources used by the SendError */ -MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); +void SendError_free(struct LDKSendError this_ptr); /** - * Get the public key slice from this NodeId + * Creates a copy of the SendError */ -MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); +struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig); /** - * Get the public key from this NodeId + * Utility method to constructs a new Secp256k1-variant SendError */ -MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); +struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a); /** - * Generates a non-cryptographic 64-bit hash of the NodeId. + * Utility method to constructs a new TooBigPacket-variant SendError */ -uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); +struct LDKSendError SendError_too_big_packet(void); /** - * Serialize the NodeId object into a byte array which can be read by NodeId_read + * Utility method to constructs a new TooFewBlindedHops-variant SendError */ -struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); +struct LDKSendError SendError_too_few_blinded_hops(void); /** - * Read a NodeId from a byte array, created by NodeId_write + * Utility method to constructs a new InvalidFirstHop-variant SendError */ -struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); +struct LDKSendError SendError_invalid_first_hop(struct LDKPublicKey a); /** - * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new PathNotFound-variant SendError */ -void NetworkGraph_free(struct LDKNetworkGraph this_obj); +struct LDKSendError SendError_path_not_found(void); /** - * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvalidMessage-variant SendError */ -void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); +struct LDKSendError SendError_invalid_message(void); /** - * Frees any resources used by the NetworkUpdate + * Utility method to constructs a new BufferFull-variant SendError */ -void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); +struct LDKSendError SendError_buffer_full(void); /** - * Creates a copy of the NetworkUpdate + * Utility method to constructs a new GetNodeIdFailed-variant SendError */ -struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); +struct LDKSendError SendError_get_node_id_failed(void); /** - * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate + * Utility method to constructs a new UnresolvedIntroductionNode-variant SendError */ -struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); +struct LDKSendError SendError_unresolved_introduction_node(void); /** - * Utility method to constructs a new ChannelFailure-variant NetworkUpdate + * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError */ -struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); +struct LDKSendError SendError_blinded_path_advance_failed(void); /** - * Utility method to constructs a new NodeFailure-variant NetworkUpdate + * Generates a non-cryptographic 64-bit hash of the SendError. */ -struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); +uint64_t SendError_hash(const struct LDKSendError *NONNULL_PTR o); /** - * Checks if two NetworkUpdates contain equal inner contents. + * Checks if two SendErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); +bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b); /** - * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read + * Calls the free function if one is set */ -struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); +void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); /** - * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write + * Frees any resources used by the PeeledOnion */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); +void PeeledOnion_free(struct LDKPeeledOnion this_ptr); /** - * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. + * Creates a copy of the PeeledOnion */ -void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); +struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new Forward-variant PeeledOnion */ -MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); +struct LDKPeeledOnion PeeledOnion_forward(struct LDKNextMessageHop a, struct LDKOnionMessage b); /** - * 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. + * Utility method to constructs a new Receive-variant PeeledOnion */ -void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); +struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKCOption_MessageContextZ b, struct LDKBlindedMessagePath c); /** - * Handles any network updates originating from [`Event`]s. - * Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid - * leaking possibly identifying information of the sender to the public network. + * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of + * `path`, first calling [`Destination::resolve`] on `path.destination` with the given + * [`ReadOnlyNetworkGraph`]. * - * [`Event`]: crate::events::Event + * Returns the node id of the peer to send the message to, the message itself, and any addresses + * needed to connect to the first node. + * + * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message_resolving_destination(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); /** - * Gets the chain hash for this network graph. + * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of + * `path`. + * + * Returns the node id of the peer to send the message to, the message itself, and any addresses + * needed to connect to the first node. + * + * Returns [`SendError::UnresolvedIntroductionNode`] if: + * - `destination` contains a blinded path with an [`IntroductionNode::DirectedShortChannelId`], + * - unless it can be resolved by [`NodeIdLookUp::next_node_id`]. + * Use [`create_onion_message_resolving_destination`] instead to resolve the introduction node + * first with a [`ReadOnlyNetworkGraph`]. + * + * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); /** - * Verifies the signature of a [`NodeAnnouncement`]. + * Decode one layer of an incoming [`OnionMessage`]. * - * Returns an error if it is invalid. + * Returns either the next layer of the onion for forwarding or the decrypted content for the + * receiver. */ -struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); +struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); /** - * Verifies all signatures included in a [`ChannelAnnouncement`]. - * - * Returns an error if one of the signatures is invalid. + * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to + * their respective handlers. */ -struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKCustomOnionMessageHandler custom_handler); /** - * 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 + * Similar to [`Self::new`], but rather than dropping onion messages that are + * intended to be forwarded to offline peers, we will intercept them for + * later forwarding. + * + * Interception flow: + * 1. If an onion message for an offline peer is received, `OnionMessenger` will + * generate an [`Event::OnionMessageIntercepted`]. Event handlers can + * then choose to persist this onion message for later forwarding, or drop + * it. + * 2. When the offline peer later comes back online, `OnionMessenger` will + * generate an [`Event::OnionMessagePeerConnected`]. Event handlers will + * then fetch all previously intercepted onion messages for this peer. + * 3. Once the stored onion messages are fetched, they can finally be + * forwarded to the now-online peer via [`Self::forward_onion_message`]. + * + * # Note + * + * LDK will not rate limit how many [`Event::OnionMessageIntercepted`]s + * are generated, so it is the caller's responsibility to limit how many + * onion messages are persisted and only persist onion messages for relevant + * peers. */ -struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new_with_offline_peer_interception(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKCustomOnionMessageHandler custom_handler); /** - * 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 + * Sends an [`OnionMessage`] based on its [`MessageSendInstructions`]. */ -struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_SendSuccessSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessageContents contents, struct LDKMessageSendInstructions instructions); /** - * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. + * Forwards an [`OnionMessage`] to `peer_node_id`. Useful if we initialized + * the [`OnionMessenger`] with [`Self::new_with_offline_peer_interception`] + * and want to forward a previously intercepted onion message to a peer that + * has just come online. */ -void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); +MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_forward_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessage message, struct LDKPublicKey peer_node_id); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Handles the response to an [`OnionMessage`] based on its [`ResponseInstruction`], + * enqueueing any response for sending. + * + * This function is useful for asynchronous handling of [`OnionMessage`]s. + * Handlers have the option to return `None`, indicating that no immediate response should be + * sent. Then, they can transfer the associated [`Responder`] to another task responsible for + * generating the response asynchronously. Subsequently, when the response is prepared and + * ready for sending, that task can invoke this method to enqueue the response for delivery. */ -uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_SendSuccessSendErrorZ OnionMessenger_handle_onion_message_response(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessageContents response, struct LDKResponseInstruction instructions); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Gets a [`Future`] that completes when an event is available via + * [`EventsProvider::process_pending_events`] or [`Self::process_pending_events_async`]. + * + * Note that callbacks registered on the [`Future`] MUST NOT call back into this + * [`OnionMessenger`] and should instead register actions to be taken later. + * + * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events */ -void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKFuture OnionMessenger_get_update_future(const struct LDKOnionMessenger *NONNULL_PTR this_arg); /** - * Whether the channel can be currently used for payments (in this one direction). + * 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 */ -bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKEventsProvider OnionMessenger_as_EventsProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); /** - * Whether the channel can be currently used for payments (in this one direction). + * 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 ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); +struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); /** - * The difference in CLTV values that you must have when routing through this channel. + * Calls the free function if one is set */ -uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void OffersMessageHandler_free(struct LDKOffersMessageHandler this_ptr); /** - * The difference in CLTV values that you must have when routing through this channel. + * Frees any resources used by the OffersMessage */ -void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); +void OffersMessage_free(struct LDKOffersMessage this_ptr); /** - * The minimum value, which must be relayed to the next hop via the channel + * Creates a copy of the OffersMessage */ -uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKOffersMessage OffersMessage_clone(const struct LDKOffersMessage *NONNULL_PTR orig); /** - * The minimum value, which must be relayed to the next hop via the channel + * Utility method to constructs a new InvoiceRequest-variant OffersMessage */ -void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKOffersMessage OffersMessage_invoice_request(struct LDKInvoiceRequest a); /** - * The maximum value which may be relayed to the next hop via the channel. + * Utility method to constructs a new Invoice-variant OffersMessage */ -uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKOffersMessage OffersMessage_invoice(struct LDKBolt12Invoice a); /** - * The maximum value which may be relayed to the next hop via the channel. + * Utility method to constructs a new InvoiceError-variant OffersMessage */ -void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKOffersMessage OffersMessage_invoice_error(struct LDKInvoiceError a); /** - * Fees charged when the channel is used for routing + * Returns whether `tlv_type` corresponds to a TLV record for Offers. */ -struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type); /** - * Fees charged when the channel is used for routing + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ -void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +struct LDKOnionMessageContents OffersMessage_as_OnionMessageContents(const struct LDKOffersMessage *NONNULL_PTR this_arg); /** - * 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 + * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read */ -struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PTR obj); /** - * 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 + * Read a OffersMessage from a byte array, created by OffersMessage_write */ -void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); +struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b); /** - * Constructs a new ChannelUpdateInfo given each field - * - * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the Packet, if is_owned is set and inner is non-NULL. */ -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 Packet_free(struct LDKPacket this_obj); /** - * Creates a copy of the ChannelUpdateInfo + * Bolt 04 version number */ -struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); +uint8_t Packet_get_version(const struct LDKPacket *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. + * Bolt 04 version number */ -bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); +void Packet_set_version(struct LDKPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); +struct LDKPublicKey Packet_get_public_key(const struct LDKPacket *NONNULL_PTR this_ptr); /** - * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); +void Packet_set_public_key(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. + * Encrypted payload for the next hop + * + * Returns a copy of the field. */ -void ChannelInfo_free(struct LDKChannelInfo this_obj); +struct LDKCVec_u8Z Packet_get_hop_data(const struct LDKPacket *NONNULL_PTR this_ptr); /** - * Protocol features of a channel communicated during its announcement + * Encrypted payload for the next hop */ -struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +void Packet_set_hop_data(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Protocol features of a channel communicated during its announcement + * HMAC to verify the integrity of hop_data */ -void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +const uint8_t (*Packet_get_hmac(const struct LDKPacket *NONNULL_PTR this_ptr))[32]; /** - * Source node of the first direction of a channel + * HMAC to verify the integrity of hop_data */ -struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +void Packet_set_hmac(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Source node of the first direction of a channel + * Constructs a new Packet given each field */ -void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +MUST_USE_RES struct LDKPacket Packet_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); /** - * 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 + * Creates a copy of the Packet */ -struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKPacket Packet_clone(const struct LDKPacket *NONNULL_PTR orig); /** - * 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 + * Generates a non-cryptographic 64-bit hash of the Packet. */ -void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +uint64_t Packet_hash(const struct LDKPacket *NONNULL_PTR o); /** - * Source node of the second direction of a channel + * Checks if two Packets contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +bool Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NONNULL_PTR b); /** - * Source node of the second direction of a channel + * Serialize the Packet object into a byte array which can be read by Packet_read */ -void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); /** - * 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 + * Frees any resources used by the ParsedOnionMessageContents */ -struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents 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 + * Creates a copy of the ParsedOnionMessageContents */ -void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Utility method to constructs a new Offers-variant ParsedOnionMessageContents */ -struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Utility method to constructs a new Custom-variant ParsedOnionMessageContents */ -void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a); /** - * 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 OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ -struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_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 + * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read */ -void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj); /** - * Creates a copy of the ChannelInfo + * Creates a copy of a OnionMessageContents */ -struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); +struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig); /** - * 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. + * Calls the free function if one is set */ -bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); +void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); /** - * 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 + * Frees any resources used by the IntroductionNode */ -MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); +void IntroductionNode_free(struct LDKIntroductionNode this_ptr); /** - * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read + * Creates a copy of the IntroductionNode */ -struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); +struct LDKIntroductionNode IntroductionNode_clone(const struct LDKIntroductionNode *NONNULL_PTR orig); /** - * Read a ChannelInfo from a byte array, created by ChannelInfo_write + * Utility method to constructs a new NodeId-variant IntroductionNode */ -struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); +struct LDKIntroductionNode IntroductionNode_node_id(struct LDKPublicKey a); /** - * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode */ -void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); +struct LDKIntroductionNode IntroductionNode_directed_short_channel_id(enum LDKDirection a, uint64_t b); /** - * Creates a copy of the DirectedChannelInfo + * Generates a non-cryptographic 64-bit hash of the IntroductionNode. */ -struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); +uint64_t IntroductionNode_hash(const struct LDKIntroductionNode *NONNULL_PTR o); /** - * Returns information for the channel. + * Checks if two IntroductionNodes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +bool IntroductionNode_eq(const struct LDKIntroductionNode *NONNULL_PTR a, const struct LDKIntroductionNode *NONNULL_PTR b); /** - * Returns the maximum HTLC amount allowed over the channel in the direction. + * Creates a copy of the Direction */ -MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +enum LDKDirection Direction_clone(const enum LDKDirection *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new NodeOne-variant Direction */ -MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +enum LDKDirection Direction_node_one(void); /** - * Frees any resources used by the EffectiveCapacity + * Utility method to constructs a new NodeTwo-variant Direction */ -void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); +enum LDKDirection Direction_node_two(void); /** - * Creates a copy of the EffectiveCapacity + * Generates a non-cryptographic 64-bit hash of the Direction. */ -struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); +uint64_t Direction_hash(const enum LDKDirection *NONNULL_PTR o); /** - * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity + * Checks if two Directions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); +bool Direction_eq(const enum LDKDirection *NONNULL_PTR a, const enum LDKDirection *NONNULL_PTR b); /** - * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity + * Calls the free function if one is set */ -struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat); +void NodeIdLookUp_free(struct LDKNodeIdLookUp this_ptr); /** - * Utility method to constructs a new Total-variant EffectiveCapacity + * Frees any resources used by the EmptyNodeIdLookUp, if is_owned is set and inner is non-NULL. */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); +void EmptyNodeIdLookUp_free(struct LDKEmptyNodeIdLookUp this_obj); /** - * Utility method to constructs a new Infinite-variant EffectiveCapacity + * Constructs a new EmptyNodeIdLookUp given each field */ -struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); +MUST_USE_RES struct LDKEmptyNodeIdLookUp EmptyNodeIdLookUp_new(void); /** - * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity + * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is */ -struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat); +struct LDKNodeIdLookUp EmptyNodeIdLookUp_as_NodeIdLookUp(const struct LDKEmptyNodeIdLookUp *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Unknown-variant EffectiveCapacity + * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. */ -struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); +void BlindedHop_free(struct LDKBlindedHop this_obj); /** - * Returns the effective capacity denominated in millisatoshi. + * The blinded node id of this hop in a blinded path. */ -MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); +struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); /** - * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. + * The blinded node id of this hop in a blinded path. */ -void RoutingFees_free(struct LDKRoutingFees this_obj); +void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Flat routing fee in millisatoshis. + * The encrypted payload intended for this hop in a blinded path. + * + * Returns a copy of the field. */ -uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr); /** - * Flat routing fee in millisatoshis. + * The encrypted payload intended for this hop in a blinded path. */ -void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Constructs a new BlindedHop given each field */ -uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * Creates a copy of the BlindedHop */ -void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); /** - * Constructs a new RoutingFees given each field + * Generates a non-cryptographic 64-bit hash of the BlindedHop. */ -MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); +uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); /** - * Checks if two RoutingFeess 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 RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); +bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); /** - * Creates a copy of the RoutingFees + * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read */ -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); +struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the RoutingFees. + * Read a BlindedHop from a byte array, created by BlindedHop_write */ -uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); +struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); /** - * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read + * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); +void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj); /** - * Read a RoutingFees from a byte array, created by RoutingFees_write + * Base fee charged (in millisatoshi) for the entire blinded path. */ -struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); +uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL. + * Base fee charged (in millisatoshi) for the entire blinded path. */ -void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); +void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Protocol features the node announced support for + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Protocol features the node announced support for + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); +void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Color assigned to the node + * 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. */ -const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; +uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Color assigned to the node + * 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. */ -void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * 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. */ -struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * The 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. */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val); +void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * An initial announcement of the node - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); +struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *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 + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); +void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * Constructs a new NodeAnnouncementInfo given each field - * - * Note that announcement_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new BlindedPayInfo given each field */ -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); +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 NodeAnnouncementInfo + * Creates a copy of the BlindedPayInfo */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); +struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig); /** - * Checks if two NodeAnnouncementInfos contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. + */ +uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o); + +/** + * 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. */ -bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); +bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b); /** - * Internet-level addresses via which one can connect to the node + * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read */ -MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj); /** - * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read + * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write */ -struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); +struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser); /** - * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write + * Frees any resources used by the BlindedPaymentPath, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +void BlindedPaymentPath_free(struct LDKBlindedPaymentPath this_obj); /** - * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. + * The [`BlindedPayInfo`] used to pay this blinded path. */ -void NodeAlias_free(struct LDKNodeAlias this_obj); - -const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; +struct LDKBlindedPayInfo BlindedPaymentPath_get_payinfo(const struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr); -void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +/** + * The [`BlindedPayInfo`] used to pay this blinded path. + */ +void BlindedPaymentPath_set_payinfo(struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr, struct LDKBlindedPayInfo val); /** - * Constructs a new NodeAlias given each field + * Creates a copy of the BlindedPaymentPath */ -MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); +struct LDKBlindedPaymentPath BlindedPaymentPath_clone(const struct LDKBlindedPaymentPath *NONNULL_PTR orig); /** - * Creates a copy of the NodeAlias + * Generates a non-cryptographic 64-bit hash of the BlindedPaymentPath. */ -struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); +uint64_t BlindedPaymentPath_hash(const struct LDKBlindedPaymentPath *NONNULL_PTR o); /** - * Checks if two NodeAliass contain equal inner contents. + * Checks if two BlindedPaymentPaths 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 NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); +bool BlindedPaymentPath_eq(const struct LDKBlindedPaymentPath *NONNULL_PTR a, const struct LDKBlindedPaymentPath *NONNULL_PTR b); /** - * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read + * Create a one-hop blinded path for a payment. */ -struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_one_hop(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); /** - * Read a NodeAlias from a byte array, created by NodeAlias_write + * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. + * + * Errors if: + * * a provided node id is invalid + * * [`BlindedPayInfo`] calculation results in an integer overflow + * * any unknown features are required in the provided [`ForwardTlvs`] */ -struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_new(struct LDKCVec_PaymentForwardNodeZ intermediate_nodes, struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint64_t htlc_maximum_msat, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); /** - * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. + * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., + * it is found in the network graph). + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NodeInfo_free(struct LDKNodeInfo this_obj); +MUST_USE_RES struct LDKNodeId BlindedPaymentPath_public_introduction_node_id(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * All valid channels a node has announced + * The [`IntroductionNode`] of the blinded path. + */ +MUST_USE_RES struct LDKIntroductionNode BlindedPaymentPath_introduction_node(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); + +/** + * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the payment. * - * Returns a copy of the field. + * [`encrypted_payload`]: BlindedHop::encrypted_payload */ -struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey BlindedPaymentPath_blinding_point(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); /** - * All valid channels a node has announced + * The [`BlindedHop`]s within the blinded path. */ -void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedPaymentPath_blinded_hops(const struct LDKBlindedPaymentPath *NONNULL_PTR this_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. + * Advance the blinded onion payment path by one hop, making the second hop into the new + * introduction node. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Will only modify `self` when returning `Ok`. */ -struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedPaymentPath_advance_path_by_one(struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); /** - * 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 + * Frees any resources used by the PaymentForwardNode, if is_owned is set and inner is non-NULL. */ -void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); +void PaymentForwardNode_free(struct LDKPaymentForwardNode this_obj); /** - * Constructs a new NodeInfo given each field - * - * Note that announcement_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. */ -MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); +struct LDKForwardTlvs PaymentForwardNode_get_tlvs(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Creates a copy of the NodeInfo + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. */ -struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); +void PaymentForwardNode_set_tlvs(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); /** - * 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. + * This node's pubkey. */ -bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); +struct LDKPublicKey PaymentForwardNode_get_node_id(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read + * This node's pubkey. */ -struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); +void PaymentForwardNode_set_node_id(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a NodeInfo from a byte array, created by NodeInfo_write + * The maximum value, in msat, that may be accepted by this node. */ -struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); +uint64_t PaymentForwardNode_get_htlc_maximum_msat(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read + * The maximum value, in msat, that may be accepted by this node. */ -struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); +void PaymentForwardNode_set_htlc_maximum_msat(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a NetworkGraph from a byte array, created by NetworkGraph_write + * Constructs a new PaymentForwardNode given each field */ -struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); +MUST_USE_RES struct LDKPaymentForwardNode PaymentForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); /** - * Creates a new, empty, network graph. + * Creates a copy of the PaymentForwardNode */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); +struct LDKPaymentForwardNode PaymentForwardNode_clone(const struct LDKPaymentForwardNode *NONNULL_PTR orig); /** - * Returns a read-only view of the network graph. + * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +void ForwardTlvs_free(struct LDKForwardTlvs this_obj); /** - * The unix timestamp provided by the most recent rapid gossip sync. - * It will be set by the rapid sync process after every sync completion. + * The short channel id this payment should be forwarded out over. */ -MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * 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. + * The short channel id this payment should be forwarded out over. */ -void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); +void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * Payment parameters for relaying over [`Self::short_channel_id`]. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); +struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * 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. + * Payment parameters for relaying over [`Self::short_channel_id`]. */ -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 ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay 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 [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. + * Payment constraints for relaying over [`Self::short_channel_id`]. */ -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); +struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * 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. + * Payment constraints for relaying over [`Self::short_channel_id`]. + */ +void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. * - * This will skip verification of if the channel is actually on-chain. + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement_no_lookup(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); +struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * 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. + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. * - * 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. + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ -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); +void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * Update channel from partial announcement data received via rapid gossip sync + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * - * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the - * rapid gossip sync server) + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKPublicKey ForwardTlvs_get_next_blinding_override(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * - * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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); +void ForwardTlvs_set_next_blinding_override(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Marks a channel in the graph as failed permanently. + * Constructs a new ForwardTlvs given each field * - * The channel and any node for which this was their last channel are removed from the graph. + * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); +MUST_USE_RES struct LDKForwardTlvs ForwardTlvs_new(uint64_t short_channel_id_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg, struct LDKPublicKey next_blinding_override_arg); /** - * Marks a node in the graph as permanently failed, effectively removing it and its channels - * from local storage. + * Creates a copy of the ForwardTlvs */ -void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); +struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig); /** - * 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. + * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. */ -void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +void ReceiveTlvs_free(struct LDKReceiveTlvs this_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. - * - * 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. + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); +const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32]; /** - * 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. + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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. + * Constraints for the receiver of this payment. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); /** - * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. - * - * This checks whether the update currently is applicable by [`Self::update_channel`]. - * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * Constraints for the receiver of this payment. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints 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 + * Context for the receiver of this payment. */ -MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); +struct LDKPaymentContext ReceiveTlvs_get_payment_context(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); /** - * Returns the list of channels in the graph + * Context for the receiver of this payment. */ -MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +void ReceiveTlvs_set_payment_context(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext 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 + * Constructs a new ReceiveTlvs given each field */ -MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg); /** - * Returns the list of nodes in the graph + * Creates a copy of the ReceiveTlvs */ -MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); /** - * 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. + * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +void PaymentRelay_free(struct LDKPaymentRelay this_obj); /** - * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. */ -void DefaultRouter_free(struct LDKDefaultRouter this_obj); +uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); /** - * Creates a new router. + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. */ -MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); +void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val); /** - * 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 + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). */ -struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). */ -void Router_free(struct LDKRouter this_ptr); +void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. */ -void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); +uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); /** - * Initialize a new `ScorerAccountingForInFlightHtlcs`. + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. */ -MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); +void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); /** - * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + * Constructs a new PaymentRelay given each field */ -struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPaymentRelay PaymentRelay_new(uint16_t cltv_expiry_delta_arg, uint32_t fee_proportional_millionths_arg, uint32_t fee_base_msat_arg); /** - * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. + * Creates a copy of the PaymentRelay */ -void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); +struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); /** - * Creates a copy of the InFlightHtlcs + * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. */ -struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); +void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); /** - * Constructs an empty `InFlightHtlcs`. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ -MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); +uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); /** - * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ -void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id); +void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); /** - * Adds a known HTLC given the public key of the HTLC source, target, and short channel - * id. + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. */ -void InFlightHtlcs_add_inflight_htlc(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid, uint64_t used_msat); +uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); /** - * Returns liquidity in msat given the public key of the HTLC source, target, and short channel - * id. + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. */ -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); +void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read + * Constructs a new PaymentConstraints given each field */ -struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); +MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); /** - * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write + * Creates a copy of the PaymentConstraints */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); +struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); /** - * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PaymentContext */ -void RouteHop_free(struct LDKRouteHop this_obj); +void PaymentContext_free(struct LDKPaymentContext this_ptr); /** - * The node_id of the node at this hop. + * Creates a copy of the PaymentContext */ -struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKPaymentContext PaymentContext_clone(const struct LDKPaymentContext *NONNULL_PTR orig); /** - * The node_id of the node at this hop. + * Utility method to constructs a new Unknown-variant PaymentContext */ -void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKPaymentContext PaymentContext_unknown(struct LDKUnknownPaymentContext a); /** - * 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. + * Utility method to constructs a new Bolt12Offer-variant PaymentContext */ -struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKPaymentContext PaymentContext_bolt12_offer(struct LDKBolt12OfferContext a); /** - * 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. + * Utility method to constructs a new Bolt12Refund-variant PaymentContext */ -void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +struct LDKPaymentContext PaymentContext_bolt12_refund(struct LDKBolt12RefundContext a); /** - * The channel that should be used from the previous hop to reach this node. + * Checks if two PaymentContexts contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); +bool PaymentContext_eq(const struct LDKPaymentContext *NONNULL_PTR a, const struct LDKPaymentContext *NONNULL_PTR b); /** - * The channel that should be used from the previous hop to reach this node. + * Frees any resources used by the UnknownPaymentContext, if is_owned is set and inner is non-NULL. */ -void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +void UnknownPaymentContext_free(struct LDKUnknownPaymentContext this_obj); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Creates a copy of the UnknownPaymentContext */ -struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKUnknownPaymentContext UnknownPaymentContext_clone(const struct LDKUnknownPaymentContext *NONNULL_PTR orig); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Checks if two UnknownPaymentContexts 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 RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +bool UnknownPaymentContext_eq(const struct LDKUnknownPaymentContext *NONNULL_PTR a, const struct LDKUnknownPaymentContext *NONNULL_PTR b); /** - * 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 + * Frees any resources used by the Bolt12OfferContext, if is_owned is set and inner is non-NULL. + */ +void Bolt12OfferContext_free(struct LDKBolt12OfferContext this_obj); + +/** + * The identifier of the [`Offer`]. * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * [`Offer`]: crate::offers::offer::Offer */ -uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKOfferId Bolt12OfferContext_get_offer_id(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); /** - * 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 + * The identifier of the [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + */ +void Bolt12OfferContext_set_offer_id(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKOfferId val); + +/** + * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +struct LDKInvoiceRequestFields Bolt12OfferContext_get_invoice_request(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); /** - * 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 + * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); +void Bolt12OfferContext_set_invoice_request(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKInvoiceRequestFields val); /** - * 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 + * Constructs a new Bolt12OfferContext given each field */ -void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKBolt12OfferContext Bolt12OfferContext_new(struct LDKOfferId offer_id_arg, struct LDKInvoiceRequestFields invoice_request_arg); /** - * Indicates whether this hop is possibly announced in the public network graph. - * - * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we - * either know for sure it's announced in the public graph, or if any public channels exist - * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe - * the channel to be unannounced. - * - * Will be `true` for objects serialized with LDK version 0.0.116 and before. + * Creates a copy of the Bolt12OfferContext */ -bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKBolt12OfferContext Bolt12OfferContext_clone(const struct LDKBolt12OfferContext *NONNULL_PTR orig); /** - * Indicates whether this hop is possibly announced in the public network graph. - * - * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we - * either know for sure it's announced in the public graph, or if any public channels exist - * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe - * the channel to be unannounced. - * - * Will be `true` for objects serialized with LDK version 0.0.116 and before. + * Checks if two Bolt12OfferContexts 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 RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); +bool Bolt12OfferContext_eq(const struct LDKBolt12OfferContext *NONNULL_PTR a, const struct LDKBolt12OfferContext *NONNULL_PTR b); /** - * Constructs a new RouteHop given each field + * Frees any resources used by the Bolt12RefundContext, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg, bool maybe_announced_channel_arg); +void Bolt12RefundContext_free(struct LDKBolt12RefundContext this_obj); /** - * Creates a copy of the RouteHop + * Constructs a new Bolt12RefundContext given each field */ -struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); +MUST_USE_RES struct LDKBolt12RefundContext Bolt12RefundContext_new(void); /** - * Generates a non-cryptographic 64-bit hash of the RouteHop. + * Creates a copy of the Bolt12RefundContext */ -uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); +struct LDKBolt12RefundContext Bolt12RefundContext_clone(const struct LDKBolt12RefundContext *NONNULL_PTR orig); /** - * Checks if two RouteHops contain equal inner contents. + * Checks if two Bolt12RefundContexts contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); +bool Bolt12RefundContext_eq(const struct LDKBolt12RefundContext *NONNULL_PTR a, const struct LDKBolt12RefundContext *NONNULL_PTR b); /** - * Serialize the RouteHop object into a byte array which can be read by RouteHop_read + * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read */ -struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); +struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj); /** - * Read a RouteHop from a byte array, created by RouteHop_write + * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read */ -struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); /** - * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL. + * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read */ -void BlindedTail_free(struct LDKBlindedTail this_obj); +struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj); /** - * The hops of the [`BlindedPath`] provided by the recipient. - * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * Read a PaymentRelay from a byte array, created by PaymentRelay_write */ -struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser); /** - * The hops of the [`BlindedPath`] provided by the recipient. - * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read */ -void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); +struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj); /** - * The blinding point of the [`BlindedPath`] provided by the recipient. - * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write */ -struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser); /** - * The blinding point of the [`BlindedPath`] provided by the recipient. - * - * [`BlindedPath`]: crate::blinded_path::BlindedPath + * Serialize the PaymentContext object into a byte array which can be read by PaymentContext_read */ -void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCVec_u8Z PaymentContext_write(const struct LDKPaymentContext *NONNULL_PTR obj); /** - * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from - * inferring the destination. May be 0. + * Read a PaymentContext from a byte array, created by PaymentContext_write */ -uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +struct LDKCResult_PaymentContextDecodeErrorZ PaymentContext_read(struct LDKu8slice ser); /** - * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from - * inferring the destination. May be 0. + * Serialize the UnknownPaymentContext object into a byte array which can be read by UnknownPaymentContext_read */ -void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z UnknownPaymentContext_write(const struct LDKUnknownPaymentContext *NONNULL_PTR obj); /** - * The total amount paid on this [`Path`], excluding the fees. + * Read a UnknownPaymentContext from a byte array, created by UnknownPaymentContext_write */ -uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +struct LDKCResult_UnknownPaymentContextDecodeErrorZ UnknownPaymentContext_read(struct LDKu8slice ser); /** - * The total amount paid on this [`Path`], excluding the fees. + * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read */ -void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z Bolt12OfferContext_write(const struct LDKBolt12OfferContext *NONNULL_PTR obj); /** - * Constructs a new BlindedTail given each field + * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write */ -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); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ Bolt12OfferContext_read(struct LDKu8slice ser); /** - * Creates a copy of the BlindedTail + * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read */ -struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig); +struct LDKCVec_u8Z Bolt12RefundContext_write(const struct LDKBolt12RefundContext *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the BlindedTail. + * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write */ -uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ Bolt12RefundContext_read(struct LDKu8slice ser); /** - * 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. + * Frees any resources used by the BlindedMessagePath, if is_owned is set and inner is non-NULL. */ -bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b); +void BlindedMessagePath_free(struct LDKBlindedMessagePath this_obj); /** - * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read + * Creates a copy of the BlindedMessagePath */ -struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj); +struct LDKBlindedMessagePath BlindedMessagePath_clone(const struct LDKBlindedMessagePath *NONNULL_PTR orig); /** - * Read a BlindedTail from a byte array, created by BlindedTail_write + * Generates a non-cryptographic 64-bit hash of the BlindedMessagePath. */ -struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser); +uint64_t BlindedMessagePath_hash(const struct LDKBlindedMessagePath *NONNULL_PTR o); /** - * Frees any resources used by the Path, if is_owned is set and inner is non-NULL. + * Checks if two BlindedMessagePaths 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 Path_free(struct LDKPath this_obj); +bool BlindedMessagePath_eq(const struct LDKBlindedMessagePath *NONNULL_PTR a, const struct LDKBlindedMessagePath *NONNULL_PTR b); /** - * The list of unblinded hops in this [`Path`]. Must be at least length one. + * Serialize the BlindedMessagePath object into a byte array which can be read by BlindedMessagePath_read */ -struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z BlindedMessagePath_write(const struct LDKBlindedMessagePath *NONNULL_PTR obj); /** - * The list of unblinded hops in this [`Path`]. Must be at least length one. + * Read a BlindedMessagePath from a byte array, created by BlindedMessagePath_write */ -void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val); +struct LDKCResult_BlindedMessagePathDecodeErrorZ BlindedMessagePath_read(struct LDKu8slice ser); /** - * 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 + * Create a one-hop blinded path for a message. */ -struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_BlindedMessagePathNoneZ BlindedMessagePath_one_hop(struct LDKPublicKey recipient_node_id, struct LDKMessageContext context, struct LDKEntropySource entropy_source); /** - * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * Create a path for an onion message, to be forwarded along `node_pks`. The last node + * pubkey in `node_pks` will be the destination node. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Errors if no hops are provided or if `node_pk`(s) are invalid. */ -void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val); +MUST_USE_RES struct LDKCResult_BlindedMessagePathNoneZ BlindedMessagePath_new(struct LDKCVec_MessageForwardNodeZ intermediate_nodes, struct LDKPublicKey recipient_node_id, struct LDKMessageContext context, struct LDKEntropySource entropy_source); /** - * Constructs a new Path given each field + * Attempts to a use a compact representation for the [`IntroductionNode`] by using a directed + * short channel id from a channel in `network_graph` leading to the introduction node. * - * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * While this may result in a smaller encoding, there is a trade off in that the path may + * become invalid if the channel is closed or hasn't been propagated via gossip. Therefore, + * calling this may not be suitable for long-lived blinded paths. */ -MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); +void BlindedMessagePath_use_compact_introduction_node(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * Creates a copy of the Path + * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., + * it is found in the network graph). + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig); +MUST_USE_RES struct LDKNodeId BlindedMessagePath_public_introduction_node_id(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * Generates a non-cryptographic 64-bit hash of the Path. + * The [`IntroductionNode`] of the blinded path. */ -uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o); +MUST_USE_RES struct LDKIntroductionNode BlindedMessagePath_introduction_node(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * 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. + * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the message. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload */ -bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b); +MUST_USE_RES struct LDKPublicKey BlindedMessagePath_blinding_point(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * Gets the fees for a given path, excluding any excess paid to the recipient. + * The [`BlindedHop`]s within the blinded path. */ -MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedMessagePath_blinded_hops(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * Gets the total amount paid on this [`Path`], excluding the fees. + * Advance the blinded onion message path by one hop, making the second hop into the new + * introduction node. + * + * Will only modify `self` when returning `Ok`. */ -MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedMessagePath_advance_path_by_one(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); /** - * Gets the final hop's CLTV expiry delta. + * Frees any resources used by the NextMessageHop */ -MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg); +void NextMessageHop_free(struct LDKNextMessageHop this_ptr); /** - * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. + * Creates a copy of the NextMessageHop */ -void Route_free(struct LDKRoute this_obj); +struct LDKNextMessageHop NextMessageHop_clone(const struct LDKNextMessageHop *NONNULL_PTR orig); /** - * 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. + * Utility method to constructs a new NodeId-variant NextMessageHop */ -struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); +struct LDKNextMessageHop NextMessageHop_node_id(struct LDKPublicKey a); /** - * 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. + * Utility method to constructs a new ShortChannelId-variant NextMessageHop */ -void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); +struct LDKNextMessageHop NextMessageHop_short_channel_id(uint64_t a); /** - * The `route_params` parameter passed to [`find_route`]. - * - * This is used by `ChannelManager` to track information which may be required for retries. - * - * Will be `None` for objects serialized with LDK versions prior to 0.0.117. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the NextMessageHop. */ -struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); +uint64_t NextMessageHop_hash(const struct LDKNextMessageHop *NONNULL_PTR o); /** - * The `route_params` parameter passed to [`find_route`]. - * - * This is used by `ChannelManager` to track information which may be required for retries. - * - * Will be `None` for objects serialized with LDK versions prior to 0.0.117. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two NextMessageHops contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); +bool NextMessageHop_eq(const struct LDKNextMessageHop *NONNULL_PTR a, const struct LDKNextMessageHop *NONNULL_PTR b); /** - * Constructs a new Route given each field - * - * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the MessageForwardNode, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); +void MessageForwardNode_free(struct LDKMessageForwardNode this_obj); /** - * Creates a copy of the Route + * This node's pubkey. */ -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); +struct LDKPublicKey MessageForwardNode_get_node_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the Route. + * This node's pubkey. */ -uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); +void MessageForwardNode_set_node_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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. + * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s + * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a + * more compact representation. */ -bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); +struct LDKCOption_u64Z MessageForwardNode_get_short_channel_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); /** - * Returns the total amount of fees paid on this [`Route`]. - * - * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to - * the recipient, which can happen in excess of the amount passed to [`find_route`] via - * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits. - * - * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message + * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s + * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a + * more compact representation. */ -MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); +void MessageForwardNode_set_short_channel_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Returns the total amount paid on this [`Route`], excluding the fees. - * - * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if - * we had to reach the [`htlc_minimum_msat`] limits. - * - * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message + * Constructs a new MessageForwardNode given each field */ -MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKMessageForwardNode MessageForwardNode_new(struct LDKPublicKey node_id_arg, struct LDKCOption_u64Z short_channel_id_arg); /** - * Serialize the Route object into a byte array which can be read by Route_read + * Creates a copy of the MessageForwardNode */ -struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); +struct LDKMessageForwardNode MessageForwardNode_clone(const struct LDKMessageForwardNode *NONNULL_PTR orig); /** - * Read a Route from a byte array, created by Route_write + * Generates a non-cryptographic 64-bit hash of the MessageForwardNode. */ -struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); +uint64_t MessageForwardNode_hash(const struct LDKMessageForwardNode *NONNULL_PTR o); /** - * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. + * Checks if two MessageForwardNodes 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 RouteParameters_free(struct LDKRouteParameters this_obj); +bool MessageForwardNode_eq(const struct LDKMessageForwardNode *NONNULL_PTR a, const struct LDKMessageForwardNode *NONNULL_PTR b); /** - * The parameters of the failed payment path. + * Frees any resources used by the MessageContext */ -struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +void MessageContext_free(struct LDKMessageContext this_ptr); /** - * The parameters of the failed payment path. + * Creates a copy of the MessageContext */ -void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +struct LDKMessageContext MessageContext_clone(const struct LDKMessageContext *NONNULL_PTR orig); /** - * The amount in msats sent on the failed payment path. + * Utility method to constructs a new Offers-variant MessageContext */ -uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +struct LDKMessageContext MessageContext_offers(struct LDKOffersContext a); /** - * The amount in msats sent on the failed payment path. + * Utility method to constructs a new Custom-variant MessageContext */ -void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKMessageContext MessageContext_custom(struct LDKCVec_u8Z a); /** - * The maximum total fees, in millisatoshi, that may accrue during route finding. - * - * This limit also applies to the total fees that may arise while retrying failed payment - * paths. - * - * Note that values below a few sats may result in some paths being spuriously ignored. + * Frees any resources used by the OffersContext */ -struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +void OffersContext_free(struct LDKOffersContext this_ptr); /** - * The maximum total fees, in millisatoshi, that may accrue during route finding. - * - * This limit also applies to the total fees that may arise while retrying failed payment - * paths. - * - * Note that values below a few sats may result in some paths being spuriously ignored. + * Creates a copy of the OffersContext */ -void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKOffersContext OffersContext_clone(const struct LDKOffersContext *NONNULL_PTR orig); /** - * Constructs a new RouteParameters given each field + * Utility method to constructs a new InvoiceRequest-variant OffersContext */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg); +struct LDKOffersContext OffersContext_invoice_request(struct LDKNonce nonce); /** - * Creates a copy of the RouteParameters + * Utility method to constructs a new OutboundPayment-variant OffersContext */ -struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +struct LDKOffersContext OffersContext_outbound_payment(struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); /** - * Generates a non-cryptographic 64-bit hash of the RouteParameters. + * Utility method to constructs a new InboundPayment-variant OffersContext */ -uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); +struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes payment_hash); /** - * Checks if two RouteParameterss contain equal inner contents. + * Checks if two OffersContexts contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. */ -bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); +bool OffersContext_eq(const struct LDKOffersContext *NONNULL_PTR a, const struct LDKOffersContext *NONNULL_PTR b); /** - * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. - * - * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats + * Serialize the MessageContext object into a byte array which can be read by MessageContext_read */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); +struct LDKCVec_u8Z MessageContext_write(const struct LDKMessageContext *NONNULL_PTR obj); /** - * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read + * Read a MessageContext from a byte array, created by MessageContext_write */ -struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); +struct LDKCResult_MessageContextDecodeErrorZ MessageContext_read(struct LDKu8slice ser); /** - * Read a RouteParameters from a byte array, created by RouteParameters_write + * Serialize the OffersContext object into a byte array which can be read by OffersContext_read */ -struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); +struct LDKCVec_u8Z OffersContext_write(const struct LDKOffersContext *NONNULL_PTR obj); /** - * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. + * Read a OffersContext from a byte array, created by OffersContext_write */ -void PaymentParameters_free(struct LDKPaymentParameters this_obj); +struct LDKCResult_OffersContextDecodeErrorZ OffersContext_read(struct LDKu8slice ser); /** - * Information about the payee, such as their features and route hints for their channels. + * Frees any resources used by the FundingInfo */ -struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +void FundingInfo_free(struct LDKFundingInfo this_ptr); /** - * Information about the payee, such as their features and route hints for their channels. + * Creates a copy of the FundingInfo */ -void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val); +struct LDKFundingInfo FundingInfo_clone(const struct LDKFundingInfo *NONNULL_PTR orig); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * Utility method to constructs a new Tx-variant FundingInfo */ -struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKFundingInfo FundingInfo_tx(struct LDKTransaction transaction); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * Utility method to constructs a new OutPoint-variant FundingInfo */ -void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKFundingInfo FundingInfo_out_point(struct LDKOutPoint outpoint); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * Checks if two FundingInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +bool FundingInfo_eq(const struct LDKFundingInfo *NONNULL_PTR a, const struct LDKFundingInfo *NONNULL_PTR b); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * Serialize the FundingInfo object into a byte array which can be read by FundingInfo_read */ -void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z FundingInfo_write(const struct LDKFundingInfo *NONNULL_PTR obj); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Read a FundingInfo from a byte array, created by FundingInfo_write */ -uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKCResult_FundingInfoDecodeErrorZ FundingInfo_read(struct LDKu8slice ser); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Frees any resources used by the PaymentPurpose */ -void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); /** - * 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 copy of the PaymentPurpose */ -uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); /** - * 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 + * Utility method to constructs a new Bolt11InvoicePayment-variant PaymentPurpose */ -void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +struct LDKPaymentPurpose PaymentPurpose_bolt11_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** - * 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. + * Utility method to constructs a new Bolt12OfferPayment-variant PaymentPurpose */ -struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKPaymentPurpose PaymentPurpose_bolt12_offer_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12OfferContext payment_context); /** - * 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. + * Utility method to constructs a new Bolt12RefundPayment-variant PaymentPurpose */ -void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKPaymentPurpose PaymentPurpose_bolt12_refund_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12RefundContext payment_context); /** - * Constructs a new PaymentParameters given each field + * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg); +struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); /** - * Creates a copy of the PaymentParameters + * Checks if two PaymentPurposes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); +bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the PaymentParameters. + * Returns the preimage for this payment, if it is known. */ -uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ PaymentPurpose_preimage(const struct LDKPaymentPurpose *NONNULL_PTR this_arg); /** - * 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. + * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read */ -bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); +struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); /** - * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read + * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write */ -struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); +struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); /** - * Read a PaymentParameters from a byte array, created by PaymentParameters_write + * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); +void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj); /** - * 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. + * The `channel_id` of the channel over which the HTLC was received. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); +struct LDKChannelId ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + * The `channel_id` of the channel over which the HTLC was received. + */ +void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. * - * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has - * provided. + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) * - * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose - * whether your router will be allowed to find a multi-part route for this payment. If you - * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via - * [`RecipientOnionFields::secret_only`]. + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ +struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); + +/** + * The `user_channel_id` of the channel over which the HTLC was received. This is the value + * passed in to [`ChannelManager::create_channel`] for outbound channels, or to + * [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. * - * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only + * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This + * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but + * was not actually claimed until after upgrading.) + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp); +void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); /** - * Creates parameters for paying to a blinded payee from the provided invoice. Sets - * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and - * [`PaymentParameters::expiry_time`]. + * The block height at which this HTLC expires. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); +uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Creates parameters for paying to a blinded payee from the provided blinded route hints. + * The block height at which this HTLC expires. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints); +void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the Payee + * The amount (in msats) of this part of an MPP. */ -void Payee_free(struct LDKPayee this_ptr); +uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Creates a copy of the Payee + * The amount (in msats) of this part of an MPP. */ -struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); +void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new Blinded-variant Payee + * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. */ -struct LDKPayee Payee_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints, struct LDKBolt12InvoiceFeatures features); +uint64_t ClaimedHTLC_get_counterparty_skimmed_fee_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Clear-variant Payee + * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. */ -struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta); +void ClaimedHTLC_set_counterparty_skimmed_fee_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Generates a non-cryptographic 64-bit hash of the Payee. + * Constructs a new ClaimedHTLC given each field */ -uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); +MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKChannelId channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg, uint64_t counterparty_skimmed_fee_msat_arg); /** - * Checks if two Payees contain equal inner contents. + * Creates a copy of the ClaimedHTLC + */ +struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); + +/** + * Checks if two ClaimedHTLCs contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); +bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); /** - * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. + * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read */ -void RouteHint_free(struct LDKRouteHint this_obj); +struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); -struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); +/** + * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write + */ +struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser); -void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); +/** + * Frees any resources used by the PathFailure + */ +void PathFailure_free(struct LDKPathFailure this_ptr); /** - * Constructs a new RouteHint given each field + * Creates a copy of the PathFailure */ -MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); +struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); /** - * Creates a copy of the RouteHint + * Utility method to constructs a new InitialSend-variant PathFailure */ -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); +struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); /** - * Generates a non-cryptographic 64-bit hash of the RouteHint. + * Utility method to constructs a new OnPath-variant PathFailure */ -uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); +struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); /** - * Checks if two RouteHints contain equal inner contents. + * Checks if two PathFailures contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. */ -bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); +bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); /** - * Serialize the RouteHint object into a byte array which can be read by RouteHint_read + * Serialize the PathFailure object into a byte array which can be read by PathFailure_read */ -struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); +struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); /** - * Read a RouteHint from a byte array, created by RouteHint_write + * Read a PathFailure from a byte array, created by PathFailure_write */ -struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); +struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); /** - * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ClosureReason */ -void RouteHintHop_free(struct LDKRouteHintHop this_obj); +void ClosureReason_free(struct LDKClosureReason this_ptr); /** - * The node_id of the non-target end of the route + * Creates a copy of the ClosureReason */ -struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); /** - * The node_id of the non-target end of the route + * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason */ -void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg); /** - * The short_channel_id of this channel + * Utility method to constructs a new HolderForceClosed-variant ClosureReason */ -uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_holder_force_closed(struct LDKCOption_boolZ broadcasted_latest_txn); /** - * The short_channel_id of this channel + * Utility method to constructs a new LegacyCooperativeClosure-variant ClosureReason */ -void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); +struct LDKClosureReason ClosureReason_legacy_cooperative_closure(void); /** - * The fees which must be paid to use this channel + * Utility method to constructs a new CounterpartyInitiatedCooperativeClosure-variant ClosureReason */ -struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_counterparty_initiated_cooperative_closure(void); /** - * The fees which must be paid to use this channel + * Utility method to constructs a new LocallyInitiatedCooperativeClosure-variant ClosureReason */ -void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +struct LDKClosureReason ClosureReason_locally_initiated_cooperative_closure(void); /** - * The difference in CLTV values between this node and the next node. + * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason */ -uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); /** - * The difference in CLTV values between this node and the next node. + * Utility method to constructs a new FundingTimedOut-variant ClosureReason */ -void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); +struct LDKClosureReason ClosureReason_funding_timed_out(void); /** - * The minimum value, in msat, which must be relayed to the next hop. + * Utility method to constructs a new ProcessingError-variant ClosureReason */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); /** - * The minimum value, in msat, which must be relayed to the next hop. + * Utility method to constructs a new DisconnectedPeer-variant ClosureReason */ -void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKClosureReason ClosureReason_disconnected_peer(void); /** - * The maximum value in msat available for routing with a single HTLC. + * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_outdated_channel_manager(void); /** - * The maximum value in msat available for routing with a single HTLC. + * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason */ -void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); /** - * Constructs a new RouteHintHop given each field + * Utility method to constructs a new FundingBatchClosure-variant ClosureReason */ -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); +struct LDKClosureReason ClosureReason_funding_batch_closure(void); /** - * Creates a copy of the RouteHintHop + * Utility method to constructs a new HTLCsTimedOut-variant ClosureReason */ -struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); +struct LDKClosureReason ClosureReason_htlcs_timed_out(void); /** - * Generates a non-cryptographic 64-bit hash of the RouteHintHop. + * Utility method to constructs a new PeerFeerateTooLow-variant ClosureReason */ -uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); +struct LDKClosureReason ClosureReason_peer_feerate_too_low(uint32_t peer_feerate_sat_per_kw, uint32_t required_feerate_sat_per_kw); /** - * Checks if two RouteHintHops contain equal inner contents. + * Checks if two ClosureReasons 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 ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); + +/** + * Get the string representation of a ClosureReason object + */ +struct LDKStr ClosureReason_to_str(const struct LDKClosureReason *NONNULL_PTR o); + +/** + * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + */ +struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); + +/** + * Read a ClosureReason from a byte array, created by ClosureReason_write + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); /** - * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read + * Frees any resources used by the HTLCDestination */ -struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); +void HTLCDestination_free(struct LDKHTLCDestination this_ptr); /** - * Read a RouteHintHop from a byte array, created by RouteHintHop_write + * Creates a copy of the HTLCDestination */ -struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); +struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); /** - * 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 the `payee` field - * in the given [`RouteParameters::payment_params`]. - * 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 the `payee` field - * of [`RouteParameters::payment_params`]. - * - * 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. - * - * # Panics - * - * Panics if first_hops contains channels without `short_channel_id`s; - * [`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 + * Utility method to constructs a new NextHopChannel-variant HTLCDestination */ -struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScoreLookUp *NONNULL_PTR scorer, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params, const uint8_t (*random_seed_bytes)[32]); +struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKChannelId channel_id); /** - * 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. + * Utility method to constructs a new UnknownNextHop-variant HTLCDestination */ -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 LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); /** - * Calls the free function if one is set + * Utility method to constructs a new InvalidForward-variant HTLCDestination */ -void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); +struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); /** - * Calls the free function if one is set + * Utility method to constructs a new InvalidOnion-variant HTLCDestination */ -void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); +struct LDKHTLCDestination HTLCDestination_invalid_onion(void); /** - * Calls the free function if one is set + * Utility method to constructs a new FailedPayment-variant HTLCDestination */ -void Score_free(struct LDKScore this_ptr); +struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); /** - * Calls the free function if one is set + * Checks if two HTLCDestinations contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void LockableScore_free(struct LDKLockableScore this_ptr); +bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b); /** - * Calls the free function if one is set + * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read */ -void WriteableScore_free(struct LDKWriteableScore this_ptr); +struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); /** - * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. + * Read a HTLCDestination from a byte array, created by HTLCDestination_write */ -void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); /** - * 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 + * Creates a copy of the PaymentFailureReason */ -struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig); /** - * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read + * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason */ -struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); +enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void); /** - * 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 + * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason */ -struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void); /** - * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason */ -MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); +enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void); /** - * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason */ -void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); +enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void); /** - * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason */ -void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); +enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void); /** - * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason */ -struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); +enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void); /** - * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read + * Utility method to constructs a new UnknownRequiredFeatures-variant PaymentFailureReason */ -struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); +enum LDKPaymentFailureReason PaymentFailureReason_unknown_required_features(void); /** - * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + * Utility method to constructs a new InvoiceRequestExpired-variant PaymentFailureReason */ -struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); +enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_expired(void); /** - * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvoiceRequestRejected-variant PaymentFailureReason */ -void ChannelUsage_free(struct LDKChannelUsage this_obj); +enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_rejected(void); /** - * The amount to send through the channel, denominated in millisatoshis. + * Checks if two PaymentFailureReasons 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 PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b); /** - * The amount to send through the channel, denominated in millisatoshis. + * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read */ -void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj); /** - * Total amount, denominated in millisatoshis, already allocated to send through the channel - * as part of a multi-path payment. + * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write */ -uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ PaymentFailureReason_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 Event */ -void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +void Event_free(struct LDKEvent this_ptr); /** - * The effective capacity of the channel. + * Creates a copy of the Event */ -struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** - * The effective capacity of the channel. + * Utility method to constructs a new FundingGenerationReady-variant Event */ -void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); +struct LDKEvent Event_funding_generation_ready(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id); /** - * Constructs a new ChannelUsage given each field + * Utility method to constructs a new FundingTxBroadcastSafe-variant Event */ -MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); +struct LDKEvent Event_funding_tx_broadcast_safe(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKOutPoint funding_txo, struct LDKPublicKey counterparty_node_id, struct LDKChannelId former_temporary_channel_id); /** - * Creates a copy of the ChannelUsage + * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKChannelId via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); /** - * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new PaymentClaimed-variant Event */ -void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat, struct LDKRecipientOnionFields onion_fields); /** - * Creates a copy of the FixedPenaltyScorer + * Utility method to constructs a new ConnectionNeeded-variant Event */ -struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); +struct LDKEvent Event_connection_needed(struct LDKPublicKey node_id, struct LDKCVec_SocketAddressZ addresses); /** - * Creates a new scorer using `penalty_msat`. + * Utility method to constructs a new InvoiceReceived-variant Event */ -MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); +struct LDKEvent Event_invoice_received(struct LDKThirtyTwoBytes payment_id, struct LDKBolt12Invoice invoice, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); /** - * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + * Utility method to constructs a new PaymentSent-variant Event */ -struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); /** - * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + * Utility method to constructs a new PaymentFailed-variant Event */ -struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); /** - * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read + * Utility method to constructs a new PaymentPathSuccessful-variant Event */ -struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path); /** - * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write + * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); +struct LDKEvent Event_payment_path_failed(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** - * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new ProbeSuccessful-variant Event */ -void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); +struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); /** - * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new ProbeFailed-variant Event */ -void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj); +struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat + * Utility method to constructs a new PendingHTLCsForwardable-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); /** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat + * Utility method to constructs a new HTLCIntercepted-variant Event */ -void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +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); /** - * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty - * applied to each channel, in excess of the [`base_penalty_msat`]. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment - * amount plus the amount of any other HTLCs flowing we sent over the same channel). - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * Default value: 8,192 msat - * - * [`base_penalty_msat`]: Self::base_penalty_msat + * Utility method to constructs a new SpendableOutputs-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKChannelId channel_id); /** - * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty - * applied to each channel, in excess of the [`base_penalty_msat`]. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment - * amount plus the amount of any other HTLCs flowing we sent over the same channel). - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * Default value: 8,192 msat - * - * [`base_penalty_msat`]: Self::base_penalty_msat + * Utility method to constructs a new PaymentForwarded-variant Event */ -void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** - * 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`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * Utility method to constructs a new ChannelPending-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_channel_pending(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKChannelId former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo, struct LDKChannelTypeFeatures channel_type); /** - * 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`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * Utility method to constructs a new ChannelReady-variant Event */ -void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_channel_ready(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined by our - * latest estimates of the channel's liquidity, to determine the amount penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative - * `log10` of the success probability. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * 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 ChannelClosed-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined by our - * latest estimates of the channel's liquidity, to determine the amount penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., - * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative - * `log10` of the success probability. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * 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 DiscardFunding-variant Event */ -void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_discard_funding(struct LDKChannelId channel_id, struct LDKFundingInfo funding_info); /** - * 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 OpenChannelRequest-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type, bool is_announced, struct LDKChannelParameters params); /** - * 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 HTLCHandlingFailed-variant Event */ -void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_htlchandling_failed(struct LDKChannelId prev_channel_id, struct LDKHTLCDestination failed_next_destination); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined based - * on the history of our estimates of the channel's available liquidity, to determine a - * penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and `2^20`ths - * of the amount flowing over this channel, weighted by the negative `log10` of the success - * probability. - * - * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead - * of using only our latest estimate for the current liquidity available in the channel, it - * 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 BumpTransaction-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined based - * on the history of our estimates of the channel's available liquidity, to determine a - * penalty. - * - * The purpose of the amount penalty is to avoid having fees dominate the channel cost for - * large payments. The penalty is computed as the product of this multiplier and `2^20`ths - * of the amount flowing over this channel, weighted by the negative `log10` of the success - * probability. - * - * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead - * of using only our latest estimate for the current liquidity available in the channel, it - * 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 OnionMessageIntercepted-variant Event */ -void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_onion_message_intercepted(struct LDKPublicKey peer_node_id, struct LDKOnionMessage message); /** - * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us - * 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 + * Utility method to constructs a new OnionMessagePeerConnected-variant Event */ -uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKEvent Event_onion_message_peer_connected(struct LDKPublicKey peer_node_id); /** - * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the - * channel's capacity, (ie. htlc_maximum_msat >= 0.5 * channel_capacity) which makes us - * 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 + * Checks if two Events contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); /** - * This penalty is applied when the total amount flowing over a channel exceeds our current - * estimate of the channel's available liquidity. The total amount is the amount of the - * current HTLC plus any HTLCs which we've sent over the same channel. - * - * Note that in this case all other penalties, including the - * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based - * 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 + * Serialize the Event object into a byte array which can be read by Event_read */ -uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); /** - * This penalty is applied when the total amount flowing over a channel exceeds our current - * estimate of the channel's available liquidity. The total amount is the amount of the - * current HTLC plus any HTLCs which we've sent over the same channel. - * - * Note that in this case all other penalties, including the - * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based - * 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 + * Read a Event from a byte array, created by Event_write */ -void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); /** - * In order to calculate most of the scores above, we must first convert a lower and upper - * bound on the available liquidity in a channel into the probability that we think a payment - * will succeed. That probability is derived from a Probability Density Function for where we - * think the liquidity in a channel likely lies, given such bounds. - * - * If this flag is set, that PDF is simply a constant - we assume that the actual available - * liquidity in a channel is just as likely to be at any point between our lower and upper - * bounds. - * - * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an - * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This - * matches experimental results - most routing nodes do not aggressively rebalance their - * channels and flows in the network are often unbalanced, leaving liquidity usually - * unavailable. - * - * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number - * of floating-point multiplications in the hottest routing code, which may lead to routing - * performance degradation on some machines. - * - * Default value: false + * Frees any resources used by the MessageSendEvent */ -bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); /** - * In order to calculate most of the scores above, we must first convert a lower and upper - * bound on the available liquidity in a channel into the probability that we think a payment - * will succeed. That probability is derived from a Probability Density Function for where we - * think the liquidity in a channel likely lies, given such bounds. - * - * If this flag is set, that PDF is simply a constant - we assume that the actual available - * liquidity in a channel is just as likely to be at any point between our lower and upper - * bounds. - * - * If this flag is *not* set, that PDF is `(x - 0.5*capacity) ^ 2`. That is, we use an - * exponential curve which expects the liquidity of a channel to lie \"at the edges\". This - * matches experimental results - most routing nodes do not aggressively rebalance their - * channels and flows in the network are often unbalanced, leaving liquidity usually - * unavailable. - * - * Thus, for the \"best\" routes, leave this flag `false`. However, the flag does imply a number - * of floating-point multiplications in the hottest routing code, which may lead to routing - * performance degradation on some machines. - * - * Default value: false + * Creates a copy of the MessageSendEvent */ -void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); /** - * Creates a copy of the ProbabilisticScoringFeeParameters + * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent */ -struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); /** - * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used. + * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent */ -MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void); +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg); /** - * 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 SendOpenChannel-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); /** - * Marks all nodes in the given list as banned, i.e., - * they will be avoided during path finding. + * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); +struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg); /** - * Removes the node with the given `node_id` from the list of nodes to avoid. + * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); /** - * Sets a manual penalty for the given node. + * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); +struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); /** - * Removes the node with the given `node_id` from the list of manual penalties. + * Utility method to constructs a new SendStfu-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKMessageSendEvent MessageSendEvent_send_stfu(struct LDKPublicKey node_id, struct LDKStfu msg); /** - * Clears the list of manual penalties that are applied during path finding. + * Utility method to constructs a new SendSpliceInit-variant MessageSendEvent */ -void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_splice_init(struct LDKPublicKey node_id, struct LDKSpliceInit msg); /** - * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendSpliceAck-variant MessageSendEvent */ -void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj); +struct LDKMessageSendEvent MessageSendEvent_send_splice_ack(struct LDKPublicKey node_id, struct LDKSpliceAck msg); /** - * 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. - * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days - * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities + * Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent */ -uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_splice_locked(struct LDKPublicKey node_id, struct LDKSpliceLocked msg); /** - * 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. - * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days - * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorerUsingTime::historical_estimated_channel_liquidity_probabilities + * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent */ -void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg); /** - * 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. + * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent */ -uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg); /** - * 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. + * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent */ -void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg); /** - * Constructs a new ProbabilisticScoringDecayParameters given each field + * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent */ -MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg); +struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg); /** - * Creates a copy of the ProbabilisticScoringDecayParameters + * Utility method to constructs a new SendTxComplete-variant MessageSendEvent */ -struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg); /** - * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used. + * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent */ -MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void); +struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg); /** - * 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 SendTxInitRbf-variant MessageSendEvent */ -MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); +struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg); /** - * 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 SendTxAckRbf-variant MessageSendEvent */ -void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg); /** - * 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 SendTxAbort-variant MessageSendEvent */ -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 LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); /** - * 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 32 buckets. The first set describes the lower-bound liquidity history, - * the second set describes the upper-bound liquidity history. Each bucket describes the - * relative frequency at which we've seen a liquidity bound in the bucket's range relative to - * the channel's total capacity, on an arbitrary scale. Because the values are slowly decayed, - * more recent data points are weighted more heavily than older datapoints. - * - * Note that the range of each bucket varies by its location to provide more granular results - * at the edges of a channel's capacity, where it is more likely to sit. - * - * When scoring, the estimated probability that an upper-/lower-bound lies in a given bucket - * is calculated by dividing that bucket's value with the total value of all buckets. - * - * For example, using a lower bucket count for illustrative purposes, a value of - * `[0, 0, 0, ..., 0, 32]` indicates that we believe the probability of a bound being very - * close to the channel's capacity to be 100%, and have never (recently) seen it in any other - * bucket. A value of `[31, 0, 0, ..., 0, 0, 32]` indicates we've seen the bound being both - * in the top and bottom bucket, and roughly with similar (recent) frequency. - * - * Because the datapoints are decayed slowly over time, values will eventually return to - * `Some(([1; 32], [1; 32]))` and then to `None` once no datapoints remain. - * - * In order to fetch a single success probability from the buckets provided here, as used in - * the scoring model, see [`Self::historical_estimated_payment_success_probability`]. + * Utility method to constructs a new SendChannelReady-variant MessageSendEvent */ -MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); +struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); /** - * Query the probability of payment success sending the given `amount_msat` over the channel - * with `scid` towards the given `target` node, based on the historical estimated liquidity - * bounds. - * - * These are the same bounds as returned by - * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by - * [`Self::estimated_channel_liquidity_range`]). + * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent */ -MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); +struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); /** - * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is + * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent */ -struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); /** - * Constructs a new ScoreUpdate which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is + * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent */ -struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); /** - * 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 SendClosingSigned-variant MessageSendEvent */ -struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); /** - * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read + * Utility method to constructs a new SendShutdown-variant MessageSendEvent */ -struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); /** - * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write + * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); +struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); /** - * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent */ -void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); +struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * The outpoint which is spendable. + * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent */ -struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * The outpoint which is spendable. + * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent */ -void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); /** - * Per commitment point to derive the delayed payment key by key holder. + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); /** - * Per commitment point to derive the delayed payment key by key holder. + * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent */ -void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * Utility method to constructs a new HandleError-variant MessageSendEvent */ -uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent */ -void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); +struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); /** - * The output which is referenced by the given outpoint. + * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent */ -struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); /** - * The output which is referenced by the given outpoint. + * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent */ -void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Calls the free function if one is set */ -void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); /** - * 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. + * Calls the free function if one is set */ -const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +void EventsProvider_free(struct LDKEventsProvider this_ptr); /** - * 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. + * Frees any resources used by the ReplayEvent, if is_owned is set and inner is non-NULL. */ -void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ReplayEvent_free(struct LDKReplayEvent this_obj); /** - * The value of the channel which this output originated from, possibly indirectly. + * Constructs a new ReplayEvent given each field */ -uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKReplayEvent ReplayEvent_new(void); /** - * The value of the channel which this output originated from, possibly indirectly. + * Creates a copy of the ReplayEvent */ -void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +struct LDKReplayEvent ReplayEvent_clone(const struct LDKReplayEvent *NONNULL_PTR orig); /** - * Constructs a new DelayedPaymentOutputDescriptor given each field + * Calls the free function if one is set */ -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 EventHandler_free(struct LDKEventHandler this_ptr); /** - * Creates a copy of the DelayedPaymentOutputDescriptor + * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. */ -struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); +void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj); /** - * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. + * The parameters required to derive the signer for the anchor input. */ -uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); +struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); /** - * 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. + * The parameters required to derive the signer for the anchor input. */ -bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); +void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); /** - * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read + * The transaction input's outpoint corresponding to the commitment transaction's anchor + * output. */ -struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); +struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); /** - * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write + * The transaction input's outpoint corresponding to the commitment transaction's anchor + * output. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); +void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * Constructs a new AnchorDescriptor given each field */ -void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); +MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg); /** - * The outpoint which is spendable. + * Creates a copy of the AnchorDescriptor */ -struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig); /** - * The outpoint which is spendable. + * Checks if two AnchorDescriptors 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 StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +bool AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b); /** - * The output which is referenced by the given outpoint. + * Returns the UTXO to be spent by the anchor input, which can be obtained via + * [`Self::unsigned_tx_input`]. */ -struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); /** - * The output which is referenced by the given outpoint. + * Returns the unsigned transaction input spending the anchor output in the commitment + * transaction. */ -void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); /** - * 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. + * Returns the witness script of the anchor output in the commitment transaction. */ -const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); /** - * 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. + * Returns the fully signed witness required to spend the anchor output in the commitment + * transaction. */ -void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); /** - * The value of the channel which this transactions spends. + * Derives the channel signer required to sign the anchor input. */ -uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); /** - * The value of the channel which this transactions spends. + * Frees any resources used by the BumpTransactionEvent */ -void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. - * - * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the BumpTransactionEvent */ -struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. - * - * Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent */ -void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); +struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t package_target_feerate_sat_per_1000_weight, struct LDKTransaction commitment_tx, uint64_t commitment_tx_fee_satoshis, struct LDKAnchorDescriptor anchor_descriptor, struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs); /** - * Constructs a new StaticPaymentOutputDescriptor given each field - * - * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent */ -MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); +struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time); /** - * Creates a copy of the StaticPaymentOutputDescriptor + * Checks if two BumpTransactionEvents contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. + * Frees any resources used by the Input, if is_owned is set and inner is non-NULL. */ -uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); +void Input_free(struct LDKInput this_obj); /** - * 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. + * The unique identifier of the input. */ -bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); +struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr); /** - * Returns the `witness_script` of the spendable output. - * - * Note that this will only return `Some` for [`StaticPaymentOutputDescriptor`]s that - * originated from an anchor outputs channel, as they take the form of a P2WSH script. + * The unique identifier of the input. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); +void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The maximum length a well-formed witness spending one of these should have. - * Note: If you have the grind_signatures feature enabled, this will be at least 1 byte - * shorter. + * The UTXO being spent by the input. */ -MUST_USE_RES uintptr_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); +struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr); /** - * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read + * The UTXO being spent by the input. */ -struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); +void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and + * [`TxIn::witness`], each with their lengths included, required to satisfy the output's + * script. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); +uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the SpendableOutputDescriptor + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and + * [`TxIn::witness`], each with their lengths included, required to satisfy the output's + * script. */ -void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); +void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the SpendableOutputDescriptor + * Constructs a new Input given each field */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); +MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg); /** - * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor + * Creates a copy of the Input */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output); +struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig); /** - * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor + * Generates a non-cryptographic 64-bit hash of the Input. */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); +uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o); /** - * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor + * Checks if two Inputs 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 LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. + * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL. */ -uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); +void Utxo_free(struct LDKUtxo this_obj); /** - * Checks if two SpendableOutputDescriptors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The unique identifier of the output. */ -bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); +struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + * The unique identifier of the output. */ -struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); +void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write + * The output to spend. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); +struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * Creates an unsigned [`PartiallySignedTransaction`] which spends the given descriptors to - * the given outputs, plus an output to the given change destination (if sufficient - * change value remains). The PSBT will have a feerate, at least, of the given value. - * - * The `locktime` argument is used to set the transaction's locktime. If `None`, the - * transaction will have a locktime of 0. It it recommended to set this to the current block - * height to avoid fee sniping, unless you have some specific reason to use a different - * locktime. - * - * Returns the PSBT and expected max transaction weight. - * - * 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. + * The output to spend. */ -MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); +void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each + * with their lengths included, required to satisfy the output's script. The weight consumed by + * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. */ -void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); +uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * The value in satoshis of the channel we're attempting to spend the anchor output of. + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each + * with their lengths included, required to satisfy the output's script. The weight consumed by + * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. */ -uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); +void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val); /** - * The value in satoshis of the channel we're attempting to spend the anchor output of. + * Constructs a new Utxo given each field */ -void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg); /** - * The unique identifier to re-derive the signer for the associated channel. + * Creates a copy of the Utxo */ -const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; +struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig); /** - * The unique identifier to re-derive the signer for the associated channel. + * Generates a non-cryptographic 64-bit hash of the Utxo. */ -void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. + * Checks if two Utxos 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 LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); +bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. + * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output. */ -void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); +MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]); /** - * Constructs a new ChannelDerivationParameters given each field + * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); +void CoinSelection_free(struct LDKCoinSelection this_obj); /** - * Creates a copy of the ChannelDerivationParameters + * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction + * requiring additional fees. */ -struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); +struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr); /** - * Checks if two ChannelDerivationParameterss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction + * requiring additional fees. */ -bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); +void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val); /** - * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read + * An additional output tracking whether any change remained after coin selection. This output + * should always have a value above dust for its given `script_pubkey`. It should not be + * spent until the transaction it belongs to confirms to ensure mempool descendant limits are + * not met. This implies no other party should be able to spend it except us. */ -struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); +struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr); /** - * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write + * An additional output tracking whether any change remained after coin selection. This output + * should always have a value above dust for its given `script_pubkey`. It should not be + * spent until the transaction it belongs to confirms to ensure mempool descendant limits are + * not met. This implies no other party should be able to spend it except us. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); +void CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val); /** - * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. + * Constructs a new CoinSelection given each field */ -void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); +MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg); /** - * The parameters required to derive the signer for the HTLC input. + * Creates a copy of the CoinSelection */ -struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig); /** - * The parameters required to derive the signer for the HTLC input. + * Calls the free function if one is set */ -void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); +void CoinSelectionSource_free(struct LDKCoinSelectionSource this_ptr); /** - * The number of the commitment transaction in which the HTLC output lives. + * Calls the free function if one is set */ -uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +void WalletSource_free(struct LDKWalletSource this_ptr); /** - * The number of the commitment transaction in which the HTLC output lives. + * Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL. */ -void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); +void Wallet_free(struct LDKWallet this_obj); /** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. - * - * See for more info. + * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation + * of [`CoinSelectionSource`]. */ -struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKWallet Wallet_new(struct LDKWalletSource source, struct LDKLogger logger); /** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. - * - * See for more info. + * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is */ -void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCoinSelectionSource Wallet_as_CoinSelectionSource(const struct LDKWallet *NONNULL_PTR this_arg); /** - * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs - * originating from a channel supporting anchor outputs, otherwise it is the channel's - * negotiated feerate at the time the commitment transaction was built. + * Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL. */ -uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +void BumpTransactionEventHandler_free(struct LDKBumpTransactionEventHandler this_obj); /** - * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs - * originating from a channel supporting anchor outputs, otherwise it is the channel's - * negotiated feerate at the time the commitment transaction was built. + * Returns a new instance capable of handling [`Event::BumpTransaction`] events. + * + * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction */ -void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSource utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger); /** - * The details of the HTLC as it appears in the commitment transaction. + * Handles all variants of [`BumpTransactionEvent`]. */ -struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); /** - * The details of the HTLC as it appears in the commitment transaction. + * 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. */ -void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); +bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); /** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. + * 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 LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); /** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. + * Checks if two ChannelFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. */ -void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); /** - * The counterparty's signature required to spend the HTLC output. + * Checks if two Bolt11InvoiceFeaturess 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 LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +bool Bolt11InvoiceFeatures_eq(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR b); /** - * The counterparty's signature required to spend the HTLC output. + * 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. */ -void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); /** - * Creates a copy of the HTLCDescriptor + * 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 LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); +bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); /** - * Checks if two HTLCDescriptors contain equal inner contents. + * Checks if two Bolt12InvoiceFeaturess contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); +bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); /** - * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_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 HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); +bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); /** - * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_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_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); +bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); /** - * Returns the outpoint of the HTLC output in the commitment transaction. This is the outpoint - * being spent by the HTLC input in the HTLC transaction. + * Creates a copy of the InitFeatures */ -MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); /** - * Returns the UTXO to be spent by the HTLC input, which can be obtained via - * [`Self::unsigned_tx_input`]. + * Creates a copy of the NodeFeatures */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); /** - * Returns the unsigned transaction input spending the HTLC output in the commitment - * transaction. + * Creates a copy of the ChannelFeatures */ -MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); /** - * Returns the delayed output created as a result of spending the HTLC output in the commitment - * transaction. + * Creates a copy of the Bolt11InvoiceFeatures */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig); /** - * Returns the witness script of the HTLC output in the commitment transaction. + * Creates a copy of the OfferFeatures */ -MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); /** - * Returns the fully signed witness required to spend the HTLC output in the commitment - * transaction. + * Creates a copy of the InvoiceRequestFeatures */ -MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); +struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); /** - * Derives the channel signer required to sign the HTLC input. + * Creates a copy of the Bolt12InvoiceFeatures */ -MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Creates a copy of the BlindedHopFeatures */ -void ChannelSigner_free(struct LDKChannelSigner this_ptr); +struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Creates a copy of the ChannelTypeFeatures */ -void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); +struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); /** - * Creates a copy of a WriteableEcdsaChannelSigner + * Generates a non-cryptographic 64-bit hash of the InitFeatures. */ -struct LDKWriteableEcdsaChannelSigner WriteableEcdsaChannelSigner_clone(const struct LDKWriteableEcdsaChannelSigner *NONNULL_PTR orig); +uint64_t InitFeatures_hash(const struct LDKInitFeatures *NONNULL_PTR o); /** - * Calls the free function if one is set + * Generates a non-cryptographic 64-bit hash of the NodeFeatures. */ -void WriteableEcdsaChannelSigner_free(struct LDKWriteableEcdsaChannelSigner this_ptr); +uint64_t NodeFeatures_hash(const struct LDKNodeFeatures *NONNULL_PTR o); /** - * Creates a copy of the Recipient + * Generates a non-cryptographic 64-bit hash of the ChannelFeatures. */ -enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); +uint64_t ChannelFeatures_hash(const struct LDKChannelFeatures *NONNULL_PTR o); /** - * Utility method to constructs a new Node-variant Recipient + * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures. */ -enum LDKRecipient Recipient_node(void); +uint64_t Bolt11InvoiceFeatures_hash(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR o); /** - * Utility method to constructs a new PhantomNode-variant Recipient + * Generates a non-cryptographic 64-bit hash of the OfferFeatures. */ -enum LDKRecipient Recipient_phantom_node(void); +uint64_t OfferFeatures_hash(const struct LDKOfferFeatures *NONNULL_PTR o); /** - * Calls the free function if one is set + * Generates a non-cryptographic 64-bit hash of the InvoiceRequestFeatures. */ -void EntropySource_free(struct LDKEntropySource this_ptr); +uint64_t InvoiceRequestFeatures_hash(const struct LDKInvoiceRequestFeatures *NONNULL_PTR o); /** - * Calls the free function if one is set + * Generates a non-cryptographic 64-bit hash of the Bolt12InvoiceFeatures. */ -void NodeSigner_free(struct LDKNodeSigner this_ptr); +uint64_t Bolt12InvoiceFeatures_hash(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR o); /** - * Calls the free function if one is set + * Generates a non-cryptographic 64-bit hash of the BlindedHopFeatures. */ -void SignerProvider_free(struct LDKSignerProvider this_ptr); +uint64_t BlindedHopFeatures_hash(const struct LDKBlindedHopFeatures *NONNULL_PTR o); /** - * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures. */ -void InMemorySigner_free(struct LDKInMemorySigner this_obj); +uint64_t ChannelTypeFeatures_hash(const struct LDKChannelTypeFeatures *NONNULL_PTR o); /** - * 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. + * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void InitFeatures_free(struct LDKInitFeatures this_obj); /** - * 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. + * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. */ -void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void NodeFeatures_free(struct LDKNodeFeatures this_obj); /** - * Holder secret key for blinded revocation pubkey. + * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void ChannelFeatures_free(struct LDKChannelFeatures this_obj); /** - * Holder secret key for blinded revocation pubkey. + * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void OfferFeatures_free(struct LDKOfferFeatures this_obj); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. */ -void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); /** - * Holder secret key used in an HTLC transaction. + * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); /** - * Holder secret key used in an HTLC transaction. + * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. */ -void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ -const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * Getting a route for a keysend payment to a private node requires providing the payee's + * features (since they were not announced in a node announcement). However, keysend payments + * don't have an invoice to pull the payee's features from, so this method is provided for use + * when a [`Bolt11InvoiceFeatures`] is required in a route. + * + * MPP keysend is not widely supported yet, so we parameterize support to allow the user to + * choose whether their router should find multi-part routes. */ -void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_for_keysend(bool allow_mpp); /** - * Commitment seed. + * Constructs a ChannelTypeFeatures with only static_remotekey set */ -const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_only_static_remote_key(void); /** - * Commitment seed. + * Constructs a ChannelTypeFeatures with anchors support */ -void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_anchors_zero_htlc_fee_and_dependencies(void); /** - * Creates a copy of the InMemorySigner + * Create a blank Features with no features set */ -struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); +MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); /** - * Creates a new [`InMemorySigner`]. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -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); +MUST_USE_RES struct LDKu8slice InitFeatures_le_flags(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the counterparty's pubkeys. - * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns true if this `Features` has any optional flags set */ -MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_any_optional_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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 return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Returns true if this `Features` object contains required features unknown by `other`. */ -MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); /** - * 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 return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z InitFeatures_required_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); /** - * Returns whether the holder is the initiator. - * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Funding outpoint - * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns true if this `Features` supports any bits which we do not know of */ -MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or - * building transactions. + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Returns the channel type features of the channel parameters. Should be helpful for - * determining a channel's category, i. e. legacy/anchors/taproot/etc. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * 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. + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * 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. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * 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. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * 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. + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). * - * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint - * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * 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 + * Create a blank Features with no features set */ -struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); /** - * 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 + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice NodeFeatures_le_flags(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is + * Returns true if this `Features` has any optional flags set */ -struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_any_optional_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * 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 + * Returns true if this `Features` object contains required features unknown by `other`. */ -struct LDKWriteableEcdsaChannelSigner InMemorySigner_as_WriteableEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); /** - * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_u64Z NodeFeatures_required_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); /** - * Read a InMemorySigner from a byte array, created by InMemorySigner_write + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` supports any bits which we do not know of */ -void KeysManager_free(struct LDKKeysManager this_obj); +MUST_USE_RES bool NodeFeatures_supports_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * 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). + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Note that the seed is required to recover certain on-chain funds independent of - * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required - * for any channel, and some on-chain during-closing funds. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); - -/** - * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Signs the given [`PartiallySignedTransaction`] which spends the given [`SpendableOutputDescriptor`]s. - * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there - * are no other inputs that need signing. + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to sign. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used - * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKCResult_CVec_u8ZNoneZ KeysManager_sign_spendable_outputs_psbt(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_u8Z psbt); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * 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. - * - * The `locktime` argument is used to set the transaction's locktime. If `None`, the - * transaction will have a locktime of 0. It it recommended to set this to the current block - * height to avoid fee sniping, unless you have some specific reason to use a different - * locktime. - * - * 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. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * We do not enforce that outputs meet the dust limit or that any output scripts are standard. + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). * - * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used - * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * 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 + * Create a blank Features with no features set */ -struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); /** - * 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 + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice ChannelFeatures_le_flags(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Constructs a new SignerProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + * Returns true if this `Features` has any optional flags set */ -struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_supports_any_optional_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); /** - * 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 + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z ChannelFeatures_required_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); /** - * 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 + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Constructs a new SignerProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + * Returns true if this `Features` supports any bits which we do not know of */ -struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_supports_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` - * that is shared across all nodes that intend to participate in [phantom node payments] - * together. - * - * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and - * `starting_time_nanos`. + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * `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. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * [phantom node payments]: PhantomKeysManager + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -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]); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * See [`KeysManager::spend_spendable_outputs`] for documentation on this method. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKCResult_TransactionNoneZ PhantomKeysManager_spend_spendable_outputs(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * See [`KeysManager::derive_channel_keys`] for documentation on this method. + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -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]); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the - * last-hop onion data, etc. + * Create a blank Features with no features set */ -MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void); /** - * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void OnionMessenger_free(struct LDKOnionMessenger this_obj); +MUST_USE_RES struct LDKu8slice Bolt11InvoiceFeatures_le_flags(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Returns true if this `Features` has any optional flags set */ -void MessageRouter_free(struct LDKMessageRouter this_ptr); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the DefaultMessageRouter, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); /** - * Constructs a new DefaultMessageRouter given each field + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(void); +MUST_USE_RES struct LDKCVec_u64Z Bolt11InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); /** - * Constructs a new MessageRouter which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the OnionMessagePath, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` supports any bits which we do not know of */ -void OnionMessagePath_free(struct LDKOnionMessagePath this_obj); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Nodes on the path between the sender and the destination. + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Returns a copy of the field. - */ -struct LDKCVec_PublicKeyZ OnionMessagePath_get_intermediate_nodes(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); - -/** - * Nodes on the path between the sender and the destination. - */ -void OnionMessagePath_set_intermediate_nodes(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCVec_PublicKeyZ val); - -/** - * The recipient of the message. - */ -struct LDKDestination OnionMessagePath_get_destination(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); - -/** - * The recipient of the message. - */ -void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKDestination val); - -/** - * Constructs a new OnionMessagePath given each field + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Creates a copy of the OnionMessagePath + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKOnionMessagePath OnionMessagePath_clone(const struct LDKOnionMessagePath *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Frees any resources used by the Destination + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void Destination_free(struct LDKDestination this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Creates a copy of the Destination + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Utility method to constructs a new Node-variant Destination + * Create a blank Features with no features set */ -struct LDKDestination Destination_node(struct LDKPublicKey a); +MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); /** - * Utility method to constructs a new BlindedPath-variant Destination + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); +MUST_USE_RES struct LDKu8slice OfferFeatures_le_flags(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the SendError + * Returns true if this `Features` has any optional flags set */ -void SendError_free(struct LDKSendError this_ptr); +MUST_USE_RES bool OfferFeatures_supports_any_optional_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the SendError + * Returns true if this `Features` object contains required features unknown by `other`. */ -struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig); +MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); /** - * Utility method to constructs a new Secp256k1-variant SendError + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a); +MUST_USE_RES struct LDKCVec_u64Z OfferFeatures_required_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); /** - * Utility method to constructs a new TooBigPacket-variant SendError + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKSendError SendError_too_big_packet(void); +MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new TooFewBlindedHops-variant SendError + * Returns true if this `Features` supports any bits which we do not know of */ -struct LDKSendError SendError_too_few_blinded_hops(void); +MUST_USE_RES bool OfferFeatures_supports_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidFirstHop-variant SendError + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKSendError SendError_invalid_first_hop(void); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Utility method to constructs a new InvalidMessage-variant SendError + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKSendError SendError_invalid_message(void); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Utility method to constructs a new BufferFull-variant SendError + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKSendError SendError_buffer_full(void); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Utility method to constructs a new GetNodeIdFailed-variant SendError + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKSendError SendError_get_node_id_failed(void); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError + * Create a blank Features with no features set */ -struct LDKSendError SendError_blinded_path_advance_failed(void); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); /** - * Checks if two SendErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b); +MUST_USE_RES struct LDKu8slice InvoiceRequestFeatures_le_flags(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Returns true if this `Features` has any optional flags set */ -void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); +MUST_USE_RES bool InvoiceRequestFeatures_supports_any_optional_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PeeledOnion + * Returns true if this `Features` object contains required features unknown by `other`. */ -void PeeledOnion_free(struct LDKPeeledOnion this_ptr); +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); /** - * Creates a copy of the PeeledOnion + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_u64Z InvoiceRequestFeatures_required_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); /** - * Utility method to constructs a new Forward-variant PeeledOnion + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKPeeledOnion PeeledOnion_forward(struct LDKPublicKey a, struct LDKOnionMessage b); +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Receive-variant PeeledOnion + * Returns true if this `Features` supports any bits which we do not know of */ -struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKThirtyTwoBytes b, struct LDKBlindedPath c); +MUST_USE_RES bool InvoiceRequestFeatures_supports_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of - * `path`. + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Returns both the node id of the peer to send the message to and the message itself. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Decode one layer of an incoming [`OnionMessage`]. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * Returns either the next layer of the onion for forwarding or the decrypted content for the - * receiver. - */ -struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); - -/** - * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to - * their respective handlers. + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Sends an [`OnionMessage`] with the given `contents` for sending to the destination of - * `path`. + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * See [`OnionMessenger`] for example usage. + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). * - * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path); - -/** - * 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 + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Calls the free function if one is set + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void OffersMessageHandler_free(struct LDKOffersMessageHandler this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Frees any resources used by the OffersMessage + * Create a blank Features with no features set */ -void OffersMessage_free(struct LDKOffersMessage this_ptr); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); /** - * Creates a copy of the OffersMessage + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKOffersMessage OffersMessage_clone(const struct LDKOffersMessage *NONNULL_PTR orig); +MUST_USE_RES struct LDKu8slice Bolt12InvoiceFeatures_le_flags(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvoiceRequest-variant OffersMessage + * Returns true if this `Features` has any optional flags set */ -struct LDKOffersMessage OffersMessage_invoice_request(struct LDKInvoiceRequest a); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Invoice-variant OffersMessage + * Returns true if this `Features` object contains required features unknown by `other`. */ -struct LDKOffersMessage OffersMessage_invoice(struct LDKBolt12Invoice a); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); /** - * Utility method to constructs a new InvoiceError-variant OffersMessage + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKOffersMessage OffersMessage_invoice_error(struct LDKInvoiceError a); +MUST_USE_RES struct LDKCVec_u64Z Bolt12InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); /** - * Returns whether `tlv_type` corresponds to a TLV record for Offers. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read + * Returns true if this `Features` supports any bits which we do not know of */ -struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PTR obj); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Read a OffersMessage from a byte array, created by OffersMessage_write + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Frees any resources used by the Packet, if is_owned is set and inner is non-NULL. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -void Packet_free(struct LDKPacket this_obj); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Bolt 04 version number + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -uint8_t Packet_get_version(const struct LDKPacket *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Bolt 04 version number + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void Packet_set_version(struct LDKPacket *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + * Create a blank Features with no features set */ -struct LDKPublicKey Packet_get_public_key(const struct LDKPacket *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); /** - * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void Packet_set_public_key(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKu8slice BlindedHopFeatures_le_flags(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Encrypted payload for the next hop - * - * Returns a copy of the field. + * Returns true if this `Features` has any optional flags set */ -struct LDKCVec_u8Z Packet_get_hop_data(const struct LDKPacket *NONNULL_PTR this_ptr); +MUST_USE_RES bool BlindedHopFeatures_supports_any_optional_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Encrypted payload for the next hop + * Returns true if this `Features` object contains required features unknown by `other`. */ -void Packet_set_hop_data(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); /** - * HMAC to verify the integrity of hop_data + * Returns the set of required features unknown by `other`, as their bit position. */ -const uint8_t (*Packet_get_hmac(const struct LDKPacket *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCVec_u64Z BlindedHopFeatures_required_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); /** - * HMAC to verify the integrity of hop_data + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void Packet_set_hmac(struct LDKPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Constructs a new Packet given each field + * Returns true if this `Features` supports any bits which we do not know of */ -MUST_USE_RES struct LDKPacket Packet_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); +MUST_USE_RES bool BlindedHopFeatures_supports_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Packet + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKPacket Packet_clone(const struct LDKPacket *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if two Packets contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -bool Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Serialize the Packet object into a byte array which can be read by Packet_read + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Frees any resources used by the ParsedOnionMessageContents + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Creates a copy of the ParsedOnionMessageContents + * Create a blank Features with no features set */ -struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); /** - * Utility method to constructs a new Offers-variant ParsedOnionMessageContents + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); +MUST_USE_RES struct LDKu8slice ChannelTypeFeatures_le_flags(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Custom-variant ParsedOnionMessageContents + * Returns true if this `Features` has any optional flags set */ -struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a); +MUST_USE_RES bool ChannelTypeFeatures_supports_any_optional_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + * Returns true if this `Features` object contains required features unknown by `other`. */ -struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); /** - * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read + * Returns the set of required features unknown by `other`, as their bit position. */ -struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_u64Z ChannelTypeFeatures_required_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); /** - * Creates a copy of a OnionMessageContents + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Returns true if this `Features` supports any bits which we do not know of */ -void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); +MUST_USE_RES bool ChannelTypeFeatures_supports_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. + * Sets a required feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -void BlindedPath_free(struct LDKBlindedPath this_obj); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * To send to a blinded path, the sender first finds a route to the unblinded - * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion - * message or payment's next hop and forward it along. + * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined + * by [BOLT 9]. * - * [`encrypted_payload`]: BlindedHop::encrypted_payload + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md */ -struct LDKPublicKey BlindedPath_get_introduction_node_id(const struct LDKBlindedPath *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * To send to a blinded path, the sender first finds a route to the unblinded - * `introduction_node_id`, which can unblind its [`encrypted_payload`] to find out the onion - * message or payment's next hop and forward it along. + * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * [`encrypted_payload`]: BlindedHop::encrypted_payload + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void BlindedPath_set_introduction_node_id(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion - * message or payment. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. * - * [`encrypted_payload`]: BlindedHop::encrypted_payload + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKPublicKey BlindedPath_get_blinding_point(const struct LDKBlindedPath *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Used by the introduction node to decrypt its [`encrypted_payload`] to forward the onion - * message or payment. - * - * [`encrypted_payload`]: BlindedHop::encrypted_payload + * Unsets the `upfront_shutdown_script` feature */ -void BlindedPath_set_blinding_point(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKInitFeatures InitFeatures_clear_upfront_shutdown_script(struct LDKInitFeatures this_arg); /** - * The hops composing the blinded path. + * Unsets the `upfront_shutdown_script` feature */ -struct LDKCVec_BlindedHopZ BlindedPath_get_blinded_hops(const struct LDKBlindedPath *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_upfront_shutdown_script(struct LDKNodeFeatures this_arg); /** - * The hops composing the blinded path. + * Unsets the `shutdown_anysegwit` feature */ -void BlindedPath_set_blinded_hops(struct LDKBlindedPath *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); +MUST_USE_RES struct LDKInitFeatures InitFeatures_clear_shutdown_anysegwit(struct LDKInitFeatures this_arg); /** - * Constructs a new BlindedPath given each field + * Unsets the `shutdown_anysegwit` feature */ -MUST_USE_RES struct LDKBlindedPath BlindedPath_new(struct LDKPublicKey introduction_node_id_arg, struct LDKPublicKey blinding_point_arg, struct LDKCVec_BlindedHopZ blinded_hops_arg); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_shutdown_anysegwit(struct LDKNodeFeatures this_arg); /** - * Creates a copy of the BlindedPath + * Unsets the `wumbo` feature */ -struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig); +MUST_USE_RES struct LDKInitFeatures InitFeatures_clear_wumbo(struct LDKInitFeatures this_arg); /** - * Generates a non-cryptographic 64-bit hash of the BlindedPath. + * Unsets the `wumbo` feature */ -uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_wumbo(struct LDKNodeFeatures this_arg); /** - * 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. + * Unsets the `scid_privacy` feature */ -bool BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b); +void InitFeatures_clear_scid_privacy(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. + * Unsets the `scid_privacy` feature */ -void BlindedHop_free(struct LDKBlindedHop this_obj); +void NodeFeatures_clear_scid_privacy(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The blinded node id of this hop in a [`BlindedPath`]. + * Unsets the `scid_privacy` feature */ -struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); +void ChannelTypeFeatures_clear_scid_privacy(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The blinded node id of this hop in a [`BlindedPath`]. + * Unsets the `anchors_zero_fee_htlc_tx` feature */ -void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InitFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The encrypted payload intended for this hop in a [`BlindedPath`]. - * - * Returns a copy of the field. + * Unsets the `anchors_zero_fee_htlc_tx` feature */ -struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr); +void NodeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The encrypted payload intended for this hop in a [`BlindedPath`]. + * Unsets the `anchors_zero_fee_htlc_tx` feature */ -void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void ChannelTypeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new BlindedHop given each field + * Unsets the `route_blinding` feature */ -MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg); +void InitFeatures_clear_route_blinding(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the BlindedHop + * Unsets the `route_blinding` feature */ -struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); +void NodeFeatures_clear_route_blinding(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the BlindedHop. + * Set this feature as optional. */ -uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); +void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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. + * Set this feature as required. */ -bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); +void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Create a one-hop blinded path for a message. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_one_hop_for_message(struct LDKPublicKey recipient_node_id, const struct LDKEntropySource *NONNULL_PTR entropy_source); +MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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 no hops are provided or if `node_pk`(s) are invalid. + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); +void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Create a one-hop blinded path for a payment. + * Set this feature as required. */ -MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, const struct LDKEntropySource *NONNULL_PTR entropy_source); +void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read + * Checks if this feature is supported. */ -struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); +MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a BlindedPath from a byte array, created by BlindedPath_write + * Checks if this feature is required. */ -struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); +MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); +MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a BlindedHop from a byte array, created by BlindedHop_write + * Set this feature as optional. */ -struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); +void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ForwardNode, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void ForwardNode_free(struct LDKForwardNode this_obj); +void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also - * used for [`BlindedPayInfo`] construction. + * Checks if this feature is supported. */ -struct LDKForwardTlvs ForwardNode_get_tlvs(const struct LDKForwardNode *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also - * used for [`BlindedPayInfo`] construction. + * Set this feature as optional. */ -void ForwardNode_set_tlvs(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); +void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * This node's pubkey. + * Set this feature as required. */ -struct LDKPublicKey ForwardNode_get_node_id(const struct LDKForwardNode *NONNULL_PTR this_ptr); +void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * This node's pubkey. + * Checks if this feature is supported. */ -void ForwardNode_set_node_id(struct LDKForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The maximum value, in msat, that may be accepted by this node. + * Set this feature as optional. */ -uint64_t ForwardNode_get_htlc_maximum_msat(const struct LDKForwardNode *NONNULL_PTR this_ptr); +void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum value, in msat, that may be accepted by this node. + * Set this feature as required. */ -void ForwardNode_set_htlc_maximum_msat(struct LDKForwardNode *NONNULL_PTR this_ptr, uint64_t val); +void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ForwardNode given each field + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKForwardNode ForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); +MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ForwardNode + * Checks if this feature is required. */ -struct LDKForwardNode ForwardNode_clone(const struct LDKForwardNode *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void ForwardTlvs_free(struct LDKForwardTlvs this_obj); +MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The short channel id this payment should be forwarded out over. + * Set this feature as optional. */ -uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The short channel id this payment should be forwarded out over. + * Set this feature as required. */ -void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val); +void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Payment parameters for relaying over [`Self::short_channel_id`]. + * Checks if this feature is supported. */ -struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Payment parameters for relaying over [`Self::short_channel_id`]. + * Set this feature as optional. */ -void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); +void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Payment constraints for relaying over [`Self::short_channel_id`]. + * Set this feature as required. */ -struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Payment constraints for relaying over [`Self::short_channel_id`]. + * Checks if this feature is supported. */ -void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); +MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Supported and required features when relaying a payment onion containing this object's - * corresponding [`BlindedHop::encrypted_payload`]. - * - * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + * Checks if this feature is required. */ -struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Supported and required features when relaying a payment onion containing this object's - * corresponding [`BlindedHop::encrypted_payload`]. - * - * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload + * Checks if this feature is required. */ -void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); +MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ForwardTlvs given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKForwardTlvs ForwardTlvs_new(uint64_t short_channel_id_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg); +void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ForwardTlvs + * Set this feature as required. */ -struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig); +void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj); +MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + * Set this feature as optional. */ -const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32]; +void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. + * Set this feature as required. */ -void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constraints for the receiver of this payment. + * Checks if this feature is supported. */ -struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constraints for the receiver of this payment. + * Set this feature as optional. */ -void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); +void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ReceiveTlvs given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg); +void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ReceiveTlvs + * Checks if this feature is supported. */ -struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void PaymentRelay_free(struct LDKPaymentRelay this_obj); +MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + * Checks if this feature is required. */ -uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + * Checks if this feature is required. */ -void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over - * this [`BlindedHop`], (i.e., 10,000 is 1%). + * Set this feature as optional. */ -uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over - * this [`BlindedHop`], (i.e., 10,000 is 1%). + * Set this feature as required. */ -void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); +void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + * Checks if this feature is supported. */ -uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + * Set this feature as optional. */ -void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); +void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new PaymentRelay given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKPaymentRelay PaymentRelay_new(uint16_t cltv_expiry_delta_arg, uint32_t fee_proportional_millionths_arg, uint32_t fee_base_msat_arg); +void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PaymentRelay + * Checks if this feature is supported. */ -struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); +void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + * Set this feature as required. */ -uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); +void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + * Checks if this feature is supported. */ -void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The minimum value, in msat, that may be accepted by the node corresponding to this - * [`BlindedHop`]. + * Checks if this feature is required. */ -uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The minimum value, in msat, that may be accepted by the node corresponding to this - * [`BlindedHop`]. + * Checks if this feature is required. */ -void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new PaymentConstraints given each field + * Checks if this feature is required. */ -MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); +MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PaymentConstraints + * Set this feature as optional. */ -struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); +void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read + * Set this feature as required. */ -struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj); +void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read + * Checks if this feature is supported. */ -struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); +MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a ReceiveTlvs from a byte array, created by ReceiveTlvs_write + * Set this feature as optional. */ -struct LDKCResult_ReceiveTlvsDecodeErrorZ ReceiveTlvs_read(struct LDKu8slice ser); +void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read + * Set this feature as required. */ -struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj); +void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a PaymentRelay from a byte array, created by PaymentRelay_write + * Checks if this feature is supported. */ -struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read + * Set this feature as optional. */ -struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj); +void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write + * Set this feature as required. */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser); +void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PaymentPurpose + * Checks if this feature is supported. */ -void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PaymentPurpose + * Checks if this feature is required. */ -struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvoicePayment-variant PaymentPurpose + * Checks if this feature is required. */ -struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + * Checks if this feature is required. */ -struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two PaymentPurposes contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); +void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read + * Set this feature as required. */ -struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); +void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write + * Checks if this feature is supported. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj); +void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The `channel_id` of the channel over which the HTLC was received. + * Set this feature as required. */ -const uint8_t (*ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr))[32]; +void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The `channel_id` of the channel over which the HTLC was received. + * Checks if this feature is supported. */ -void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The `user_channel_id` of the channel over which the HTLC was received. This is the value - * passed in to [`ChannelManager::create_channel`] for outbound channels, or to - * [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. - * - * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This - * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but - * was not actually claimed until after upgrading.) - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Set this feature as optional. */ -struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * The `user_channel_id` of the channel over which the HTLC was received. This is the value - * passed in to [`ChannelManager::create_channel`] for outbound channels, or to - * [`ChannelManager::accept_inbound_channel`] for inbound channels if - * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be randomized for an inbound channel. - * - * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This - * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but - * was not actually claimed until after upgrading.) - * - * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + * Set this feature as required. */ -void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); +void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * The block height at which this HTLC expires. + * Checks if this feature is supported. */ -uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * The block height at which this HTLC expires. + * Set this feature as optional. */ -void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); +void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * The amount (in msats) of this part of an MPP. + * Set this feature as required. */ -uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * The amount (in msats) of this part of an MPP. + * Checks if this feature is supported. */ -void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new ClaimedHTLC given each field + * Checks if this feature is required. */ -MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg); +MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ClaimedHTLC + * Checks if this feature is required. */ -struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two ClaimedHTLCs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - * Two objects with NULL inner values will be considered "equal" here. + * Checks if this feature is required. */ -bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write + * Set this feature as optional. */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser); +void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PathFailure + * Set this feature as required. */ -void PathFailure_free(struct LDKPathFailure this_ptr); +void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PathFailure + * Checks if this feature is supported. */ -struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InitialSend-variant PathFailure + * Set this feature as optional. */ -struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); +void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OnPath-variant PathFailure + * Set this feature as required. */ -struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); +void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two PathFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is supported. */ -bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the PathFailure object into a byte array which can be read by PathFailure_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); +MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a PathFailure from a byte array, created by PathFailure_write + * Checks if this feature is required. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ClosureReason + * Set this feature as optional. */ -void ClosureReason_free(struct LDKClosureReason this_ptr); +void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ClosureReason + * Set this feature as required. */ -struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); +void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason + * Checks if this feature is supported. */ -struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg); +MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HolderForceClosed-variant ClosureReason + * Set this feature as optional. */ -struct LDKClosureReason ClosureReason_holder_force_closed(void); +void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CooperativeClosure-variant ClosureReason + * Set this feature as required. */ -struct LDKClosureReason ClosureReason_cooperative_closure(void); +void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason + * Checks if this feature is supported. */ -struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); +MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new FundingTimedOut-variant ClosureReason + * Set this feature as optional. */ -struct LDKClosureReason ClosureReason_funding_timed_out(void); +void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ProcessingError-variant ClosureReason + * Set this feature as required. */ -struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); +void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DisconnectedPeer-variant ClosureReason + * Checks if this feature is supported. */ -struct LDKClosureReason ClosureReason_disconnected_peer(void); +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason + * Checks if this feature is required. */ -struct LDKClosureReason ClosureReason_outdated_channel_manager(void); +MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason + * Checks if this feature is required. */ -struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); +MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new FundingBatchClosure-variant ClosureReason + * Checks if this feature is required. */ -struct LDKClosureReason ClosureReason_funding_batch_closure(void); +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two ClosureReasons contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); +void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + * Set this feature as required. */ -struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); +void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a ClosureReason from a byte array, created by ClosureReason_write + * Checks if this feature is supported. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); +MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the HTLCDestination + * Set this feature as optional. */ -void HTLCDestination_free(struct LDKHTLCDestination this_ptr); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the HTLCDestination + * Set this feature as required. */ -struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new NextHopChannel-variant HTLCDestination + * Checks if this feature is supported. */ -struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id); +MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnknownNextHop-variant HTLCDestination + * Set this feature as optional. */ -struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidForward-variant HTLCDestination + * Set this feature as required. */ -struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new FailedPayment-variant HTLCDestination + * Checks if this feature is supported. */ -struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two HTLCDestinations contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b); +MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); +MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a HTLCDestination from a byte array, created by HTLCDestination_write + * Checks if this feature is required. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PaymentFailureReason + * Set this feature as optional. */ -enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig); +void InitFeatures_set_route_blinding_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason + * Set this feature as required. */ -enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void); +void InitFeatures_set_route_blinding_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason + * Checks if this feature is supported. */ -enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void); +MUST_USE_RES bool InitFeatures_supports_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason + * Set this feature as optional. */ -enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void); +void NodeFeatures_set_route_blinding_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason + * Set this feature as required. */ -enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void); +void NodeFeatures_set_route_blinding_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason + * Checks if this feature is supported. */ -enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void); +MUST_USE_RES bool NodeFeatures_supports_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason + * Checks if this feature is required. */ -enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void); +MUST_USE_RES bool InitFeatures_requires_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two PaymentFailureReasons contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_requires_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read + * Set this feature as optional. */ -struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj); +void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write + * Set this feature as required. */ -struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser); +void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Event + * Checks if this feature is supported. */ -void Event_free(struct LDKEvent this_ptr); +MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Event + * Set this feature as optional. */ -struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); +void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new FundingGenerationReady-variant Event + * Set this feature as required. */ -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); +void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentClaimable-variant Event + * Checks if this feature is supported. */ -struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKCOption_ThirtyTwoBytesZ via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); +MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentClaimed-variant Event + * Checks if this feature is required. */ -struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat); +MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvoiceRequestFailed-variant Event + * Checks if this feature is required. */ -struct LDKEvent Event_invoice_request_failed(struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentSent-variant Event + * Set this feature as optional. */ -struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); +void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentFailed-variant Event + * Set this feature as required. */ -struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); +void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentPathSuccessful-variant Event + * Checks if this feature is supported. */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path); +MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentPathFailed-variant Event + * Set this feature as optional. */ -struct LDKEvent Event_payment_path_failed(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); +void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ProbeSuccessful-variant Event + * Set this feature as required. */ -struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); +void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ProbeFailed-variant Event + * Checks if this feature is supported. */ -struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); +MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PendingHTLCsForwardable-variant Event + * Set this feature as optional. */ -struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HTLCIntercepted-variant Event + * Set this feature as required. */ -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); +void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SpendableOutputs-variant Event + * Checks if this feature is supported. */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKCOption_ThirtyTwoBytesZ channel_id); +MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PaymentForwarded-variant Event + * Checks if this feature is required. */ -struct LDKEvent Event_payment_forwarded(struct LDKCOption_ThirtyTwoBytesZ prev_channel_id, struct LDKCOption_ThirtyTwoBytesZ next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); +MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelPending-variant Event + * Checks if this feature is required. */ -struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKCOption_ThirtyTwoBytesZ former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo); +MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelReady-variant Event + * Checks if this feature is required. */ -struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); +MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelClosed-variant Event + * Set this feature as optional. */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats); +void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DiscardFunding-variant Event + * Set this feature as required. */ -struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); +void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OpenChannelRequest-variant Event + * Checks if this feature is supported. */ -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); +MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HTLCHandlingFailed-variant Event + * Set this feature as optional. */ -struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); +void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BumpTransaction-variant Event + * Set this feature as required. */ -struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a); +void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two Events contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is supported. */ -bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the Event object into a byte array which can be read by Event_read + * Checks if this feature is required. */ -struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a Event from a byte array, created by Event_write + * Checks if this feature is required. */ -struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); +MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the MessageSendEvent + * Set this feature as optional. */ -void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); +void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); +void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); +MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg); +void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); +void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg); +MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); +MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); +MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg); +void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg); +void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg); +MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg); +void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxComplete-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg); +void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg); +MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg); +void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg); +void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendTxAbort-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); +MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendChannelReady-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); +MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); +MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); +MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); +void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); +void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendShutdown-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); +MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); +void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); +void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new HandleError-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); +MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent + * Set this feature as optional. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); +void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent + * Set this feature as required. */ -struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); +void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent + * Checks if this feature is supported. */ -struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); +MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent + * Checks if this feature is required. */ -struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); +MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Checks if this feature is required. */ -void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); +MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Checks if this feature is required. */ -void EventsProvider_free(struct LDKEventsProvider this_ptr); +MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Set this feature as optional. */ -void EventHandler_free(struct LDKEventHandler this_ptr); +void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj); +void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The parameters required to derive the signer for the anchor input. + * Checks if this feature is supported. */ -struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The parameters required to derive the signer for the anchor input. + * Checks if this feature is required. */ -void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); +MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The transaction input's outpoint corresponding to the commitment transaction's anchor - * output. + * Set this feature as optional. */ -struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); +void InitFeatures_set_trampoline_routing_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The transaction input's outpoint corresponding to the commitment transaction's anchor - * output. + * Set this feature as required. */ -void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void InitFeatures_set_trampoline_routing_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new AnchorDescriptor given each field + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg); +MUST_USE_RES bool InitFeatures_supports_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the AnchorDescriptor + * Set this feature as optional. */ -struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig); +void NodeFeatures_set_trampoline_routing_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two AnchorDescriptors 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 AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b); +void NodeFeatures_set_trampoline_routing_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the UTXO to be spent by the anchor input, which can be obtained via - * [`Self::unsigned_tx_input`]. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the unsigned transaction input spending the anchor output in the commitment - * transaction. + * Set this feature as optional. */ -MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +void Bolt11InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Returns the witness script of the anchor output in the commitment transaction. + * Set this feature as required. */ -MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +void Bolt11InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Returns the fully signed witness required to spend the anchor output in the commitment - * transaction. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Derives the channel signer required to sign the anchor input. + * Checks if this feature is required. */ -MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +MUST_USE_RES bool InitFeatures_requires_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the BumpTransactionEvent + * Checks if this feature is required. */ -void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr); +MUST_USE_RES bool NodeFeatures_requires_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the BumpTransactionEvent + * Checks if this feature is required. */ -struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent + * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. */ -struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKThirtyTwoBytes claim_id, uint32_t package_target_feerate_sat_per_1000_weight, struct LDKTransaction commitment_tx, uint64_t commitment_tx_fee_satoshis, struct LDKAnchorDescriptor anchor_descriptor, struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs); +void RoutingFees_free(struct LDKRoutingFees this_obj); /** - * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent + * Flat routing fee in millisatoshis. */ -struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Checks if two BumpTransactionEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Flat routing fee in millisatoshis. */ -bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the Input, if is_owned is set and inner is non-NULL. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -void Input_free(struct LDKInput this_obj); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * The unique identifier of the input. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * The unique identifier of the input. + * Constructs a new RoutingFees given each field */ -void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val); +MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); /** - * The UTXO being spent by the input. + * 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. */ -struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr); +bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); /** - * The UTXO being spent by the input. + * Creates a copy of the RoutingFees */ -void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val); +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and - * [`TxIn::witness`], each with their lengths included, required to satisfy the output's - * script. + * Generates a non-cryptographic 64-bit hash of the RoutingFees. */ -uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr); +uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and - * [`TxIn::witness`], each with their lengths included, required to satisfy the output's - * script. + * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. */ -void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val); +void RouteHint_free(struct LDKRouteHint this_obj); + +struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); + +void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); /** - * Constructs a new Input given each field + * Constructs a new RouteHint given each field */ -MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg); +MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); /** - * Creates a copy of the Input + * Creates a copy of the RouteHint */ -struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the Input. + * Generates a non-cryptographic 64-bit hash of the RouteHint. */ -uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o); +uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); /** - * Checks if two Inputs contain equal inner contents. + * Checks if two RouteHints contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. * Two objects with NULL inner values will be considered "equal" here. */ -bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b); +bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); /** - * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL. + * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. */ -void Utxo_free(struct LDKUtxo this_obj); +void RouteHintHop_free(struct LDKRouteHintHop this_obj); /** - * The unique identifier of the output. + * The node_id of the non-target end of the route */ -struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr); +struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * The unique identifier of the output. + * The node_id of the non-target end of the route */ -void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The output to spend. + * The short_channel_id of this channel */ -struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr); +uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * The output to spend. + * The short_channel_id of this channel */ -void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val); +void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each - * with their lengths included, required to satisfy the output's script. The weight consumed by - * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. + * The fees which must be paid to use this channel */ -uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr); +struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each - * with their lengths included, required to satisfy the output's script. The weight consumed by - * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. + * The fees which must be paid to use this channel */ -void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val); +void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Constructs a new Utxo given each field + * The difference in CLTV values between this node and the next node. */ -MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg); +uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Creates a copy of the Utxo + * The difference in CLTV values between this node and the next node. */ -struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig); +void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); /** - * Generates a non-cryptographic 64-bit hash of the Utxo. + * The minimum value, in msat, which must be relayed to the next hop. */ -uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o); +struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Checks if two Utxos 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 value, in msat, which must be relayed to the next hop. */ -bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b); +void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output. + * The maximum value in msat available for routing with a single HTLC. */ -MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]); +struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL. + * The maximum value in msat available for routing with a single HTLC. */ -void CoinSelection_free(struct LDKCoinSelection this_obj); +void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction - * requiring additional fees. + * Constructs a new RouteHintHop given each field */ -struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); /** - * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction - * requiring additional fees. + * Creates a copy of the RouteHintHop */ -void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val); +struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); /** - * An additional output tracking whether any change remained after coin selection. This output - * should always have a value above dust for its given `script_pubkey`. It should not be - * spent until the transaction it belongs to confirms to ensure mempool descendant limits are - * not met. This implies no other party should be able to spend it except us. + * Generates a non-cryptographic 64-bit hash of the RouteHintHop. */ -struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr); +uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); /** - * An additional output tracking whether any change remained after coin selection. This output - * should always have a value above dust for its given `script_pubkey`. It should not be - * spent until the transaction it belongs to confirms to ensure mempool descendant limits are - * not met. This implies no other party should be able to spend it except us. + * 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 CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val); +bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); /** - * Constructs a new CoinSelection given each field + * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg); +void UntrustedString_free(struct LDKUntrustedString this_obj); -/** - * Creates a copy of the CoinSelection - */ -struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig); +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); /** - * Calls the free function if one is set + * Constructs a new UntrustedString given each field */ -void CoinSelectionSource_free(struct LDKCoinSelectionSource this_ptr); +MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg); /** - * Calls the free function if one is set + * Creates a copy of the UntrustedString */ -void WalletSource_free(struct LDKWalletSource this_ptr); +struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig); /** - * Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL. + * 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. */ -void Wallet_free(struct LDKWallet this_obj); +bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); /** - * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation - * of [`CoinSelectionSource`]. + * Generates a non-cryptographic 64-bit hash of the UntrustedString. */ -MUST_USE_RES struct LDKWallet Wallet_new(struct LDKWalletSource source, struct LDKLogger logger); +uint64_t UntrustedString_hash(const struct LDKUntrustedString *NONNULL_PTR o); /** - * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is + * Get the string representation of a UntrustedString object */ -struct LDKCoinSelectionSource Wallet_as_CoinSelectionSource(const struct LDKWallet *NONNULL_PTR this_arg); +struct LDKStr UntrustedString_to_str(const struct LDKUntrustedString *NONNULL_PTR o); /** - * Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. */ -void BumpTransactionEventHandler_free(struct LDKBumpTransactionEventHandler this_obj); +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); /** - * Returns a new instance capable of handling [`Event::BumpTransaction`] events. - * - * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction + * Constructs a new PrintableString given each field */ -MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSource utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger); +MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); /** - * Handles all variants of [`BumpTransactionEvent`]. + * Get the string representation of a PrintableString object */ -void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); +struct LDKStr PrintableString_to_str(const struct LDKPrintableString *NONNULL_PTR o); /** * Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL. @@ -46277,7 +60208,7 @@ struct LDKGossipSync GossipSync_none(void); * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable */ -MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer); +MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKOnionMessenger *NONNULL_PTR onion_messenger, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer); /** * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -46825,6 +60756,15 @@ bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallba */ void Bolt11InvoiceSignature_free(struct LDKBolt11InvoiceSignature this_obj); +struct LDKRecoverableSignature Bolt11InvoiceSignature_get_a(const struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr); + +void Bolt11InvoiceSignature_set_a(struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr, struct LDKRecoverableSignature val); + +/** + * Constructs a new Bolt11InvoiceSignature given each field + */ +MUST_USE_RES struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_new(struct LDKRecoverableSignature a_arg); + /** * Creates a copy of the Bolt11InvoiceSignature */ @@ -46951,6 +60891,9 @@ MUST_USE_RES struct LDKBolt11InvoiceFeatures RawBolt11Invoice_features(const str MUST_USE_RES struct LDKCVec_PrivateRouteZ RawBolt11Invoice_private_routes(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +/** + * Returns `None` if no amount is set or on overflow. + */ MUST_USE_RES struct LDKCOption_u64Z RawBolt11Invoice_amount_pico_btc(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); MUST_USE_RES enum LDKCurrency RawBolt11Invoice_currency(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); @@ -47080,6 +61023,12 @@ MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct */ MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +/** + * Recover the payee's public key if one was included in the invoice, otherwise return the + * recovered public key from the signature + */ +MUST_USE_RES struct LDKPublicKey Bolt11Invoice_get_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); + /** * Returns the Duration since the Unix epoch at which the invoice expires. * Returning None if overflow occurred. @@ -47145,17 +61094,27 @@ MUST_USE_RES enum LDKCurrency Bolt11Invoice_currency(const struct LDKBolt11Invoi MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * Creates a new `Description` if `description` is at most 1023 __bytes__ long, - * returns [`CreationError::DescriptionTooLong`] otherwise + * Creates a new `Description` if `description` is at most 1023 * 5 bits (i.e., 639 bytes) + * long, and 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 [`UntrustedString`] + */ +MUST_USE_RES struct LDKUntrustedString Description_into_inner(struct LDKDescription this_arg); + +/** + * Get a reference to the underlying description [`UntrustedString`] + */ +MUST_USE_RES struct LDKUntrustedString Description_as_inner(const struct LDKDescription *NONNULL_PTR this_arg); + +/** + * Get the string representation of a Description object */ -MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg); +struct LDKStr Description_to_str(const struct LDKDescription *NONNULL_PTR o); /** * Construct an `ExpiryTime` from seconds. @@ -47330,273 +61289,6 @@ bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, */ struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); -/** - * Pays the given [`Bolt11Invoice`], retrying if needed based on [`Retry`]. - * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. - * - * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`]. - */ -struct LDKCResult_ThirtyTwoBytesPaymentErrorZ pay_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Pays the given [`Bolt11Invoice`] with a custom idempotency key, retrying if needed based on - * [`Retry`]. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. - * - * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token. - */ -struct LDKCResult_NonePaymentErrorZ pay_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount, retrying if needed based on - * [`Retry`]. - * - * [`Bolt11Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long - * as the payment is still pending. If the payment succeeds, you must ensure that a second payment - * with the same [`PaymentHash`] is never sent. - * - * If you wish to use a different payment idempotency token, see - * [`pay_zero_value_invoice_with_id`]. - */ -struct LDKCResult_ThirtyTwoBytesPaymentErrorZ pay_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Pays the given zero-value [`Bolt11Invoice`] using the given amount and custom idempotency key, - * retrying if needed based on [`Retry`]. - * - * Note that idempotency is only guaranteed as long as the payment is still pending. Once the - * payment completes or fails, no idempotency guarantees are made. - * - * You should ensure that the [`Bolt11Invoice::payment_hash`] is unique and the same - * [`PaymentHash`] has never been paid before. - * - * See [`pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the - * idempotency token. - */ -struct LDKCResult_NonePaymentErrorZ pay_zero_value_invoice_with_id(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, const struct LDKChannelManager *NONNULL_PTR channelmanager); - -/** - * Sends payment probes over all paths of a route that would be used to pay the given invoice. - * - * See [`ChannelManager::send_preflight_probes`] for more information. - */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z liquidity_limit_multiplier); - -/** - * Sends payment probes over all paths of a route that would be used to pay the given zero-value - * invoice using the given amount. - * - * See [`ChannelManager::send_preflight_probes`] for more information. - */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_zero_value_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat, const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z liquidity_limit_multiplier); - -/** - * Frees any resources used by the PaymentError - */ -void PaymentError_free(struct LDKPaymentError this_ptr); - -/** - * Creates a copy of the PaymentError - */ -struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Invoice-variant PaymentError - */ -struct LDKPaymentError PaymentError_invoice(struct LDKStr a); - -/** - * Utility method to constructs a new Sending-variant PaymentError - */ -struct LDKPaymentError PaymentError_sending(enum LDKRetryableSendFailure a); - -/** - * Checks if two PaymentErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool PaymentError_eq(const struct LDKPaymentError *NONNULL_PTR a, const struct LDKPaymentError *NONNULL_PTR b); - -/** - * Frees any resources used by the ProbingError - */ -void ProbingError_free(struct LDKProbingError this_ptr); - -/** - * Creates a copy of the ProbingError - */ -struct LDKProbingError ProbingError_clone(const struct LDKProbingError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Invoice-variant ProbingError - */ -struct LDKProbingError ProbingError_invoice(struct LDKStr a); - -/** - * Utility method to constructs a new Sending-variant ProbingError - */ -struct LDKProbingError ProbingError_sending(struct LDKProbeSendFailure a); - -/** - * Checks if two ProbingErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool ProbingError_eq(const struct LDKProbingError *NONNULL_PTR a, const struct LDKProbingError *NONNULL_PTR b); - -/** - * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" - * See [`PhantomKeysManager`] for more information on phantom node payments. - * - * `phantom_route_hints` parameter: - * * Contains channel info for all nodes participating in the phantom invoice - * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each - * participating node - * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is - * updated when a channel becomes disabled or closes - * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice - * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared - * down - * - * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference - * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). - * If `None` is provided for `payment_hash`, then one will be created. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * `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). - * - * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager - * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints - * [`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. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); - -/** - * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" - * See [`PhantomKeysManager`] for more information on phantom node payments. - * - * `phantom_route_hints` parameter: - * * Contains channel info for all nodes participating in the phantom invoice - * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each - * participating node - * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is - * updated when a channel becomes disabled or closes - * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum - * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected - * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node - * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as - * desired, but note that some nodes will be trimmed if more than 3 nodes are provided. - * - * `description_hash` is a SHA-256 hash of the description text - * - * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference - * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). - * If `None` is provided for `payment_hash`, then one will be created. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * `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). - * - * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager - * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints - * [`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 - * - * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not - * available and the current time is supplied by the caller. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); - -/** - * Utility to construct an invoice. Generally, unless you want to do something like a custom - * cltv_expiry, this is what you should be using to create an invoice. The reason being, this - * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user - * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify - * that the payment secret is valid when the invoice is paid. - * - * `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_Bolt11InvoiceSignOrCreationErrorZ 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 - * cltv_expiry, this is what you should be using to create an invoice. The reason being, this - * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user - * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify - * that the payment secret is valid when the invoice is paid. - * Use this variant if you want to pass the `description_hash` to the invoice. - * - * `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_Bolt11InvoiceSignOrCreationErrorZ 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_Bolt11InvoiceSignOrCreationErrorZ 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_Bolt11InvoiceSignOrCreationErrorZ 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`] - * This version allows for providing a custom [`PaymentHash`] for the invoice. - * This may be useful if you're building an on-chain swap or involving another protocol where - * the payment hash is also involved outside the scope of lightning. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ 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 */ @@ -47642,6 +61334,26 @@ struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o); */ struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o); +/** + * Frees any resources used by the GraphSyncError + */ +void GraphSyncError_free(struct LDKGraphSyncError this_ptr); + +/** + * Creates a copy of the GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new DecodeError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); + +/** + * Utility method to constructs a new LightningError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); + /** * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL. */ @@ -47685,26 +61397,6 @@ MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network */ MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); -/** - * Frees any resources used by the GraphSyncError - */ -void GraphSyncError_free(struct LDKGraphSyncError this_ptr); - -/** - * Creates a copy of the GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new DecodeError-variant GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); - -/** - * Utility method to constructs a new LightningError-variant GraphSyncError - */ -struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); - #endif /* LDK_C_BINDINGS_H */ #include "ldk_ver.h"